Entering edit mode
2.0 years ago
moshi
▴
150
pyMSAviz is a MSA(Multiple Sequence Alignment) visualization python package for sequence analysis implemented based on matplotlib. This package is developed for the purpose of easily and beautifully plotting MSA in Python. It also implements the functionality to add markers, text annotations, highlights to specific positions and ranges in MSA. pyMSAviz was developed inspired by Jalview and ggmsa.
API Example 1
from pymsaviz import MsaViz, get_msa_testdata
msa_file = get_msa_testdata("HIGD2A.fa")
mv = MsaViz(msa_file, wrap_length=60, show_count=True)
mv.savefig("api_example01.png")
API Example 2
from pymsaviz import MsaViz, get_msa_testdata
msa_file = get_msa_testdata("MRGPRG.fa")
mv = MsaViz(msa_file, end=180, wrap_length=60, show_consensus=True)
# Extract MSA positions less than 50% consensus identity
pos_ident_less_than_50 = []
ident_list = mv._get_consensus_identity_list()
for pos, ident in enumerate(ident_list, 1):
if ident <= 50:
pos_ident_less_than_50.append(pos)
# Add markers
mv.add_markers([1])
mv.add_markers([10, 20], color="orange", marker="o")
mv.add_markers([30, (40, 50), 55], color="green", marker="+")
mv.add_markers(pos_ident_less_than_50, marker="x", color="blue")
# Add text annotations
mv.add_text_annotation((76, 102), "Gap Region", text_color="red", range_color="red")
mv.add_text_annotation((112, 123), "Gap Region", text_color="green", range_color="green")
mv.savefig("api_example03.png")
CLI Example 1
pymsaviz -i ./example/HIGD2A.fa -o cli_example01.png --color_scheme Identity
CLI Example 2
pymsaviz -i ./example/MRGPRG.fa -o cli_example03.png --start 100 --end 160 \
--color_scheme Flower --show_grid --show_consensus --consensus_color tomato
Great tool, thank you!
@moshi, you could add the ability for people to try your package right in their browser without needing to install anything on their own system by making very small additions to make it 'Binder-ready'. My fork is here. (You click the
launch binder
badge for launching a session from there.) You'll see I hardly added anything and the repo can be used by the MyBinder service to give users a temporary session without need for even logging in.Launch direct into the demo notebook: click here.
You can use the example fork to adapt your source repo to add the ability & I'd delete my fork. Just a suggestion. (I will aid that often it adds in advising users because it makes for a consistent place to work/troubleshoot by eliminating the 'works on my computer' problem.)