Overview
The features module handles the data-side processing of input features for AlphaFold 3. It provides dataclasses and functions for converting raw input data into model-ready tensors, including MSA processing, template features, token features, and atom layout management.Core Types
BatchDict
Type alias for feature dictionaries passed to the model.xnp_ndarray is a union type for NumPy or JAX arrays.
PaddingShapes
Defines padding dimensions for batched model inputs.int
required
Maximum number of tokens (residues + ligand atoms) in the sequence.
int
required
Maximum number of MSA rows to include.
int
required
Maximum number of chains in the complex.
int
required
Maximum number of structural templates.
int
required
Maximum number of atoms per token.
MSA Features
MSA Dataclass
Contains multiple sequence alignment features.xnp_ndarray
MSA sequences encoded as integers. Shape:
(msa_size, num_tokens)xnp_ndarray
Binary mask for valid MSA positions. Shape:
(msa_size, num_tokens)xnp_ndarray
Number of deletions at each MSA position. Shape:
(msa_size, num_tokens)xnp_ndarray
Occurrence of each residue type along the sequence, averaged over MSA rows. Shape:
(num_tokens, num_residue_types)xnp_ndarray
Occurrence of deletions along the sequence, averaged over MSA rows. Shape:
(num_tokens,)xnp_ndarray
Total number of MSA alignments (scalar).
compute_features
Computes MSA features from folding input.atom_layout.AtomLayout
required
Atom layout containing one representative atom per token.
np.ndarray
required
Token indices for non-flattened standard residues.
PaddingShapes
required
Padding dimensions for the output tensors.
folding_input.Input
required
Input data containing MSAs for each chain.
str
required
Name for logging (typically mmCIF ID).
int
required
Maximum number of paired sequences per species.
bool
default:true
Whether to deduplicate overlapping sequences in paired MSA.
Methods
index_msa_rows
Subsample MSA rows by indices.from_data_dict
Create MSA from batch dictionary.as_data_dict
Convert MSA to batch dictionary.Template Features
Templates Dataclass
Contains structural template features.xnp_ndarray
Amino acid type encoded as integers. Shape:
(num_templates, num_tokens)xnp_ndarray
3D coordinates of template atoms. Shape:
(num_templates, num_tokens, 24, 3)xnp_ndarray
Binary mask for valid template atoms. Shape:
(num_templates, num_tokens, 24)compute_features
Computes template features from protein chain templates.atom_layout.AtomLayout
required
Atom layout with representative atom per token.
np.ndarray
required
Indices for standard (non-flattened) tokens.
PaddingShapes
required
Padding dimensions.
folding_input.Input
required
Input containing template structures.
int
required
Maximum number of templates to use.
str
required
Name for logging.
Token Features
TokenFeatures Dataclass
Per-token features including chain identifiers and token types.xnp_ndarray
Residue index from input structure. Shape:
(num_tokens,)xnp_ndarray
Sequential token index (1-indexed). Shape:
(num_tokens,)xnp_ndarray
Encoded residue/ligand type. Shape:
(num_tokens,)xnp_ndarray
Binary mask for valid tokens. Shape:
(num_tokens,)xnp_ndarray
Total sequence length (scalar).
xnp_ndarray
Asymmetric unit ID for each chain. For A3B2 stoichiometry: 1, 2, 3, 4, 5. Shape:
(num_tokens,)xnp_ndarray
Entity ID grouping identical sequences. For A3B2: 1, 1, 1, 2, 2. Shape:
(num_tokens,)xnp_ndarray
Symmetry ID within entity. For A3B2: 1, 2, 3, 1, 2. Shape:
(num_tokens,)xnp_ndarray
Boolean mask for protein tokens. Shape:
(num_tokens,)xnp_ndarray
Boolean mask for RNA tokens. Shape:
(num_tokens,)xnp_ndarray
Boolean mask for DNA tokens. Shape:
(num_tokens,)xnp_ndarray
Boolean mask for ligand tokens. Shape:
(num_tokens,)xnp_ndarray
Boolean mask for non-standard polymer chains. Shape:
(num_tokens,)xnp_ndarray
Boolean mask for water molecules. Shape:
(num_tokens,)Tokenization
tokenizer
Maps flat atom layout to tokens for the Evoformer.atom_layout.AtomLayout
required
Flat atom layout containing all atoms to predict.
chemical_components.Ccd
required
Chemical components dictionary.
int
required
Number of atom slots per token.
bool
required
Whether to use one token per atom for non-standard residues.
str
required
Name for logging (typically mmCIF ID).
- Standard protein residues: 1 token per residue (CA representative atom)
- Standard nucleic residues: 1 token per residue (C1’ representative atom)
- Non-standard polymer residues: 1 token per atom if
flatten_non_standard_residues=True - Ligands: 1 token per atom
Additional Feature Classes
PredictedStructureInfo
Information for working with predicted structures.PolymerLigandBondInfo
Information about polymer-ligand bonds.LigandLigandBondInfo
Information about ligand-ligand bonds.PseudoBetaInfo
Information for extracting pseudo-beta and equivalent atoms.- Protein: CB (or CA for glycine)
- Nucleic acids (purines A/G/DA/DG): C4
- Nucleic acids (pyrimidines C/T/U/DC/DT): C2
- Ligands: First atom
Chains
Chain identification dataclass.Usage Example
Related
- Inference - Model inference and predictions
- Post-processing - Output file generation