Alignment#
- class pyfamsa.Alignment#
An alignment, stored as a list of
GappedSequence
objects.An alignment can be created from an iterable of
GappedSequence
that are all the same gapped size:>>> s1 = GappedSequence(b"seq1", b"MA-WMRLLPL") >>> s2 = GappedSequence(b"seq2", b"MALWTR-RPL") >>> alignment = Alignment([s1, s2])
The individual rows of the alignment can be accessed using the usual indexing operation, and the alignment can be sliced to select only certain rows:
>>> alignment[0].id b'seq1' >>> len(alignment[:1]) 1
- __getitem__(key, /)#
Return self[key].
- __init__(sequences=())#
Create a new alignment containing the provided sequences.
- Parameters:
sequences (iterable of
GappedSequence
) – The gapped sequences to store in the alignment.- Raises:
ValueError – When the given sequences are not all of the same gapped size, thus are not forming a proper alignment.
- __len__()#
Return len(self).
- copy()#
Copy the sequence object, and return the copy.