Skip to main content

Overview

The MSA (Multiple Sequence Alignment) module provides tools for generating, processing, and featurising multiple sequence alignments. MSAs capture evolutionary information that AlphaFold 3 uses to predict protein structure.

Classes

Msa

Container for multiple sequence alignments with manipulation methods.
str
required
The sequence used to search for the MSA.
str
required
Polymer type of the query sequence (see mmcif_names for valid types: PROTEIN_CHAIN, RNA_CHAIN, DNA_CHAIN).
Sequence[str]
required
MSA sequences from search tool. First sequence must match query in featurised form. Empty sequences default to query only.
Sequence[str]
required
Metadata for each MSA sequence. Must match length of sequences.
bool
default:"True"
Whether to deduplicate MSA sequences in input order. Lowercase letters (insertions) are ignored during deduplication.
Properties:
int
Number of sequences in the MSA.
str
The original query sequence.
str
The polymer type of the sequences.
list[str]
List of MSA sequences.
list[str]
List of sequence descriptions.
Example:

Class Methods

from_a3m
Parse a single A3M format string and build an MSA object.
str
required
The query sequence used for MSA search.
str
required
Polymer type of the sequence.
str
required
MSA in A3M format.
int | None
Maximum number of sequences to keep. If specified and positive, crops MSA to this depth.
bool
default:"True"
Whether to deduplicate sequences.
Example:
from_multiple_a3ms
Merge multiple A3M strings into a single MSA.
Sequence[str]
required
Multiple A3M strings from different tools/databases. Query sequences must match across all A3Ms.
str
required
Polymer type of the sequences.
bool
default:"True"
Whether to deduplicate merged sequences.
Example:
from_multiple_msas
Merge multiple MSA objects into one.
Sequence[Msa]
required
Multiple MSA objects. All must have matching query sequences and polymer types.
bool
default:"True"
Whether to deduplicate merged sequences.
from_empty
Create an empty MSA containing only the query sequence.
Example:

Instance Methods

to_a3m
Convert the MSA to A3M format string.
Example:
featurize
Convert MSA to numerical features for model input.
MutableMapping[str, np.ndarray]
Dictionary with keys:
  • msa: Encoded MSA sequences as integer array
  • deletion_matrix: Deletion counts at each position
  • msa_species_identifiers: Species IDs extracted from descriptions
  • num_alignments: Total number of sequences
Raises:
  • msa.Error: If sequences have different lengths after removing deletions, contain unknown codes, or if MSA is empty after alignment
Example:

Functions

get_msa

Run MSA search tool and return MSA object.
str
required
The amino acid or nucleotide sequence to search.
msa_config.RunConfig
required
MSA run configuration specifying tool and parameters.
str
required
Type of chain for MSA search (protein, RNA, DNA).
bool
default:"False"
Whether to deduplicate sequences (insertions ignored).
Msa
MSA object containing aligned sequences.
Example:

get_msa_tool

Get an MSA search tool instance from configuration.
msa_config.JackhmmerConfig | msa_config.NhmmerConfig
required
Configuration for Jackhmmer (protein) or Nhmmer (RNA/DNA) tool.
msa_tool.MsaTool
Configured MSA search tool instance.
Example:

sequences_are_feature_equivalent

Check if two sequences produce identical features.
str
required
First sequence to compare.
str
required
Second sequence to compare.
str
required
Polymer type for featurisation.
bool
True if sequences produce identical features, False otherwise.
Example:

MSA Search Tools

Jackhmmer (Protein)

Iterative sequence search using HMM profiles. Best for protein sequences. Configuration:

Nhmmer (RNA/DNA)

HMM-based search for nucleotide sequences. Used for RNA and DNA. Configuration:

Error Handling