Skip to main content

Overview

The folding_input module defines the data structures for AlphaFold 3 inputs, including protein chains, RNA chains, DNA chains, ligands, and templates. It handles JSON serialization/deserialization and mmCIF conversion.

Input Class

Main dataclass representing an AlphaFold 3 prediction input.
str
required
The name of the target structure.
Sequence[ProteinChain | RnaChain | DnaChain | Ligand]
required
List of molecular chains (protein, RNA, DNA, or ligands).
Sequence[int]
required
Random number generator seeds, one for each model execution. Must have at least one seed.
Sequence[tuple[BondAtomId, BondAtomId]] | None
List of bonded atom pairs. Each atom defined by (chain_id, res_id, atom_name). Residue IDs are 1-indexed.
str | None
User-defined chemical component dictionary in CIF format for custom ligands.

Properties

Sequence[ProteinChain]
Filtered list of protein chains only.
Sequence[RnaChain]
Filtered list of RNA chains only.
Sequence[DnaChain]
Filtered list of DNA chains only.
Sequence[Ligand]
Filtered list of ligands only.

Class Methods

from_json

Loads Input from AlphaFold JSON string. Supports both alphafold3 and alphafoldserver dialects.
str
required
JSON string in AlphaFold 3 format.
pathlib.Path | None
Path to JSON file for resolving relative paths.

from_mmcif

Loads Input from mmCIF string. Note: RNG seeds are randomly sampled since mmCIFs don’t store them.
str
required
mmCIF formatted structure string.
chemical_components.Ccd
required
Chemical components dictionary.

from_alphafoldserver_fold_job

Constructs Input from AlphaFoldServer fold job format.

Instance Methods

to_json

Converts Input to AlphaFold JSON string format with proper formatting.

to_structure

Converts Input to a Structure object. Note: RNG seeds are not preserved.

sanitised_name

Returns sanitized name safe for use as filename (replaces spaces, removes special characters).

fill_missing_fields

Fills missing MSA and template fields with default empty values.

ProteinChain Class

Represents a protein chain input.
str
required
Unique protein chain identifier (must be uppercase letter).
str
required
Amino acid sequence (single-letter codes, only letters).
Sequence[tuple[str, int]]
required
Post-translational modifications as list of (modification_type, residue_index). Indices are 1-based.
str | None
Optional textual description of the protein chain.
str | None
Paired A3M-formatted MSA. If None, must be filled by data pipeline. Empty string means custom MSA with no sequences.
str | None
Unpaired A3M-formatted MSA. If None, must be filled by data pipeline. Empty string means custom MSA with no sequences.
Sequence[Template] | None
List of structural templates (max 20). If None, must be filled by data pipeline. Empty list means no templates.

Properties

str
Single-letter sequence taking modifications into account (uses ‘X’ for unknown residues).
Sequence[tuple[str, int]]
Post-translational modifications.
str | None
Paired MSA in A3M format.
str | None
Unpaired MSA in A3M format.
Sequence[Template] | None
Structural templates.

Methods

to_ccd_sequence

Converts to sequence of CCD (Chemical Component Dictionary) codes.

to_dict

Converts ProteinChain to AlphaFold JSON dict.

RnaChain Class

Represents an RNA chain input.
str
required
Unique RNA chain identifier (must be uppercase letter).
str
required
RNA sequence (single-letter codes, only letters).
Sequence[tuple[str, int]]
required
RNA modifications as list of (modification_type, residue_index). Indices are 1-based.
str | None
Optional textual description.
str | None
Unpaired A3M-formatted MSA. If None, must be filled by data pipeline.

Properties

str
Single-letter sequence taking modifications into account (uses ‘N’ for unknown residues).
Sequence[tuple[str, int]]
RNA modifications.
str | None
Unpaired MSA in A3M format.

DnaChain Class

Represents a single-strand DNA chain input.
str
required
Unique DNA chain identifier (must be uppercase letter).
str
required
DNA sequence (single-letter codes, only letters).
Sequence[tuple[str, int]]
required
DNA modifications as list of (modification_type, residue_index). Indices are 1-based.
str | None
Optional textual description.

Properties

str
Single-letter sequence taking modifications into account (uses ‘N’ for unknown residues).

Ligand Class

Represents a ligand (small molecule) input.
str
required
Unique ligand “chain” identifier.
Sequence[str] | None
Chemical Component Dictionary IDs. Either ccd_ids or smiles must be set (not both).
str | None
SMILES representation of ligand. Either ccd_ids or smiles must be set (not both).
str | None
Optional textual description.

Template Class

Represents a structural template for protein chains.
str
required
Structural template in mmCIF format (should have only one protein chain).
Mapping[int, int]
required
Mapping from query residue index to template residue index.

Properties

str
mmCIF string of the template structure.
Mapping[int, int]
Query-to-template residue mapping.

Usage Examples

Creating a Simple Protein Input

Creating a Complex with Ligand

Loading from JSON

Saving to JSON

JSON Format

AlphaFold 3 JSON Dialect

Constants

Type Aliases

See Also