Skip to main content

A Rich renderable for viewing Multiple Sequence Alignments in the terminal.

Project description

rich-msa Stars

A simple module to render colorful Multiple Sequence Alignment with rich in the terminal.

Actions Coverage License PyPI Wheel Python Versions Python Implementations Source Mirror GitHub issues Changelog Downloads

🔧 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: screenshot

🪛 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rich-msa-0.1.0.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

rich_msa-0.1.0-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page