AGENT SKILL

protein-structure-prediction

Protein structure prediction and analysis using AlphaFold2, ESMFold, RoseTTAFold, and ColabFold. Use for 3D structure prediction from amino acid sequences, structure quality assessment, binding site identification, and structural comparison. Best for proteins without experimental structures.

License 许可
MIT
最近更新
2026-06-05
Stars
★ 1
Forks
0

01 前言 Front Matter

name
protein-structure-prediction
license
MIT license
metadata
{ "skill-author": "Lord1Egypt" }
description
Protein structure prediction and analysis using AlphaFold2, ESMFold, RoseTTAFold, and ColabFold. Use for 3D structure prediction from amino acid sequences, structure quality assessment, binding site identification, and structural comparison. Best for proteins without experimental structures.
allowed-tools
Read Write Edit Bash

03 SKILL.md 正文

Protein Structure Prediction

Overview

Protein structure prediction enables researchers to computationally determine the 3D conformation of proteins directly from their amino acid sequences. This skill covers AlphaFold2, ESMFold, RoseTTAFold, and ColabFold for structure prediction, alongside tools for quality assessment, structural alignment, and downstream analysis.

When to Use This Skill

  • Predicting 3D structures of proteins with no experimental structure available
  • Comparing predicted vs. experimental structures (PDB)
  • Identifying binding sites and functional residues
  • Modelling protein complexes (multimers) and protein-protein interactions
  • Assessing model confidence using pLDDT scores and PAE maps
  • Performing structural alignment and RMSD calculations
  • Screening for druggable pockets in predicted structures

Quick Start

ESMFold (Fast, API-based)

import requests

def predict_structure_esmfold(sequence: str) -> str:
    """Predict structure via ESMFold API, returns PDB string."""
    response = requests.post(
        "https://api.esmatlas.com/foldSequence/v1/pdb/",
        headers={"Content-Type": "application/x-www-form-urlencoded"},
        data=sequence,
        timeout=120,
    )
    response.raise_for_status()
    return response.text

sequence = "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVKVKALPDAQFEVVHSLAKWKRQTLGQHDFSAGEGLYTHMKALRPDEDRLSPLHSVYVDQWDWERVMGDGERQFSTLKSTVEAIWAGIKATEAAVSEEFGLAPFLPDQIHFVHSQELLSRYPDLDAKGRERAIAKDLGAVFLVGIGGKLSDGHRHDVRAPDYDDWSTPSELGHAGLNGDILVWNPVLEDAFELSSMGIRVDADTLKHQLALTGDEDRLELEWHQALLRGEMPQTIGGGIGQSRLTMLLLQLPHIGQVQAGVWPAAVRESVPSLL"

pdb_string = predict_structure_esmfold(sequence)
with open("predicted_structure.pdb", "w") as f:
    f.write(pdb_string)
print("Structure saved to predicted_structure.pdb")

ColabFold (AlphaFold2 via MSA server)

# Install ColabFold
pip install colabfold[alphafold]

# Run prediction (single sequence)
colabfold_batch input.fasta output_dir/ --num-recycle 3 --num-models 5
# Batch prediction from FASTA
from pathlib import Path

fasta_content = """>Protein_A
MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQ
>Protein_B
ACDEFGHIKLMNPQRSTVWY
"""

Path("sequences.fasta").write_text(fasta_content)
# Then run: colabfold_batch sequences.fasta results/ --num-recycle 3

Structure Analysis with Biopython

from Bio.PDB import PDBParser, DSSP, NeighborSearch
from Bio.PDB.PDBIO import PDBIO
import numpy as np

parser = PDBParser(QUIET=True)
structure = parser.get_structure("predicted", "predicted_structure.pdb")

# Extract pLDDT scores (stored in B-factor column for AlphaFold models)
model = structure[0]
plddts = []
for residue in model.get_residues():
    for atom in residue.get_atoms():
        if atom.name == "CA":
            plddts.append(atom.bfactor)

print(f"Mean pLDDT: {np.mean(plddts):.2f}")
print(f"High-confidence residues (pLDDT > 70): {sum(p > 70 for p in plddts)}/{len(plddts)}")

# Confidence zones
zones = {
    "Very high (>90)": sum(p > 90 for p in plddts),
    "Confident (70-90)": sum(70 < p <= 90 for p in plddts),
    "Low (50-70)": sum(50 < p <= 70 for p in plddts),
    "Very low (<50)": sum(p <= 50 for p in plddts),
}
for zone, count in zones.items():
    print(f"  {zone}: {count} residues")

Structural Alignment (RMSD)

from Bio.PDB import PDBParser, Superimposer
import numpy as np

def calculate_rmsd(pdb1: str, pdb2: str) -> float:
    """Calculate backbone RMSD between two structures."""
    parser = PDBParser(QUIET=True)
    s1 = parser.get_structure("s1", pdb1)[0]
    s2 = parser.get_structure("s2", pdb2)[0]

    atoms1 = [a for r in s1.get_residues() for a in r.get_atoms() if a.name == "CA"]
    atoms2 = [a for r in s2.get_residues() for a in r.get_atoms() if a.name == "CA"]

    min_len = min(len(atoms1), len(atoms2))
    sup = Superimposer()
    sup.set_atoms(atoms1[:min_len], atoms2[:min_len])
    sup.apply(s2.get_atoms())
    return sup.rms

