agentleFS
naitynaity/FM4Life/skills/alphafold/SKILL.md

alphafold

Skill2 starsChanged 8 months agoMITView on GitHub

Skill for protein structure prediction and analysis with AlphaFold. Use this skill whenever a user wants to predict or fetch a protein 3D structure, download structures from the AlphaFold Database (AFDB), run ColabFold for novel proteins, parse pLDDT confidence scores or PAE (predicted aligned error) from AlphaFold outputs, predict structures of protein complexes or multimers, or work with AlphaFold3 for proteins with DNA/RNA/small molecules. Also trigger when the user mentions AlphaFold, AF2, AF3, AFDB, ColabFold, pLDDT, PAE, predicted aligned error, protein folding, or structure prediction from sequence.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. adaptyvbio/protein-design-skills★ 163same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository14 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Only needed when running at scale, on an HPC, or when reproducibility with official AF2 matters.

    line 154
  2. Distinctive:

    All AlphaFold variants produce the same core outputs:

    line 204
  3. Distinctive:

    Use ESMFold when you need fast, large-scale folding with no MSA.

    line 245

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AlphaFold: Protein Structure Prediction

Overview

AlphaFold is DeepMind's protein structure prediction system. Most users don't need to install AlphaFold locally — there are faster, lighter alternatives that cover the majority of use cases:

NeedBest approach
Known UniProt proteinAFDB API — fetch precomputed structure instantly
Novel protein sequenceColabFold — no local databases needed
Novel protein, batch/HPCLocal AF2 (Docker) — full pipeline
Protein + DNA/RNA/ligandAlphaFold3 (web server or local)
Fast, no MSAESMFold (see skills/esm2)

Approach 1: AlphaFold Database (AFDB) API

The AFDB covers >200 million proteins from UniRef90 with precomputed structures. If your protein has a UniProt accession, fetch it in seconds — no GPU, no installation.

import requests

def fetch_afdb_structure(uniprot_id: str, output_dir: str = ".") -> dict:
    """
    Fetch AlphaFold structure for a UniProt ID.
    Returns metadata dict with paths to downloaded files.
    """
    from pathlib import Path

    # Get prediction metadata
    url = f"https://alphafold.ebi.ac.uk/api/prediction/{uniprot_id}"
    response = requests.get(url)
    response.raise_for_status()
    prediction = response.json()[0]  # list with one entry

    out_dir = Path(output_dir)
    out_dir.mkdir(parents=True, exist_ok=True)
    downloaded = {}

    # Download PDB
    pdb_url = prediction["pdbUrl"]
    pdb_path = out_dir / f"{uniprot_id}.pdb"
    pdb_path.write_bytes(requests.get(pdb_url).content)
    downloaded["pdb"] = str(pdb_path)

    # Download PAE JSON (pairwise confidence)
    if pae_url := prediction.get("paeDocUrl"):
        pae_path = out_dir / f"{uniprot_id}_pae.json"
        pae_path.write_bytes(requests.get(pae_url).content)
        downloaded["pae"] = str(pae_path)

    print(f"Downloaded {uniprot_id}: {pdb_path}")
    print(f"  pLDDT (mean): {prediction.get('globalMetricValue', 'N/A'):.1f}")
    print(f"  Model: {prediction.get('modelCreatedDate', 'N/A')}")
    return downloaded

# Example
files = fetch_afdb_structure("P00533")  # EGFR

See scripts/fetch_afdb.py for a CLI to batch-fetch many proteins.

Find a UniProt ID by gene/protein name

def find_uniprot_id(query: str, organism: str = "human") -> list[dict]:
    """Search UniProt by gene name or protein name."""
    url = "https://rest.uniprot.org/uniprotkb/search"
    params = {
        "query": f"{query} AND organism_name:{organism}",
        "format": "json",
        "fields": "accession,protein_name,gene_names,length",
        "size": 5,
    }
    r = requests.get(url, params=params)
    r.raise_for_status()
    results = r.json()["results"]
    return [
        {
            "uniprot_id": e["primaryAccession"],
            "name": e.get("proteinDescription", {}).get("recommendedName", {}).get("fullName", {}).get("value", ""),
            "gene": e.get("genes", [{}])[0].get("geneName", {}).get("value", ""),
            "length": e.get("sequence", {}).get("length", 0),
        }
        for e in results
    ]

hits = find_uniprot_id("EGFR", organism="human")
for h in hits:
    print(h)

Approach 2: ColabFold (Novel Proteins)

ColabFold uses MMseqs2 for fast MSA generation (no local databases needed) and runs AlphaFold2 on top. It's the practical choice for novel proteins not in the AFDB.

