def get_protein_ccd_json2(protein_json, # dict with protein sequence
userCCD, # ccd text
pair1, # protein pair e.g., ["A", 145, "SG"] 1-indexed
pair2, # ligand pair e.g., ["L", 1, "C04"] 0-indexed
job_id, # str, job/task ID
save_path=None, # optional output path
seeds=[1]): # optional random seeds
"Create AlphaFold3 docking JSON with customized CCD ligand and bondedAtomPairs."
ccd_id = re.search(r"_chem_comp.id\s+([^\s#]+)", ccd_text).group(1)
json_data = {
"name": job_id,
"modelSeeds": seeds,
"sequences": [
{
"ligand": {
"id": "L",
"ccdCodes": [ccd_id]
}
},
{
"protein": protein_json["sequences"][0]["protein"]
},
],
"bondedAtomPairs": [[pair1,pair2]],
"userCCD": userCCD,
"dialect": "alphafold3",
"version": 3
}
if save_path:
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
dump_json(json_data, save_path)
return json_data