Skip to content

Commit

Permalink
minor tweaks to allow PDBQT writing for receptor with Co2+
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxayheee committed Nov 26, 2024
1 parent 07a38f8 commit 32a7b3d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
45 changes: 23 additions & 22 deletions meeko/chemtempgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,28 +395,29 @@ def from_cif(cls, source_cif: str, resname: str):
'value_order', # bond order
]
bond_table = block.find(bond_category, bond_attributes)
bond_cols = {attr: bond_table.find_column(f"{bond_category}{attr}") for attr in bond_attributes}

# Connect atoms by bonds
bond_type_mapping = {
'SING': Chem.BondType.SINGLE,
'DOUB': Chem.BondType.DOUBLE,
'TRIP': Chem.BondType.TRIPLE,
'AROM': Chem.BondType.AROMATIC
}
bond_types = bond_cols['value_order']

for bond_i, bond_type in enumerate(bond_types):
rwmol.AddBond(name_to_idx_mapping[bond_cols['atom_id_1'][bond_i].strip('"')],
name_to_idx_mapping[bond_cols['atom_id_2'][bond_i].strip('"')],
bond_type_mapping.get(bond_type, Chem.BondType.UNSPECIFIED))

# Try recharging mol (for metals)
try:
rwmol = recharge(rwmol)
except Exception as e:
logger.error(f"Failed to recharge rdkitmol. Error: {e} -> template for {resname} will be None. ")
return None
if bond_table:
bond_cols = {attr: bond_table.find_column(f"{bond_category}{attr}") for attr in bond_attributes}

# Connect atoms by bonds
bond_type_mapping = {
'SING': Chem.BondType.SINGLE,
'DOUB': Chem.BondType.DOUBLE,
'TRIP': Chem.BondType.TRIPLE,
'AROM': Chem.BondType.AROMATIC
}
bond_types = bond_cols['value_order']

for bond_i, bond_type in enumerate(bond_types):
rwmol.AddBond(name_to_idx_mapping[bond_cols['atom_id_1'][bond_i].strip('"')],
name_to_idx_mapping[bond_cols['atom_id_2'][bond_i].strip('"')],
bond_type_mapping.get(bond_type, Chem.BondType.UNSPECIFIED))

# Try recharging mol (for metals)
try:
rwmol = recharge(rwmol)
except Exception as e:
logger.error(f"Failed to recharge rdkitmol. Error: {e} -> template for {resname} will be None. ")
return None

# Finish eidting mol
try:
Expand Down
1 change: 1 addition & 0 deletions meeko/data/params/ad4_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
{"smarts": "[#30]", "atype": "Zn"},
{"smarts": "[#35]", "atype": "Br"},
{"smarts": "[#53]", "atype": "I"},
{"smarts": "[#27]", "atype": "Co"},
{"smarts": "[#7X3v3][a]", "atype": "N", "comment": "pyrrole, aniline"},
{"smarts": "[#7X3v3][#6X3v4]", "atype": "N", "comment": "amide"},
{"smarts": "[#7X3v3][NX2]=[*]", "atype": "N", "comment": "triazene"},
Expand Down
1 change: 1 addition & 0 deletions meeko/utils/rdkitutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,5 @@ def react_and_map(reactants: tuple[Chem.Mol], rxn: rdChemReactions.ChemicalReact
# 34: 1.20,
35: 1.20,
53: 1.39,
27: 0.00,
}

0 comments on commit 32a7b3d

Please sign in to comment.