boltz-vsynthes 1.0.31__py3-none-any.whl → 1.0.33__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- boltz/data/parse/schema.py +91 -8
- {boltz_vsynthes-1.0.31.dist-info → boltz_vsynthes-1.0.33.dist-info}/METADATA +1 -1
- {boltz_vsynthes-1.0.31.dist-info → boltz_vsynthes-1.0.33.dist-info}/RECORD +7 -7
- {boltz_vsynthes-1.0.31.dist-info → boltz_vsynthes-1.0.33.dist-info}/WHEEL +0 -0
- {boltz_vsynthes-1.0.31.dist-info → boltz_vsynthes-1.0.33.dist-info}/entry_points.txt +0 -0
- {boltz_vsynthes-1.0.31.dist-info → boltz_vsynthes-1.0.33.dist-info}/licenses/LICENSE +0 -0
- {boltz_vsynthes-1.0.31.dist-info → boltz_vsynthes-1.0.33.dist-info}/top_level.txt +0 -0
boltz/data/parse/schema.py
CHANGED
@@ -2,6 +2,7 @@ from collections.abc import Mapping
|
|
2
2
|
from dataclasses import dataclass
|
3
3
|
from pathlib import Path
|
4
4
|
from typing import Optional
|
5
|
+
import json
|
5
6
|
|
6
7
|
import click
|
7
8
|
import numpy as np
|
@@ -1313,6 +1314,60 @@ def parse_boltz_schema( # noqa: C901, PLR0915, PLR0912
|
|
1313
1314
|
"cyclic", False
|
1314
1315
|
), "Cyclic flag is not supported for ligands"
|
1315
1316
|
|
1317
|
+
elif (entity_type == "ligand") and ("sdf" in items[0][entity_type]):
|
1318
|
+
# Handle SDF file
|
1319
|
+
sdf_path = Path(items[0][entity_type]["sdf"])
|
1320
|
+
from boltz.data.parse.sdf import parse_sdf
|
1321
|
+
target = parse_sdf(sdf_path, ccd, mol_dir)
|
1322
|
+
mol = target["sequences"][0]["ligand"]["smiles"]
|
1323
|
+
|
1324
|
+
if affinity:
|
1325
|
+
mol = standardize(mol)
|
1326
|
+
|
1327
|
+
mol = AllChem.MolFromSmiles(mol)
|
1328
|
+
mol = AllChem.AddHs(mol)
|
1329
|
+
|
1330
|
+
# Set atom names
|
1331
|
+
canonical_order = AllChem.CanonicalRankAtoms(mol)
|
1332
|
+
for atom, can_idx in zip(mol.GetAtoms(), canonical_order):
|
1333
|
+
atom_name = atom.GetSymbol().upper() + str(can_idx + 1)
|
1334
|
+
if len(atom_name) > 4:
|
1335
|
+
msg = (
|
1336
|
+
f"{mol} has an atom with a name longer than "
|
1337
|
+
f"4 characters: {atom_name}."
|
1338
|
+
)
|
1339
|
+
raise ValueError(msg)
|
1340
|
+
atom.SetProp("name", atom_name)
|
1341
|
+
|
1342
|
+
success = compute_3d_conformer(mol)
|
1343
|
+
if not success:
|
1344
|
+
msg = f"Failed to compute 3D conformer for {mol}"
|
1345
|
+
raise ValueError(msg)
|
1346
|
+
|
1347
|
+
mol_no_h = AllChem.RemoveHs(mol, sanitize=False)
|
1348
|
+
affinity_mw = AllChem.Descriptors.MolWt(mol_no_h) if affinity else None
|
1349
|
+
extra_mols[f"LIG{ligand_id}"] = mol_no_h
|
1350
|
+
residue = parse_ccd_residue(
|
1351
|
+
name=f"LIG{ligand_id}",
|
1352
|
+
ref_mol=mol,
|
1353
|
+
res_idx=0,
|
1354
|
+
)
|
1355
|
+
|
1356
|
+
ligand_id += 1
|
1357
|
+
parsed_chain = ParsedChain(
|
1358
|
+
entity=entity_id,
|
1359
|
+
residues=[residue],
|
1360
|
+
type=const.chain_type_ids["NONPOLYMER"],
|
1361
|
+
cyclic_period=0,
|
1362
|
+
sequence=None,
|
1363
|
+
affinity=affinity,
|
1364
|
+
affinity_mw=affinity_mw,
|
1365
|
+
)
|
1366
|
+
|
1367
|
+
assert not items[0][entity_type].get(
|
1368
|
+
"cyclic", False
|
1369
|
+
), "Cyclic flag is not supported for ligands"
|
1370
|
+
|
1316
1371
|
else:
|
1317
1372
|
msg = f"Invalid entity type: {entity_type}"
|
1318
1373
|
raise ValueError(msg)
|
@@ -1371,15 +1426,43 @@ def parse_boltz_schema( # noqa: C901, PLR0915, PLR0912
|
|
1371
1426
|
protein_chains.add(chain_name)
|
1372
1427
|
|
1373
1428
|
# Add affinity info
|
1374
|
-
if chain.affinity and affinity_info is not None:
|
1375
|
-
msg = "Cannot compute affinity for multiple ligands!"
|
1376
|
-
raise ValueError(msg)
|
1377
|
-
|
1378
1429
|
if chain.affinity:
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1430
|
+
# If this is a protein binder, we need to create affinity info for each ligand
|
1431
|
+
if chain_name in affinity_proteins:
|
1432
|
+
# Find all ligand chains
|
1433
|
+
ligand_chains = [
|
1434
|
+
(name, c) for name, c in chains.items()
|
1435
|
+
if c.type == const.chain_type_ids["NONPOLYMER"]
|
1436
|
+
]
|
1437
|
+
if not ligand_chains:
|
1438
|
+
msg = "No ligand chains found for protein binder!"
|
1439
|
+
raise ValueError(msg)
|
1440
|
+
|
1441
|
+
# Create affinity info for each ligand
|
1442
|
+
for ligand_name, ligand_chain in ligand_chains:
|
1443
|
+
affinity_info = AffinityInfo(
|
1444
|
+
chain_id=asym_id,
|
1445
|
+
mw=chain.affinity_mw,
|
1446
|
+
)
|
1447
|
+
# Save the affinity info in a subfolder named after the ligand
|
1448
|
+
output_dir = Path(f"output/{ligand_name}")
|
1449
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
1450
|
+
# Save the affinity info
|
1451
|
+
with open(output_dir / "affinity_info.json", "w") as f:
|
1452
|
+
json.dump({
|
1453
|
+
"chain_id": asym_id,
|
1454
|
+
"mw": chain.affinity_mw,
|
1455
|
+
"ligand_name": ligand_name
|
1456
|
+
}, f)
|
1457
|
+
else:
|
1458
|
+
# This is a ligand binder
|
1459
|
+
if affinity_info is not None:
|
1460
|
+
msg = "Cannot compute affinity for multiple ligands!"
|
1461
|
+
raise ValueError(msg)
|
1462
|
+
affinity_info = AffinityInfo(
|
1463
|
+
chain_id=asym_id,
|
1464
|
+
mw=chain.affinity_mw,
|
1465
|
+
)
|
1383
1466
|
|
1384
1467
|
# Find all copies of this chain in the assembly
|
1385
1468
|
entity_id = int(chain.entity)
|
@@ -40,7 +40,7 @@ boltz/data/parse/mmcif.py,sha256=25kEXCkx-OuaawAs7cdz0fxdRu5_CCO0AV00u84PrjQ,368
|
|
40
40
|
boltz/data/parse/mmcif_with_constraints.py,sha256=WHYZckSqUwu-Nb9vmVmxHmC7uxwVrF7AVUeVKsc5wGQ,51473
|
41
41
|
boltz/data/parse/pdb.py,sha256=iybk4p2UgUy_ABGprDq_xxyPSdm1HAZsGTM0lhxVEwM,1654
|
42
42
|
boltz/data/parse/pdb_download.py,sha256=wge-scX-lOatX0q83W1wOsaql99rYp-6uGWSHEc995M,2718
|
43
|
-
boltz/data/parse/schema.py,sha256=
|
43
|
+
boltz/data/parse/schema.py,sha256=5eU-_NR-g2XTtDpYXoREAy84DWTyHN8yRiXngd4BShs,65676
|
44
44
|
boltz/data/parse/sdf.py,sha256=fs3MQVClDcCzxJaeVYiDuoh-fUrYc8Tcd5Bz8ws3FKI,2052
|
45
45
|
boltz/data/parse/yaml.py,sha256=GRFRMtDD4PQ4PIpA_S1jj0vRaEu2LlZd_g4rN1zUrNo,1505
|
46
46
|
boltz/data/sample/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -107,9 +107,9 @@ boltz/model/optim/scheduler.py,sha256=nB4jz0CZ4pR4n08LQngExL_pNycIdYI8AXVoHPnZWQ
|
|
107
107
|
boltz/model/potentials/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
108
108
|
boltz/model/potentials/potentials.py,sha256=vev8Vjfs-ML1hyrdv_R8DynG4wSFahJ6nzPWp7CYQqw,17507
|
109
109
|
boltz/model/potentials/schedules.py,sha256=m7XJjfuF9uTX3bR9VisXv1rvzJjxiD8PobXRpcBBu1c,968
|
110
|
-
boltz_vsynthes-1.0.
|
111
|
-
boltz_vsynthes-1.0.
|
112
|
-
boltz_vsynthes-1.0.
|
113
|
-
boltz_vsynthes-1.0.
|
114
|
-
boltz_vsynthes-1.0.
|
115
|
-
boltz_vsynthes-1.0.
|
110
|
+
boltz_vsynthes-1.0.33.dist-info/licenses/LICENSE,sha256=8GZ_1eZsUeG6jdqgJJxtciWzADfgLEV4LY8sKUOsJhc,1102
|
111
|
+
boltz_vsynthes-1.0.33.dist-info/METADATA,sha256=XadtfwQoBLRNyaCe61wdMoCixayUE05BNfA7Y7hblgI,7171
|
112
|
+
boltz_vsynthes-1.0.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
113
|
+
boltz_vsynthes-1.0.33.dist-info/entry_points.txt,sha256=n5a5I35ntu9lmyr16oZgHPFY0b0YxjiixY7m7nbMTLc,41
|
114
|
+
boltz_vsynthes-1.0.33.dist-info/top_level.txt,sha256=MgU3Jfb-ctWm07YGMts68PMjSh9v26D0gfG3dFRmVFA,6
|
115
|
+
boltz_vsynthes-1.0.33.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|