Overview
Thepipeline.py module runs MSA (Multiple Sequence Alignment) generation and template search tools for AlphaFold 3. It processes protein and RNA chains to generate evolutionary information and structural templates needed for structure prediction.
DataPipeline Class
Main class that orchestrates MSA generation and template search.DataPipelineConfig
required
Configuration specifying database paths, binary paths, and search parameters.
Methods
process
Main method to process a fold input through the data pipeline.folding_input.Input
required
Input containing chains to process. MSA and template fields should be None or empty.
folding_input.Input
New Input with MSAs and templates populated for all chains.
- Protein chains: Runs Jackhmmer for MSA, Hmmsearch for templates
- RNA chains: Runs Nhmmer for MSA
- DNA chains: No processing (passed through)
- Ligands: No processing (passed through)
process_protein_chain
folding_input.ProteinChain
required
Protein chain to process.
folding_input.ProteinChain
Protein chain with populated
unpaired_msa, paired_msa, and templates fields.- UniRef90: 10,000 sequences max, e-value 1e-4
- Mgnify: 5,000 sequences max, e-value 1e-4
- Small BFD: 5,000 sequences max, e-value 1e-4
- UniProt (paired): 50,000 sequences max, e-value 1e-4
- Searches PDB using Hmmsearch with e-value 100
- Filters to max 4 templates by date and quality
- Returns templates with structures and alignments
process_rna_chain
folding_input.RnaChain
required
RNA chain to process.
folding_input.RnaChain
RNA chain with populated
unpaired_msa field.- NT-RNA: 10,000 sequences max, e-value 1e-3
- Rfam: 10,000 sequences max, e-value 1e-3
- RNAcentral: 10,000 sequences max, e-value 1e-3
DataPipelineConfig
Configuration dataclass specifying all pipeline settings.Binary Paths
str
required
Path to Jackhmmer binary for protein MSA search.
str
required
Path to Nhmmer binary for RNA MSA search.
str
required
Path to Hmmalign binary for aligning hits to query profile.
str
required
Path to Hmmsearch binary for template search.
str
required
Path to Hmmbuild binary for building HMM profiles.
Database Paths
str
required
Small BFD database path for protein MSA search.
str
required
Mgnify database path for protein MSA search.
str
required
UniProt database path for protein paired MSA search.
str
required
UniRef90 database path for MSA and template profile construction.
str
required
NT-RNA database path for RNA MSA search.
str
required
Rfam database path for RNA MSA search.
str
required
RNAcentral database path for RNA MSA search.
str
required
PDB sequence database path for template search.
str
required
PDB mmCIF files directory for template structures.
Z-values
Z-values represent database sizes for E-value calculation and must be set for sharded databases.int | None
Database size in number of sequences for Small BFD.
int | None
Database size in number of sequences for Mgnify.
int | None
Database size in number of sequences for UniProt.
int | None
Database size in number of sequences for UniRef90.
int | None
Database size in megabases for NT-RNA.
int | None
Database size in megabases for Rfam.
int | None
Database size in megabases for RNAcentral.
CPU Configuration
int
default:"8"
Number of CPUs for Jackhmmer. Going above 8 provides diminishing returns.
int | None
Maximum parallel shards for Jackhmmer. If None, one instance per shard.
int
default:"8"
Number of CPUs for Nhmmer. Going above 8 provides diminishing returns.
int | None
Maximum parallel shards for Nhmmer. If None, one instance per shard.
Template Configuration
datetime.date
required
Latest allowed template release date. Templates after this date are filtered out.
Internal Functions
_get_protein_msa_and_templates
Cached function to avoid re-running MSA tools for identical sequences in homomers._get_protein_templates
Cached function for template search only._get_rna_msa
Cached function for RNA MSA generation.Usage Examples
Basic Pipeline Usage
Processing Individual Chains
Custom MSA (Skip Pipeline)
Multi-Chain Complex
Sharded Database Configuration
MSA Format
MSAs are returned in A3M format:- First sequence is query (uppercase, no gaps)
- Subsequent sequences are hits (lowercase = insertion,
-= deletion) - Headers include sequence ID and alignment range
Template Format
Templates are returned asfolding_input.Template objects:
Performance Considerations
Caching
Functions are decorated with@functools.cache to avoid redundant searches:
- Identical sequences in homomers are processed only once
- Cache is per-Python-process (not persistent across runs)
Parallelization
MSA tools run in parallel usingThreadPoolExecutor:
- 4 protein databases searched simultaneously
- 3 RNA databases searched simultaneously
- Template search can run concurrently with MSA
Timing
Typical processing times (8 CPUs):- Protein MSA: 5-30 minutes depending on databases
- RNA MSA: 3-15 minutes depending on databases
- Template search: 1-5 minutes
- Total for protein: 10-35 minutes
Database Sizes
Recommended database sizes (2021-2022 versions):- Small BFD: ~138M sequences, ~2.5 TB
- Mgnify: ~125M sequences, ~120 GB
- UniRef90: ~103M sequences, ~35 GB
- UniProt: ~224M sequences, ~80 GB
- NT-RNA: ~47 MB
- Rfam: ~13 MB
- RNAcentral: ~42 MB
See Also
- run_alphafold.py - Main prediction script
- Input Dataclass - Input format
- Model Class - Model inference