MSA#

class pycomsa.MSA#

A multiple sequence alignment.

names#

The names of the sequences in the alignment.

Type:

Sequence of str

sequences#

The sequences in the alignment.

Type:

Sequence of str

__init__(id='', accession='', names=(), sequences=())#

Create a new MSA object.

Parameters:
  • id (str) – The identifier of the alignment.

  • accession (str) – The accesion of the alignment.

  • names (Iterable of str) – The names of the sequences in the alignment.

  • sequences (Iterable of str or bytes) – The sequences of the alignment.

Example

>>> msa = pycomsa.MSA(
...     id="example_01",
...     names=["Sp8", "Sp10", "Sp26", "Sp6", "Sp17", "Sp33"],
...     sequences=[
...         "-----GLGKVIV-YGIVLGTKSDQFSNWVVWLFPWNGLQIHMMGII",
...         "-------DPAVL-FVIMLGTIT-KFS--SEWFFAWLGLEINMMVII",
...         "AAAAAAAAALLTYLGLFLGTDYENFA--AAAANAWLGLEINMMAQI",
...         "-----ASGAILT-LGIYLFTLCAVIS--VSWYLAWLGLEINMMAII",
...         "--FAYTAPDLL-LIGFLLKTVA-TFG--DTWFQLWQGLDLNKMPVF",
...         "-------PTILNIAGLHMETDI-NFS--LAWFQAWGGLEINKQAIL",
...     ]
... )
Raises:

ValueError – When names and sequences do not contain the same number of elements, or when sequences contain elements that do not all have the same length.

Note

For better compatibility, all values can be given as Python strings (str), in which case they will be UTF-8 encoded, or any object supporting the buffer-protocol (bytes, bytearray, memoryview, array.array, pyhmmer.easel.TextSequence, etc.).

accession#

The accession of the MSA.

Type:

str

id#

The identifier of the MSA.

Type:

str