AlphaFill Tutorial: Add Cofactors to an AlphaFold Model
Skip to content

AlphaFill Tutorial: Add Ligands and Cofactors to AlphaFold

AlphaFill Tutorial: Add Ligands and Cofactors to AlphaFold

AlphaFill is a free web resource (alphafill.eu) that adds the ligands, cofactors and metal ions an AlphaFold model lacks. It finds homologous experimental structures in PDB-REDO, superposes them, and “transplants” compounds such as heme, NAD, FAD and Zn2+ into the model. Each transplant comes with a global RMSd, a local RMSd and a clash score, so you can decide which ones to trust.

This guide is written by the StemSkills Lab team, who have spent more than ten years in structural bioinformatics, drug design and molecular modelling. It follows the AlphaFill paper by Hekkelman, de Vries, Joosten and Perrakis (Nature Methods 20, 205-213, 2023) and the official AlphaFill API manual, and every number below comes from one of those or from a live AlphaFill entry we downloaded while writing.

Why does an AlphaFold model need AlphaFill at all?

AlphaFold predicts protein atoms only. The AlphaFill authors put the gap plainly: models in the AlphaFold database “all lack coordinates for small molecules” (Hekkelman et al., 2023). Their examples are the ones students meet first: hemoglobin without its heme, zinc fingers without zinc, metalloproteases without their catalytic metal, and kinases with no ADP or ATP.

That matters the moment you move past looking at the model. If you dock a ligand into an AlphaFold model of a heme enzyme, the docking engine sees an empty cavity where the heme should be, and your ligand will happily sit in the heme site. If you run molecular dynamics on an AlphaFold model of a zinc finger, the site that the zinc should hold together is simulated as an apo shell. AlphaFill puts the missing piece back so the next step starts from a more realistic complex.

How does AlphaFill decide where a cofactor goes?

The method is homology transfer, not prediction. For each AlphaFold model, AlphaFill searches the PDB-REDO databank (re-refined PDB entries) for sequence homologs. The paper counts a structure as a hit when it shares more than 25% identity over at least 85 aligned residues. For each hit it then:

  1. Superposes the homolog on the AlphaFold model using Cα atoms and records the global RMSd, a measure of how similar the two whole chains are.
  2. Selects all backbone atoms within 6 Å of each candidate compound, superposes only that local environment, and records the local RMSd, a measure of how similar the binding site is.
  3. Copies the compound into the model, unless the same compound was already placed within 3.5 Å of that position from an earlier, closer homolog.
  4. Computes the transplant clash score (TCS): the root-mean-square van der Waals overlap between the transplant and protein atoms closer than 4 Å.

The result is an mmCIF model plus a JSON metadata file that records where every transplant came from. The scale is large: the first release performed 12,029,789 transplants into 995,411 AlphaFold models (Hekkelman et al., 2023).

How do I find an AlphaFill model for my protein?

If your protein is in the AlphaFold Protein Structure Database, the AlphaFill entry probably already exists. The AlphaFill identifier is the UniProt accession, the same one AlphaFold uses.

  1. Open alphafill.eu and type the UniProt ID into Show an entry based on Uniprot ID. Our worked example is human myoglobin, P02144, which the paper itself uses.
  2. The entry page shows the model in the Mol* viewer next to a table of transplants: the donor PDB-REDO entry, its global RMSd, the compound, the local RMSd and the TCS.
  3. Use the identity selector above the table. By default the page shows only transplants from donors above 70% identity when such donors exist, and drops to 25% when the closest homolog is more distant. A blank table means no experimental structure above 25% identity was found.
  4. Tick and untick individual transplants to see each one on the structure.

The same data is available from the command line, which is faster when you need several proteins or want a record for your lab notebook:

# full AlphaFill model (mmCIF, every transplant included)
curl -o AF-P02144-alphafill.cif https://alphafill.eu/v1/aff/P02144

# transplant metadata (JSON: donor, identity, RMSd values, clash score)
curl -o P02144.json https://alphafill.eu/v1/aff/P02144/json

Both endpoints are listed on the AlphaFill download page, which also gives an rsync command for mirroring the whole databank.

What if my model is not in the AlphaFold database?

Use Create your own AlphaFill model on the front page and upload your structure file. The API manual describes the same service as a POST to https://alphafill.eu/v1/aff with a structure parameter (the AlphaFold file you want to process) and an optional pae parameter for the PAE matrix, and a GET on /v1/aff/{id}/status to check progress. This route suits ColabFold or AlphaFold Server models of your own construct. The site does not publish upload size limits or queue times, so start with one structure and confirm it returns before submitting a batch.

Want the guided, hands-on version?

Our live Molecular Modeling & MD Simulations cohort bootcamp takes you from zero to running real docking and MD workflows, with a portfolio project for your grad-school applications.

Join the waitlist (free) →

How do I read global RMSd, local RMSd and TCS?