rmsd = calculate_rmsd("predicted_structure.pdb", "experimental_structure.pdb")
print(f"Backbone RMSD: {rmsd:.3f} Å")

Binding Site Prediction with fpocket

# Install fpocket
conda install -c bioconda fpocket

# Run pocket detection
fpocket -f predicted_structure.pdb

# Parse results
python -c "
import glob, json
pockets = glob.glob('predicted_structure_out/pockets/*.pdb')
print(f'Found {len(pockets)} potential binding pockets')
"

Interpreting AlphaFold pLDDT Scores

pLDDT Range Confidence Interpretation
> 90 Very high Backbone reliable, side chains likely accurate
70–90 Confident Good backbone, some side chain uncertainty
50–70 Low Use with caution, likely disordered or flexible
< 50 Very low Likely intrinsically disordered, do not use for docking

PAE (Predicted Aligned Error) Analysis

import json
import numpy as np
import matplotlib.pyplot as plt

# Load PAE from AlphaFold JSON output
with open("predicted_structure_predicted_aligned_error_v1.json") as f:
    pae_data = json.load(f)

pae_matrix = np.array(pae_data["predicted_aligned_error"])

fig, ax = plt.subplots(figsize=(8, 7))
im = ax.imshow(pae_matrix, cmap="Greens_r", vmin=0, vmax=30)
plt.colorbar(im, ax=ax, label="Expected Position Error (Å)")
ax.set_xlabel("Scored Residue")
ax.set_ylabel("Aligned Residue")
ax.set_title("Predicted Aligned Error (PAE)")
plt.tight_layout()
plt.savefig("pae_matrix.png", dpi=150)
print("PAE matrix saved.")

Protein Complex Prediction (Multimer)

# AlphaFold multimer via ColabFold
colabfold_batch complex.fasta results/ \
    --model-type alphafold2_multimer_v3 \
    --num-recycle 6 \
    --num-models 5 \
    --rank iptm+ptm
# FASTA format for complex (chains separated by :)
complex_fasta = """>Complex_ProteinA:ProteinB
MKTAYIAKQRQISFVKSHFSRQLE:ACDEFGHIKLMNPQRSTVWY
"""

Common Workflows

Full Prediction Pipeline

import subprocess
from pathlib import Path
from Bio.PDB import PDBParser
import numpy as np

def run_full_prediction(sequence: str, name: str, output_dir: str = "structures"):
    """Complete structure prediction and analysis pipeline."""
    output_path = Path(output_dir)
    output_path.mkdir(exist_ok=True)

    # 1. Quick ESMFold prediction
    import requests
    response = requests.post(
        "https://api.esmatlas.com/foldSequence/v1/pdb/",
        headers={"Content-Type": "application/x-www-form-urlencoded"},
        data=sequence,
        timeout=120,
    )
    pdb_file = output_path / f"{name}_esmfold.pdb"
    pdb_file.write_text(response.text)

    # 2. Assess confidence
    parser = PDBParser(QUIET=True)
    structure = parser.get_structure(name, str(pdb_file))[0]
    plddts = [a.bfactor for r in structure.get_residues() for a in r if a.name == "CA"]
    mean_plddt = np.mean(plddts)

    print(f"[{name}] ESMFold prediction complete")
    print(f"  Sequence length: {len(sequence)} aa")
    print(f"  Mean pLDDT: {mean_plddt:.1f}")
    print(f"  Confidence: {'High' if mean_plddt > 70 else 'Low'}")
    print(f"  Output: {pdb_file}")

    return str(pdb_file), mean_plddt

Key Databases

  • AlphaFold DB: https://alphafold.ebi.ac.uk/ — 200M+ pre-computed structures
  • PDB: https://www.rcsb.org/ — experimental structures
  • ESM Atlas: https://esmatlas.com/ — ESMFold predictions for MGnify proteins
  • UniProt: https://www.uniprot.org/ — sequence + functional annotations

Dependencies

pip install biopython requests numpy matplotlib
pip install colabfold[alphafold]  # For AlphaFold2 predictions
conda install -c bioconda fpocket  # For pocket detection

04 同仓库更多 Skills

Lord1Egypt
Lord1Egypt/gemini-agent-toolkit

zarr-python

Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.

★ 1
Lord1Egypt
Lord1Egypt/gemini-agent-toolkit

what-if-oracle

Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like "what if...", "what would happen if...", "what are the possibilities", "explore scenarios", "scenario analysis", "possibility space", "what could go wrong", "best case / worst case", "risk analysis", "contingency planning", "strategic options", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.

★ 1
Lord1Egypt
Lord1Egypt/gemini-agent-toolkit

websockets-network

Asynchronous bi-directional WebSocket client and server configuration in Python.

★ 1
Lord1Egypt
Lord1Egypt/gemini-agent-toolkit

vite-frontend

Initializing, structuring, and bundling client-side Single-Page Applications (SPA) with Vite.

★ 1
Lord1Egypt
Lord1Egypt/gemini-agent-toolkit

venue-templates

Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.

★ 1
Lord1Egypt
Lord1Egypt/gemini-agent-toolkit

vaex

Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV/HDF5/Arrow/Parquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.

★ 1