https://github.com/althonos/rich-msa
A Rich renderable for viewing Multiple Sequence Alignments in the terminal.
https://github.com/althonos/rich-msa
Last synced: 4 months ago
JSON representation
A Rich renderable for viewing Multiple Sequence Alignments in the terminal.
- Host: GitHub
- URL: https://github.com/althonos/rich-msa
- Owner: althonos
- License: mit
- Created: 2022-05-10T15:02:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-31T19:37:00.000Z (over 3 years ago)
- Last Synced: 2025-09-09T04:57:13.027Z (4 months ago)
- Language: Python
- Size: 276 KB
- Stars: 84
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: COPYING
Awesome Lists containing this project
- awesome-genome-visualization - rich-msa - genome-visualization/richmsa.png) (Text based)
README
# `rich-msa` [](https://github.com/althonos/rich-msa/stargazers)
*A simple module to render colorful Multiple Sequence Alignment with `rich` in the terminal.*
[](https://github.com/althonos/rich-msa/actions)
[](https://codecov.io/gh/althonos/rich-msa/)
[](https://choosealicense.com/licenses/mit/)
[](https://pypi.org/project/rich-msa)
[](https://pypi.org/project/rich-msa/#files)
[](https://pypi.org/project/rich-msa/#files)
[](https://pypi.org/project/rich-msa/#files)
[](https://github.com/althonos/rich-msa/)
[](https://git.embl.de/larralde/rich-msa/)
[](https://github.com/althonos/rich-msa/issues)
[](https://github.com/althonos/rich-msa/blob/master/CHANGELOG.md)
[](https://pepy.tech/project/rich-msa)
## 🔧 Installing
Install the `rich-msa` package directly from [PyPi](https://pypi.org/project/rich-msa)
which hosts universal wheels that can be installed with `pip`:
```console
$ pip install rich-msa
```
## 💡 Example
Use Biopython to load a MSA from an aligned FASTA file, and render it to the
terminal:
```python
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](https://biopython.org) installed:
```console
$ 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](https://github.com/althonos/rich-msa/issues) 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`](https://github.com/althonos/rich-msa/blob/main/CONTRIBUTING.md)
for more details.
## ⚖️ License
This library is provided under the [MIT License](https://choosealicense.com/licenses/mit/).
*This project is in no way not affiliated, sponsored, or otherwise endorsed
by the [original Rich authors](https://github.com/textualize). It was developed
by [Martin Larralde](https://github.com/althonos/) during his PhD project
at the [European Molecular Biology Laboratory](https://www.embl.de/) in
the [Zeller team](https://github.com/zellerlab).*