Treat the three numbers as three different questions:

  • Global RMSd: is the donor protein the same overall fold? A high value with a low local RMSd can still give a good transplant, because only the pocket needs to match.
  • Local RMSd: is the binding site arranged the same way? This is the number the paper validated. Against experimental structures with 100% identity, local RMSd correlated with the real error of the transplanted environment (Pearson 0.51).
  • TCS: does the transplant bump into the model? A high TCS means overlapping atoms, either because the pocket in the AlphaFold model is slightly closed or because the donor carried a different conformation.

The paper derived confidence labels from outlier statistics (third quartile plus 1.5 times the interquartile range):

MetricMedium confidence aboveLow confidence aboveShare of transplants rated high confidence
Local RMSd0.92 Å3.10 Å65.3% (24.9% medium, 9.9% low)
TCS0.64 Å1.27 Å81.3% (18.6% medium, 0.05% low)

A practical rule: prefer the transplant with the highest donor identity and the lowest local RMSd, then check its TCS. To rank everything in the JSON at once, this short script prints compound, model chain (asym ID), donor, identity, global RMSd, local RMSd and TCS:

import json

d = json.load(open("P02144.json"))
for hit in d["hits"]:
    for t in hit["transplants"]:
        print(t["compound_id"], t["asym_id"], hit["pdb_id"],
              round(hit["alignment"]["identity"] * 100, 1),
              round(hit["global_rmsd"], 2), round(t["local_rmsd"], 2),
              round(t["clash"]["score"], 2))

For myoglobin (AlphaFill version 2.1.1 metadata) the top line is HEM B 3RGK 98.7 0.49 0.24 0.12: the heme comes from PDB-REDO entry 3RGK (a K45R mutant of human myoglobin, solved at 1.65 Å) at 98.7% identity, with a global RMSd of 0.49 Å, a local RMSd of 0.24 Å and a TCS of 0.12 Å. All three sit well inside the high-confidence range.

PDB 3RGK: myoglobin (1 chain, A) with heme (ligand code HEM), ligand code SO4 and 100 crystallographic water molecules, at 1.65 Å resolution.
PDB 3RGK: myoglobin (1 chain, A) with heme (ligand code HEM), ligand code SO4 and 100 crystallographic water molecules, at 1.65 Å resolution. Source: RCSB PDB entry 3RGK.

Should I keep every transplanted compound?

No. AlphaFill copies whatever the donors contain, and crystal structures are full of soaks, ligands from different experiments and crystallisation additives. The myoglobin entry illustrates this well. Its metadata lists 35 donor hits, and the transplants include one heme but also nitrite (12 times), zinc (6), cobalt (5), carbon monoxide, oxygen and polyethylene glycol fragments. Most of those came from ligand-soaking or crystallisation conditions, not from the biology you want to model.

Keep the compound your question depends on and drop the rest. The API returns a model containing only the transplants you name, by their asym ID:

# AlphaFold model plus only the heme (asym ID B in the metadata)
curl -o P02144-heme.cif https://alphafill.eu/v1/aff/P02144/stripped/B

We checked this file: it contains the protein and 43 HETATM records, all HEM, which is the heavy-atom count of heme B. The API manual also documents /stripped/{asymlist}/{identity} to apply an identity cutoff, and an /optimized/{asymlist} route. On the website, selecting a single transplant offers an “optimise” button that runs a short YASARA energy minimisation of that compound and its environment and then shows the TCS before and after. In the paper’s retinal example, optimisation brought a medium-confidence TCS down to 0.29 Å.

If you prefer to clean up locally, open the full AlphaFill model in PyMOL and remove unwanted compounds by residue name, for example remove resn NO2+PEO+CMO, then save filled_clean.pdb. Our guide on extracting a ligand from a PDB file covers the selection syntax.

How does AlphaFill compare with other ways to add a cofactor?

ApproachInputWhat you getConfidence signalEffortMethods-section wording
AlphaFillUniProt ID or your own modelAll transplantable compounds from homologs, with provenanceGlobal RMSd, local RMSd, TCS per transplantMinutes“Cofactor X was transplanted with AlphaFill from PDB-REDO entry Y (Z% identity, local RMSd W Å).”
Manual superposition in PyMOL or ChimeraXYour model plus one chosen PDB entryExactly the compound you pickThe alignment RMSd you compute yourselfLonger, one structure at a time“Heme was placed by superposition of PDB entry Y onto the model.”
AlphaFold 3 / AlphaFold Server with ligandsSequence plus ligand or ion choiceA co-folded complex predicted with the ligand presentpLDDT, PAE and ipTM of the joint predictionMinutes; non-commercial terms apply“The complex was predicted with AlphaFold 3 including cofactor X.”
Docking the cofactor yourselfModel plus prepared cofactorA predicted pose ranked by a scoring functionDocking score onlyHighest; metals are hard to dockRarely acceptable for a cofactor with known crystal geometry

