rich-msa
A simple module to render colorful Multiple Sequence Alignment with rich
in the terminal.
π§
Installing
Install the rich-msa
package directly from PyPi which hosts universal wheels that can be installed with pip
:
$ pip install rich-msa
π‘
Example
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)
You should get an output similar to the following picture, scaled to your terminal width:
πͺ
Command-Line
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
Use the -f
flag to change the file format from aligned FASTA (default) to any alignment format supported by Biopython.
π
Feedback
β οΈ
Issue Tracker
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.
ποΈ
Contributing
Contributions are more than welcome! See CONTRIBUTING.md
for more details.
βοΈ
License
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.