Installation

pip install colabfold[alphafold-without-jax]
# Then install JAX with GPU support:
pip install "jax[cuda12]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

Or use LocalColabFold for a fully self-contained install:

# See: https://github.com/YoshitakaMo/localcolabfold

Running ColabFold

# Single sequence / batch
colabfold_batch input.fasta output_dir/

# With templates (more accurate, slower)
colabfold_batch input.fasta output_dir/ --templates

# Multimer (protein complex)
colabfold_batch complex.fasta output_dir/ --model-type alphafold2_multimer_v3

# Fewer recycles for speed (default 3)
colabfold_batch input.fasta output_dir/ --num-recycle 1

Input FASTA for a monomer:

>protein_name
MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGD...

Input FASTA for a complex (chain break with : in sequence or multiple entries):

>chainA
MKTAYIAKQRQISFVK
>chainB
AGLIVHSPQWFYK

ColabFold outputs the same file format as AlphaFold2 (see Output Formats below).

Approach 3: Local AlphaFold2 (Docker)

Only needed when running at scale, on an HPC, or when reproducibility with official AF2 matters. Requires:

  • Linux (macOS/Windows not supported)
  • NVIDIA GPU (A100 recommended)
  • ~2.62 TB disk for databases (SSD preferred)
# Clone and build
git clone https://github.com/google-deepmind/alphafold.git && cd alphafold
docker build -f docker/Dockerfile -t alphafold .

# Download databases (~556 GB download, ~2.62 TB unzipped)
scripts/download_all_data.sh /data/alphafold

# Run a monomer
python3 docker/run_docker.py \
  --fasta_paths=protein.fasta \
  --max_template_date=2022-01-01 \
  --model_preset=monomer \
  --data_dir=/data/alphafold \
  --output_dir=/results/

# Run a multimer (protein complex)
python3 docker/run_docker.py \
  --fasta_paths=complex.fasta \
  --model_preset=multimer \
  --data_dir=/data/alphafold \
  --output_dir=/results/

Model presets:

  • monomer — single chain, CASP14 model (recommended default)
  • monomer_ptm — adds pTM and PAE outputs
  • multimer — protein complexes (runs 25 predictions: 5 models × 5 seeds)

Database presets:

  • full_dbs — full accuracy (default)
  • reduced_dbs — faster, needs only ~600 GB, still good quality

AlphaFold3

AlphaFold3 handles proteins, DNA, RNA, small molecules, and ions in a single unified model. Released May 2024.

AF3 is the right choice when your system contains ligands, nucleic acids, or post-translational modifications.

Output Formats

All AlphaFold variants produce the same core outputs:

output_dir/
├── ranked_0.pdb          ← best structure (highest mean pLDDT)
├── ranked_1.pdb          ← second best, etc.
├── relaxed_model_1.pdb   ← after Amber energy minimization
├── unrelaxed_model_1.pdb ← raw model output
├── result_model_1.pkl    ← raw numpy arrays (pLDDT, PAE, distogram)
├── ranking_debug.json    ← pLDDT scores for each model
└── timings.json

pLDDT (0–100) is stored in the B-factor column of PDB files. Higher = more confident. Thresholds:

  • 90–100: very high confidence (dark blue in AF2 coloring)
  • 70–90: confident (light blue)
  • 50–70: low confidence (yellow)
  • < 50: very low confidence, likely disordered (orange/red)

See references/outputs.md for parsing pLDDT and PAE programmatically.

Scripts

# Fetch one or many proteins from AFDB by UniProt ID
python scripts/fetch_afdb.py P00533 P38398 Q9Y6K9 --output-dir structures/

# Fetch from a text file of UniProt IDs (one per line)
python scripts/fetch_afdb.py --from-file uniprot_ids.txt --output-dir structures/

Choosing Between AlphaFold and ESMFold

AlphaFold2 (via AFDB/ColabFold)ESMFold
AccuracyHigher (uses MSA)Lower but still good
SpeedSlower (MSA generation)Seconds per protein
DependenciesMMseqs2 (ColabFold) or AFDBHuggingFace transformers
Precomputed DBYes (AFDB)No
Ligand/DNA/RNANo (AF3 only)No

Use ESMFold when you need fast, large-scale folding with no MSA. Use AlphaFold when accuracy matters or the structure is in the AFDB.

Resources

References

  • references/outputs.md — parsing pLDDT, PAE, distogram from PDB and pickle outputs; confidence interpretation
  • references/colabfold.md — ColabFold installation options, MSA customization, advanced run options

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.