forlilab / Meeko

Interfacing RDKit and AutoDock
GNU Lesser General Public License v2.1
169 stars 41 forks source link

Error when converting molecules derived from multimolecular archives #118

Open davidoskky opened 1 month ago

davidoskky commented 1 month ago

When providing more than one molecule, only one is converted to PDBQT but the smiles remark contains both molecules. This could be considered incorrect input, however it does not raise an error when generating a PDBQT file but only when converting back to SDF.

I feel it would be better to immediately signal the input is not correct.

To Reproduce

cat "c1ccccc1.CCC(Cl)CCC" > test.smi
obabel test.smi -O test.sdf
mk_prepare_ligand.py test.sdf -o test.pdbqt
mk_export.py test.pdbqt -o output.sdf
Traceback (most recent call last):
  File "/bin/mk_export.py", line 93, in <module>
    output_string, failures = RDKitMolCreate.write_sd_string(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/meeko/rdkit_mol_create.py", line 360, in write_sd_string
    mol_list = RDKitMolCreate.from_pdbqt_mol(pdbqt_mol, only_cluster_leads)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/meeko/rdkit_mol_create.py", line 196, in from_pdbqt_mol
    mol = cls.add_pose_to_mol(mol, coordinates, index_map) 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/meeko/rdkit_mol_create.py", line 294, in add_pose_to_mol
    raise RuntimeError("Only H allowed to be in SMILES but not in PDBQT")
RuntimeError: Only H allowed to be in SMILES but not in PDBQT
rwxayheee commented 1 month ago

only one is converted to PDBQT but the smiles remark contains both molecules

Can confirm this, for smilar Smiles, obabel might generate a multi-fragment PDBQT file which is also not instantly ready for docking. Smiles containing a dot isn't necessarily incorrect, though. It might be helpful for Meeko to be able to "desalt" Smiles that comes from some chemical libraries that have drugs in the pharmaceutical salt form. When the inputs are salts, obabel might neutralize (add additional hydrogens to, and create a new root for) anions like [Cl-]