You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyMOL中如何完整打印配体10Å范围内选中的残基?

解决PyMOL中配体附近残基信息打印不全的问题

可行命令行方案

方案1:去重打印完整残基信息

先初始化一个存储变量避免重复输出:

stored.seen = []

然后遍历选中区域的所有原子,仅打印未记录过的残基(包含残基名、编号、链ID):

iterate sele, print(resn, resi, chain) if (resi, resn, chain) not in stored.seen else None; stored.seen.append((resi, resn, chain))

方案2:快速输出FASTA格式的残基序列

如果需要直观的残基序列+位置信息,直接用get_fastastr,它会自动去重:

print get_fastastr(sele)

输出示例:

>your_protein_chainA 3-12,18-25
AGTCDEFGHIJKLMN

方案3:Python API结构化提取(适合批量处理)

如果需要更灵活的脚本化处理,用PyMOL的Python API提取残基数据:

model = cmd.get_model("sele")
seen_res = set()
for atom in model.atom:
    res_id = (atom.resi, atom.resn, atom.chain)
    if res_id not in seen_res:
        print(f"{atom.resn} {atom.resi} {atom.chain}")
        seen_res.add(res_id)

原命令遗漏残基的原因

你之前用的iterate selected and name CA, print (resi, resn)只针对选中集合里的CA原子输出对应残基。但如果是通过byres ligand around 10选中的残基,可能存在残基的侧链/主链原子在配体10Å范围内,但CA原子不在的情况——这类残基会被纳入选中集合,但它们的CA原子不会被匹配到,因此被遗漏。

内容的提问来源于stack exchange,提问作者Kathryn Myers

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 18:12:42