`Input.to_json()` 会在相同链条被不同链条分隔时重新排序链条,因此 `<name>_data.json` 不能描述生成它的运行。
作者: cindykrafft创建于 2026年9月22日更新于 2026年9月22日
最小的示例,纯粹的Python(没有模型运行):
import json
from alphafold3.common import folding_input
INPUT = {
"name": "homodimer_with_ligand_between",
"modelSeeds": [1],
"sequences": [
{"protein": {"id": "A", "sequence": "MKTAYIAKQRQISFVKSHFSRQ"}},
{"ligand": {"id": "B", "smiles": "CC(=O)O"}},
{"protein": {"id": "C", "sequence": "MKTAYIAKQRQISFVKSHFSRQ"}},
],
"dialect": "alphafold3",
"version": 1,
}
fold_input = folding_input.Input.from_json(json.dumps(INPUT))
before = [c.id for c in fold_input.chains]
round_tripped = folding_input.Input.from_json(fold_input.to_json())
after = [c.id for c in round_tripped.chains]
print("chain order before round trip:", before)
print("chain order after round trip:", after)
print("sequences emitted by to_json: ", [list(s.values())[0]["id"] for s in json.loads(fold_input.to_json())["sequences"]])
assert after == before, "to_json/from_json changed the chain order"在 main(a66cc52)上,输出为:
chain order before round trip: ['A', 'B', 'C']
chain order after round trip: ['A', 'C', 'B']
sequences emitted by to_json: [['A', 'C'], 'B']
AssertionError: to_json/from_json changed the chain order预期结果:在回程后为 ['A', 'B', 'C'],即由输入顺序写入的 sequences。分组代码在 v3.0.1 到 v3.0.4 中是相同的(v3.0.0 为每条链写入一个条目,并且没有此项)。具有非相邻相同链的输入是正常的:一个含有中间列出的配体或辅助因子的同源聚合物
内容来源: google-deepmind/alphafold3