Package: alv
alv: a command-line alignment viewerView your DNA or protein multiple-sequence alignments right at your command line. No need to launch a
GUI!Note:alvrequires Python v3.4 or later. Earlier versions may also work, but this has not been
tested.Latest feature additionsIf you have more than one alignment in your input file, then the first alignment is output unless you
use the --alignment-index (-ai) option to choose another.alvis now adapted for use in Python notebooks (tested on Jupyter) through two convenience functions
'view' and 'glimpse'.  Both functions take a BioPython alignment object and outputs a view of the
alignment.Writingfrom Bio import AlignIO
msa = AlignIO.read('PF00005.fa', 'fasta')
import alv
alv.view(msa)in a Jupyter notebook cell and evaluating will yield a colored alignment in thealvstyle.For large alignments, the glimpse function is convenient since a subset of the alignment, selected
as an easily detected conserved region, is shown.alv.glimpse(msa)Look for more usage information viewhelp(alv.view)in a notebook cell.FeaturesCommand-line based, no GUI, so easy to script viewing of many (typically small) MSAs.Reads alignments in FASTA, Clustal, PHYLIP, NEXUS, and Stockholm formats, from file orstdin.Output is formatted to suit your terminal. You can also set the alignment width with option-w.Can color alignments of coding DNA by codon's translations to amino acids.Guesses sequence type (DNA/RNA/AA/coding) by default. You can override with option-t.Order sequence explicitly, alphabetically, or by sequence similarity.Restrict coloring to where you don't have indels or where there is a lot of conservation.Focus on variable columns with the options--only-variableand--only-variable-excluding-indels, contributed by nikostr, that constrains
coloring to columns with variation and variation not counting indels.The commandalv -g huge_msa.fadisplays cut-out of the MSA, guaranteed to fit
one terminal page without scrolling or MSA line breaking, that is supposed to
give you an idea of alignment quality and contents.Writealv -r 20 huge_msa.fato get a view of the MSA containing only 20 randomly
selected sequences.InstallRecommended installation is:pip install --upgrade pip
pip install alvIf you have a half-modern BioPython installed, Python v3.4shouldwork.
BioPython is a dependency and will only get installed automatially withpip install alvif you are using Python v3.6 or later, because BioPython was apparently not on PyPi before that.ExamplesQuick viewing of a small alignment:alv msa.faThis autodetects sequence type (AA, DNA, RNA, coding DNA), colors the sequences, and formats the
alignment for easy viewing in your terminal.
When applyingalvto an alignment of coding DNA, the coding property is autodetected and colors are therefore applied to codons instead
of nucleotides.View three sequences, accessionsa,b, andc, from an alignment:alv -so a,b,c msa.faFeed alignment toless, for paging support.alv -k msa.fa | less -RThe-koption ensures thatalvkeeps coloring the alignment (by default, piping
and redirection removes colors), and the-Roption instructslessto interpret color codes.For developersRunpython setup.py develop testfor development install and to execute tests.ScreenshotsFull PFAM domainAll of the sequences in PFAM's seed alignment for PF00005Yeast sequences from PF00005Using the option-sm YEAST, we reduce the alignment to the ones with a matching accession.