Multiple Sequence Alignment¶
This module defines MSA analysis functions.
MSA(msa, title='Unknown', labels=None, **kwargs)¶
Store and manipulate multiple sequence alignments.
msa must be a 2D Numpy character array. labels is a list of sequence labels (or titles). mapping should map label or part of label to sequence index in msa array. If mapping is not given, one will be build from labels.
Returns the number of sequences that label maps onto.
Returns a copy of the MSA character array.
Returns index of the sequence that label maps onto. If label maps onto multiple sequences or label is a list of labels, a list of indices is returned. If an index for a label is not found, return None.
Returns label of the sequence at given index. Residue numbers will be removed from the sequence label, unless full is True.
Returns starting and ending residue numbers (resnum) for the sequence at given index.
Returns title of the instance.
Returns True if MSA is aligned.
Yield sequence labels. By default the part of the label used for indexing sequences is yielded.
Returns number of sequences that are indexed using the identifier part or all of their labels. The return value should be equal to number of sequences.
Returns number of residues (or columns in the MSA), if MSA is aligned.
Returns number of sequences.
Set title of the instance.
Return split label when iterating or indexing.
refineMSA(msa, label=None, rowocc=None, seqid=None, colocc=None, **kwargs)¶
Refine msa by removing sequences (rows) and residues (columns) that contain gaps.
- msa (
MSA) – multiple sequence alignment
- label (str) – remove columns that are gaps in the sequence matching label,
msa.getIndex(label)must return a sequence index, a PDB identifier is also acceptable
- rowocc (float) – row occupancy, sequences with less occupancy will be removed after label refinement is applied
- seqid (float) – keep unique sequences at specified sequence identity level,
unique sequences are identified using
- colocc (float) – column occupancy, residue positions with less occupancy will be removed after other refinements are applied
- keep – keep columns corresponding to residues not resolved in the PDB structure, default is False, applies when label is a PDB identifier
- type – bool
For Pfam MSA data, label is UniProt entry name for the protein. You may also use PDB structure and chain identifiers, e.g.
'1p38A', for label argument and UniProt entry names will be parsed using
parsePDBHeader()function (see also
The order of refinements are applied in the order of arguments. If label and unique is specified is specified, sequence matching label will be kept in the refined
MSAalthough it may be similar to some other sequence.
- msa (
MSAobtained from merging parts of the sequences of proteins present in multiple msa instances. Sequences are matched based on protein identifiers found in the sequence labels. Order of sequences in the merged MSA will follow the order of sequences in the first msa instance. Note that protein identifiers that map to multiple sequences will be excluded.
MSAobtained from merging parts of the sequences of proteins present in multiple msa instances. Sequences are matched based on species section of protein identifiers found in the sequence labels. Order of sequences in the merged MSA will follow the order of sequences in the first msa instance. Note that protein identifiers that map to multiple sequences will be excluded.