mcpField
P
pdb

pdb

github.com/adaptyvbio数据与数据库17246 次安装20 周前更新
代码仓库

关于 pdb

PDB Database Access 是面向研究人员和蛋白质设计者的 RCSB PDB 结构处理技能,涵盖通过 HTTP 请求和 BioPython 获取、搜索、准备及分析结构。

主要功能

  1. 01获取 PDB 和 mmCIF 结构
  2. 02按文本或序列相似性搜索
  3. 03选择链并裁剪结合区域
  4. 04检查链信息和残基数量
  5. 05识别链间界面残基

适用场景

  1. 01按 PDB ID 获取结构
  2. 02查找与蛋白质序列相关的结构
  3. 03为结合蛋白设计准备靶标结构

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/adaptyvbio/protein-design-skills --skill pdb

安装后在 Claude Code 中输入/pdb确认已加载。

详细介绍

PDB 数据库访问

注意:此技能直接使用 RCSB PDB Web API。无需部署 Modal——所有操作都通过 HTTP 请求在本地运行。

获取结构

按 PDB ID
# Download PDB file
curl -o 1alu.pdb "https://files.rcsb.org/download/1ALU.pdb"

# Download mmCIF
curl -o 1alu.cif "https://files.rcsb.org/download/1ALU.cif"
使用 Python
from Bio.PDB import PDBList

pdbl = PDBList()
pdbl.retrieve_pdb_file("1ABC", pdir="structures/", file_format="pdb")
使用 RCSB API
import requests

def fetch_pdb(pdb_id: str, format: str = "pdb") -> str:
    """Fetch structure from RCSB PDB."""
    url = f"https://files.rcsb.org/download/{pdb_id}.{format}"
    response = requests.get(url)
    response.raise_for_status()
    return response.text

def fetch_fasta(pdb_id: str) -> str:
    """Fetch sequence in FASTA format."""
    url = f"https://www.rcsb.org/fasta/entry/{pdb_id}"
    return requests.get(url).text

# Example usage
pdb_content = fetch_pdb("1ALU")
with open("1ALU.pdb", "w") as f:
    f.write(pdb_content)

结构准备

选择链
from Bio.PDB import PDBParser, PDBIO, Select

class ChainSelect(Select):
    def __init__(self, chain_id):
        self.chain_id = chain_id

    def accept_chain(self, chain):
        return chain.id == self.chain_id

# Extract chain A
parser = PDBParser()
structure = parser.get_structure("protein", "1abc.pdb")
io = PDBIO()
io.set_structure(structure)
io.save("chain_A.pdb", ChainSelect("A"))
裁剪至结合区域
def trim_around_residues(pdb_file, center_residues, buffer=10.0):
    """Trim structure to region around specified residues."""
    parser = PDBParser()
    structure = parser.get_structure("protein", pdb_file)

    # Get center coordinates
    center_coords = []
    for res in structure.get_residues():
        if res.id[1] in center_residues:
            center_coords.extend([a.coord for a in res.get_atoms()])

    center = np.mean(center_coords, axis=0)

    # Keep residues within buffer
    class RegionSelect(Select):
        def accept_residue(self, res):
            for atom in res.get_atoms():
                if np.linalg.norm(atom.coord - center) < buffer:
                    return True
            return False

    io = PDBIO()
    io.set_structure(structure)
    io.save("trimmed.pdb", RegionSelect())

搜索 PDB

RCSB 搜索 API
import requests

query = {
    "query": {
        "type": "terminal",
        "service": "full_text",
        "parameters": {
            "value": "EGFR kinase domain"
        }
    },
    "return_type": "entry"
}

response = requests.post(
    "https://search.rcsb.org/rcsbsearch/v2/query",
    json=query
)
results = response.json()
按序列相似性搜索
query = {
    "query": {
        "type": "terminal",
        "service": "sequence",
        "parameters": {
            "value": "MKTAYIAKQRQISFVK...",
            "evalue_cutoff": 1e-10,
            "identity_cutoff": 0.9
        }
    }
}

结构分析

获取链信息
def get_structure_info(pdb_file):
    parser = PDBParser(QUIET=True)
    structure = parser.get_structure("protein", pdb_file)

    info = {
        "chains": [],
        "total_residues": 0
    }

    for model in structure:
        for chain in model:
            residues = list(chain.get_residues())
            info["chains"].append({
                "id": chain.id,
                "length": len(residues),
                "first_res": residues[0].id[1],
                "last_res": residues[-1].id[1]
            })
            info["total_residues"] += len(residues)

    return info
查找界面残基
def find_interface_residues(pdb_file, chain_a, chain_b, distance=4.0):
    """Find residues at interface between two chains."""
    parser = PDBParser(QUIET=True)
    structure = parser.get_structure("complex", pdb_file)

    interface_a = set()
    interface_b = set()

    for res_a in structure[0][chain_a].get_residues():
        for res_b in structure[0][chain_b].get_residues():
            for atom_a in res_a.get_atoms():
                for atom_b in res_b.get_atoms():
                    if atom_a - atom_b < distance:
                        interface_a.add(res_a.id[1])
                        interface_b.add(res_b.id[1])

    return interface_a, interface_b

Binder 设计常见任务

靶标准备清单
  1. 下载结构:curl -o target.pdb "https://files.rcsb.org/download/XXXX.pdb"
  2. 确定靶标链
  3. 移除水和配体(如有需要)
  4. 裁剪至结合区域 + 缓冲区
  5. 确定潜在热点
  6. 如有需要,重新编号

故障排除

未找到结构:检查 PDB ID 格式(4 个字符) 存在多个模型:设计时选择第一个模型 残基缺失:检查结构中是否存在间隙


下一步:使用 boltzgen(推荐)或 rfdiffusion 进行设计。

评论

支持 Markdown