$npx -y skills add ai4protein/VenusFactory2 --skill rcsb_databaseRCSB Protein Data Bank (PDB) — experimentally determined 3D biomolecular structures. Search by full-text/sequence/structure/attribute, fetch entry metadata, download coordinate files (PDB/mmCIF). Use when the user provides a PDB ID, asks for structures of a protein, wants to find
| 1 | # RCSB Protein Data Bank |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | The RCSB PDB hosts >200K experimentally-determined biomolecular structures (X-ray, cryo-EM, NMR, etc.). This skill exposes 3 download tools and 1 search tool. |
| 6 | |
| 7 | ## Project Tools (VenusFactory2) |
| 8 | |
| 9 | | Tool | Args | Returns | Description | |
| 10 | |------|------|---------|--------------| |
| 11 | | **download_rcsb_search_by_query** | `query` (JSON string or dict — Search API v2 query block or full payload), `out_dir` (required), `return_type` (default `"entry"`; `entry` \| `assembly` \| `polymer_entity` \| `non_polymer_entity` \| `polymer_instance` \| `mol_definition`), `page_start`/`rows` (pagination; default = return all hits), `sort_by` (e.g. `score`, `rcsb_accession_info.initial_release_date`), `sort_direction` (`asc` \| `desc`), `count_only` (skip results, return only `total_count`), `timeout` (default `60`s) | JSON: `{status, file_info {file_path → rcsb_search_<return_type>.json}, content_preview (first 25 ids), biological_metadata {return_type, total_count, result_count, page_start, rows, sort_by, search_time_ms}}` | Run an RCSB Search API v2 query (text / sequence / structure / attribute). | |
| 12 | | **download_rcsb_entry_metadata_by_pdb_id** | `pdb_id` (required, e.g. `4HHB`), `out_path` (required, JSON path) | rich JSON envelope; saves metadata JSON to `out_path` | Fetch full entry metadata for one PDB ID. | |
| 13 | | **download_rcsb_structure_by_pdb_id** | `pdb_id` (required), `out_dir` (required), `file_type` (default `pdb`; `pdb` \| `cif` \| `xml`) | rich JSON envelope; structure file at `file_info.file_path` | Download coordinate file. | |
| 14 | |
| 15 | ## When to Use This Skill |
| 16 | |
| 17 | - User provides a PDB ID and asks for the structure / metadata |
| 18 | - "Find structures of X" / "find structures similar to this sequence" → `download_rcsb_search_by_query` with the right `service` |
| 19 | - Build a workflow that pipes RCSB structures into PyMOL (`render_protein_structure`) or Foldseek |
| 20 | |
| 21 | ## Search API v2 Query Cookbook |
| 22 | |
| 23 | Pass `query` as a dict / JSON-string of a *query block* (auto-wrapped into `{"query": ...}`) or a full request payload. |
| 24 | |
| 25 | **Full-text:** |
| 26 | ```python |
| 27 | {"type": "terminal", "service": "full_text", "parameters": {"value": "hemoglobin"}} |
| 28 | ``` |
| 29 | |
| 30 | **By sequence (BLAST-like, fast, e-value cutoff):** |
| 31 | ```python |
| 32 | { |
| 33 | "type": "terminal", "service": "sequence", |
| 34 | "parameters": { |
| 35 | "evalue_cutoff": 0.1, "identity_cutoff": 0.95, |
| 36 | "sequence_type": "protein", |
| 37 | "value": "MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFF..." |
| 38 | } |
| 39 | } |
| 40 | ``` |
| 41 | |
| 42 | **By attribute (e.g. resolution, organism, year):** |
| 43 | ```python |
| 44 | { |
| 45 | "type": "group", "logical_operator": "and", |
| 46 | "nodes": [ |
| 47 | {"type": "terminal", "service": "text", |
| 48 | "parameters": {"attribute": "rcsb_entry_info.resolution_combined", |
| 49 | "operator": "less", "value": 2.0}}, |
| 50 | {"type": "terminal", "service": "text", |
| 51 | "parameters": {"attribute": "rcsb_entity_source_organism.taxonomy_lineage.name", |
| 52 | "operator": "exact_match", "value": "Homo sapiens"}} |
| 53 | ] |
| 54 | } |
| 55 | ``` |
| 56 | |
| 57 | **Boolean combination:** use `{"type": "group", "logical_operator": "and"|"or", "nodes": [...]}`. |
| 58 | |
| 59 | ## Return Type → Identifier Shape |
| 60 | |
| 61 | | return_type | identifier shape | |
| 62 | |---|---| |
| 63 | | `entry` | `4HHB` (PDB ID) | |
| 64 | | `assembly` | `4HHB-1` | |
| 65 | | `polymer_entity` | `4HHB-1` (entity ID) | |
| 66 | | `polymer_instance` | `4HHB.A` (chain) | |
| 67 | | `mol_definition` | `HEM` (ligand 3-letter code) | |
| 68 | |
| 69 | ## Common Mistakes |
| 70 | |
| 71 | - **Passing a Python query dict expecting URL-encoding**: dicts are serialized & url-encoded automatically; pass the dict, not a hand-crafted URL. |
| 72 | - **Forgetting `return_type`**: defaults to `entry` (PDB IDs). If you want chain identifiers, pass `polymer_instance`. |
| 73 | - **Using `count_only=True` and then trying to read `result_set`**: count-only mode returns `{"total_count": N}` only, no `result_set`. |
| 74 | - **Sequence searches with `identity_cutoff` too strict**: try lower (e.g. 0.3) if you get few hits. |
| 75 | |
| 76 | ## References |
| 77 | |
| 78 | - [RCSB Search API v2 docs](https://search.rcsb.org/) |
| 79 | - [Query attribute schema](https://search.rcsb.org/rcsbsearch/v2/metadata/schema) |
| 80 | - [Data API docs](https://data.rcsb.org/) |