For a cofactor that has been seen in close homologs, AlphaFill or manual superposition is the defensible choice, because the position comes from experimental density rather than a score. Our PyMOL superposition guide covers the manual route.

How do I check the filled model before docking or MD?

  1. Check pLDDT around the pocket. A perfect transplant into a low-confidence loop is still a guess. Read our explainer on AlphaFold pLDDT and PAE scores and look at the residues lining the cofactor.
  2. Look at coordination, not only position. The authors warn that metal sites need care: in their zinc examples, zinc-ligand distances deviate from established target values, so the model gives “qualitative information” about where the ion sits but not exact geometry.
  3. Check for clashes. Use the TCS and, if it is above 0.64 Å, run the website’s optimise step or a short restrained minimisation of your own.
  4. Confirm the chemistry. AlphaFill handles non-polymer compounds only. Peptides, nucleic acids, sugars, glycosylation and phosphorylation are not transplanted.

How do I carry the filled model into Vina or GROMACS?

For docking, keep the cofactor as part of the receptor, not as the ligand. Convert the cleaned model to PDB if your preparation tool does not read mmCIF, then prepare the receptor as usual; our Meeko receptor preparation guide and protein-ligand preparation guide show the steps. Open the receptor PDBQT afterwards and confirm the heme or metal is still there, because a silently dropped HETATM is the most common reason a “filled” docking run behaves like the apo one.

For MD, the cofactor needs force-field parameters. Heme, NAD and FAD are covered in our GROMACS cofactor simulation guide, and zinc, magnesium and other ions in our guide to metal ions in docking and MD.

What errors will I hit, and how do I fix them?

  • The transplant table is empty. No experimental structure above 25% identity over 85 residues exists. Use AlphaFold 3 with the cofactor, or a carefully justified manual placement, and say so in your methods.
  • The cofactor sits in a low-pLDDT region. The pocket itself is uncertain. Report it as a hypothesis, compare with a second donor, and avoid quantitative claims such as binding energies.
  • High local RMSd (above 0.92 Å, or above 3.10 Å). The donor pocket is arranged differently. Switch to a donor with higher identity using the identity selector, or discard the transplant.
  • Two copies of the same ligand, or soaks you did not ask for. These come from different donors. Use /stripped/{asymlist} or remove resn in PyMOL to keep one copy.
  • A PDB-only tool rejects the file. AlphaFill writes mmCIF. Open it in PyMOL and save as PDB, or use Open Babel as shown in our file format conversion guide.
  • The metal disappears after receptor preparation, or pdb2gmx stops with an unknown residue. The preparation tool or force field does not recognise it. Check the PDBQT for the ion, and add parameters for the cofactor as described in the cofactor and metal-ion guides linked above.

Where does this fit in the computational biology workflow?

AlphaFill sits between predicting a structure with AlphaFold and every downstream step that assumes a realistic binding site. In our computational biology skills roadmap it is part of structure preparation, the stage that decides if your docking and MD results mean anything.

Frequently asked questions

Is AlphaFill free to use?

Yes. The website, the REST API and the rsync mirror of the databank are openly available at alphafill.eu, built by Hekkelman, de Vries, Joosten and Perrakis.

Does AlphaFill predict new binding sites?

No. It only transfers compounds that were seen in experimental structures of homologous proteins. If no homolog with a bound cofactor exists, AlphaFill has nothing to transplant.

Can AlphaFill add my drug candidate to the model?

Only if that exact compound is bound in a homolog in PDB-REDO. For a new molecule, fill the cofactors first with AlphaFill and then dock your candidate into the filled model.

Which number matters most when judging a transplant?

Local RMSd, because it measures the binding site directly and was validated against experimental structures. Use TCS second to catch clashes, and global RMSd as context.

How should I cite AlphaFill in a thesis or paper?

Cite Hekkelman ML, de Vries I, Joosten RP, Perrakis A. AlphaFill: enriching AlphaFold models with ligands and cofactors. Nature Methods 20, 205-213 (2023), and state the donor PDB-REDO entry and identity for each transplant you kept.

Want the guided, hands-on version?

Our live Molecular Modeling & MD Simulations cohort bootcamp takes you from zero to running real docking and MD workflows, with a portfolio project for your grad-school applications.

Join the waitlist (free) →

Think you know Protein Structure Prediction?
Take the free StemSkills assessment and earn a verifiable certificate you can download and add to your LinkedIn profile.
Start the free assessment

Keep going

ColabFold Settings Explained: Recycles, MSA Mode, Relax Learn what every ColabFold AlphaFold2 notebook option changes, which defaults to keep, and which files to take into… AlphaFold Model to GROMACS: Prepare a Prediction for MD Read pLDDT, trim weak termini, check cofactors and histidines, then run pdb2gmx on an AlphaFold model. Follow the… Steered MD in GROMACS: Pull a Ligand Out, Read the Force Set up a GROMACS pull-code run, pull a ligand out of its pocket, plot pullf.xvg against pullx.xvg and…
See live workshops