$npx -y skills add ai4protein/VenusFactory2 --skill alphafold_databaseAccess AlphaFold 200M+ AI-predicted protein structures. Retrieve structures by UniProt ID, download PDB/mmCIF files, analyze confidence metrics (pLDDT, PAE), for drug discovery and structural biology.
| 1 | # AlphaFold Database |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | AlphaFold DB is a public repository of AI-predicted 3D protein structures for over 200 million proteins, maintained by DeepMind and EMBL-EBI. Access structure predictions with confidence metrics, download coordinate files, retrieve bulk datasets, and integrate predictions into computational workflows. |
| 6 | |
| 7 | ## Project Tools (VenusFactory2) |
| 8 | |
| 9 | **The following agent tools are exposed** for AlphaFold in this codebase. Query tools that would return structure/metadata text into the conversation are **not** exposed, because they would put large PDB/mmCIF or JSON payloads into the context and cause context explosion. Use the download tools instead: they write to disk and return only `{success, file_path}` in JSON. The two `analyze_*` tools then read those local files and emit a small structured report — keeping the analysis off the wire. |
| 10 | |
| 11 | | Tool | Args | Returns | Description | |
| 12 | |------|------|---------|--------------| |
| 13 | | **download_alphafold_structure_by_uniprot_id** | `uniprot_id` (required), `out_dir` (required), `format` (default `"pdb"`, choices `pdb` \| `cif`), `version` (default `"v6"`, choices `v1` \| `v2` \| `v4` \| `v6`), `fragment` (default `1`, ≥1) | JSON: `{success: bool, file_path: str \| null}` | Download AlphaFold structure (PDB or mmCIF) to `out_dir`. `file_path` is the path to the downloaded file. | |
| 14 | | **download_alphafold_metadata_by_uniprot_id** | `uniprot_id` (required), `out_dir` (required) | JSON: `{success: bool, file_path: str \| null}` | Download AlphaFold prediction metadata (JSON) to `out_dir`. `file_path` is the path to the saved metadata file. | |
| 15 | | **analyze_alphafold_plddt_by_metadata_file** | `metadata_path` (required, path to a downloaded AlphaFold metadata JSON) | JSON: `{status, content, biological_metadata {uniprot_id, global_plddt, fractions {very_low, low, confident, very_high}, conclusion}}` | Parse pLDDT fractions and emit a human-readable confidence verdict. Pure local analysis (no network). | |
| 16 | | **analyze_alphafold_pae_by_pae_file** | `pae_path` (required, path to a downloaded PAE JSON file), `distance_cutoff` (default `7.0`), `min_domain_size` (default `40`) | JSON: `{status, content, biological_metadata {matrix_shape, mean_pae, max_pae, min_pae, confident_pairs_pct, domains [{start, end, length}], conclusion}}` | Walk the PAE matrix to detect rigid sub-domains, merge into global domains, report boundaries and aggregate stats. Pure local analysis. | |
| 17 | |
| 18 | - Always call with a valid `out_dir`; the download tools create the directory if needed. |
| 19 | - The analyze tools require a previously downloaded file path; chain them after the corresponding download tool. |
| 20 | - Structure URLs follow: `https://alphafold.ebi.ac.uk/files/{entry_id}-model_{version}.{pdb|cif}` with `entry_id` = `AF-{uniprot_id}-F{fragment}`. PAE JSON URL: `…/{entry_id}-predicted_aligned_error_{version}.json`. See `references/api_reference.md` for full API details. |
| 21 | |
| 22 | ## When to Use This Skill |
| 23 | |
| 24 | This skill should be used when working with AI-predicted protein structures in scenarios such as: |
| 25 | |
| 26 | - Retrieving protein structure predictions by UniProt ID or protein name |
| 27 | - Downloading PDB/mmCIF coordinate files for structural analysis |
| 28 | - Analyzing prediction confidence metrics (pLDDT, PAE) to assess reliability |
| 29 | - Accessing bulk proteome datasets via Google Cloud Platform |
| 30 | - Comparing predicted structures with experimental data |
| 31 | - Performing structure-based drug discovery or protein engineering |
| 32 | - Building structural models for proteins lacking experimental structures |
| 33 | - Integrating AlphaFold predictions into computational pipelines |
| 34 | |
| 35 | ## Core Capabilities |
| 36 | |
| 37 | ### 1. Searching and Retrieving Predictions |
| 38 | |
| 39 | **Using Biopython (Recommended):** |
| 40 | |
| 41 | The Biopython library provides the simplest interface for retrieving AlphaFold structures: |
| 42 | |
| 43 | ```python |
| 44 | from Bio.PDB import alphafold_db |
| 45 | |
| 46 | # Get all predictions for a UniProt accession |
| 47 | predictions = list(alphafold_db.get_predictions("P00520")) |
| 48 | |
| 49 | # Download structure file (mmCIF format) |
| 50 | for prediction in predictions: |
| 51 | cif_file = alphafold_db.download_cif_for(prediction, directory="./structures") |
| 52 | print(f"Downloaded: {cif_file}") |
| 53 | |
| 54 | # Get Structure objects directly |
| 55 | from Bio.PDB import MMCIFParser |
| 56 | structures = list(alphafold_db.get_structural_models_for("P00520")) |
| 57 | ``` |
| 58 | |
| 59 | **Direct API Access:** |
| 60 | |
| 61 | Query predictions using REST endpoints: |
| 62 | |
| 63 | ```python |
| 64 | import requests |
| 65 | |
| 66 | # Get prediction metadata for a UniProt accession |
| 67 | uniprot_id = "P00520" |
| 68 | api_url = f"https://alphafold.ebi.ac.uk/api/prediction/{uniprot_id}" |
| 69 | response = requests.get(api_url) |
| 70 | prediction_data = response.json() |
| 71 | |
| 72 | # Extract AlphaFold ID |
| 73 | alphafold_id = prediction_data[0]['entryId'] |
| 74 | print(f"AlphaFold ID: {alphafold_id}") |
| 75 | ``` |
| 76 | |
| 77 | **Using Uni |