forlilab / Meeko

Interface for AutoDock, molecule parameterization
https://meeko.readthedocs.io/
GNU Lesser General Public License v2.1
204 stars 49 forks source link

Add HEM (and similar ones) to default chemical template #207

Closed rwxayheee closed 1 month ago

rwxayheee commented 1 month ago

HEM and other cofactors may be failing because of the incorrect information in the definition CIF file. Find them and pre-register the similar (and common) ones in the default chemical template.

rwxayheee commented 1 month ago

It needs a little more work to fully support Fe-containing cofactors, even with those properly annotated in the definition.

******************** New Template Built ********************
{
    "ambiguous": {
        "FDD": ["FDD"]
    },
    "residue_templates": {
        "FDD": {
            "smiles": "[H]C1=C2C(C([H])([H])[H])=C(C([H])([H])C([H])([H])C(=O)[O-])C3=C([H])C4=[N+]5C(=C([H])C6=C(C([H])([H])[H])C(C([H])([H])[H])=C7C([H])=C8C(C([H])([H])[H])=C(C([H])([H])[H])C1=[N+]8[Fe+3]5(N23)N76)C(C([H])([H])[H])=C4C([H])([H])C([H])([H])C(=O)[O-]",
            "atom_name": ["HHB", "CHB", "C4A", "C3A", "CMA", "HMA1", "HMA2", "HMA3", "C2A", "CAA", "HAA1", "HAA2", "CBA", "HBA1", "HBA2", "CGA", "O2A", "O1A", "C1A", "CHA", "HHA", "C4D", "ND", "C1D", "CHD", "HHD", "C4C", "C3C", "CMF", "HMF1", "HMF2", "HMF3", "C2C", "CMC", "HMC1", "HMC2", "HMC3", "C1C", "CHC", "HHC", "C4B", "C3B", "CME", "HME1", "HME2", "HME3", "C2B", "CMB", "HMB1", "HMB2", "HMB3", "C1B", "NB", "FE", "NA", "NC", "C2D", "CMD", "HMD1", "HMD2", "HMD3", "C3D", "CAD", "HAD1", "HAD2", "CBD", "HBD1", "HBD2", "CGD", "O2D", "O1D"],
            "link_labels": {}
        }
    }
}
************************************************************
Traceback (most recent call last):
  File "/Users/amyhe/micromamba/envs/mk_dev/bin/mk_prepare_receptor.py", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/Users/amyhe/Desktop/0_forks/Meeko/scripts/mk_prepare_receptor.py", line 512, in <module>
    chorizo = LinkedRDKitChorizo.from_prody(
  File "/Users/amyhe/Desktop/0_forks/Meeko/meeko/linked_rdkit_chorizo.py", line 967, in from_prody
    chorizo = cls(
  File "/Users/amyhe/Desktop/0_forks/Meeko/meeko/linked_rdkit_chorizo.py", line 811, in __init__
    self.parameterize(mk_prep)
  File "/Users/amyhe/Desktop/0_forks/Meeko/meeko/linked_rdkit_chorizo.py", line 1031, in parameterize
    charges = rectify_charges(charges, net_charge, decimals=3)
  File "/Users/amyhe/Desktop/0_forks/Meeko/meeko/linked_rdkit_chorizo.py", line 335, in rectify_charges
    surplus_int = _snap_to_int(10**decimals * surplus)
  File "/Users/amyhe/Desktop/0_forks/Meeko/meeko/linked_rdkit_chorizo.py", line 237, in _snap_to_int
    if abs(value - int(value) - inc) <= tolerance:
ValueError: cannot convert float NaN to integer

The problem is specific to charge_model = "gasteiger". Solved in f464d7f

rwxayheee commented 1 month ago

Closing with a walkaround in 05ec1a0