A simple module to render colorful Multiple Sequence Alignment with
rich in the terminal.
rich-msa package directly from PyPi which hosts universal wheels that can be installed with
$ pip install rich-msa
Use Biopython to load a MSA from an aligned FASTA file, and render it to the terminal:
import Bio.AlignIO import rich from rich_msa import RichAlignment msa = Bio.AlignIO.read("tests/data/swissprot-halorhodopsin.muscle.afa", "fasta") viewer = RichAlignment( names=[record.id for record in msa], sequences=[str(record.seq) for record in msa], ) panel = rich.panel.Panel(viewer, title="swissprot-halorhodopsin.muscle.afa") rich.print(panel)
If you have the
rich-msa library installed from PyPI, you can use it directly to view any alignment file, provided you have Biopython installed:
$ python -m rich_msa -i tests/data/swissprot-halorhodopsin.muscle.afa
-f flag to change the file format from aligned FASTA (default) to any alignment format supported by Biopython.
Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.
Contributions are more than welcome! See
CONTRIBUTING.md for more details.
This library is provided under the MIT License.
This project is in no way not affiliated, sponsored, or otherwise endorsed by the original Rich authors. It was developed by Martin Larralde during his PhD project at the European Molecular Biology Laboratory in the Zeller team.