luancarvalhomartins / PyAutoFEP

PyAutoFEP: an automated FEP workflow for GROMACS integrating enhanced sampling methods
163 stars 76 forks source link

Unable to generate dual topology files #115

Open pallavsen007 opened 1 year ago

pallavsen007 commented 1 year ago
 python ~/Softwares/packages/PyAutoFEP/prepare_dual_topology.py --config_file=step2_rest2.ini 
Traceback (most recent call last):
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 4229, in <module>
    poses_mol_data = align_ligands(
  File "/home/pallav/Softwares/packages/PyAutoFEP/os_util.py", line 558, in wrap_trace
    return f(*args, **kwargs)
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 3463, in align_ligands
    docking_mol_local = superimpose_poses(superimpose_loader_ligands, reference_pose_superimpose,
  File "/home/pallav/Softwares/packages/PyAutoFEP/docking_readers/superimpose_loader.py", line 79, in superimpose_poses
    rdkit_reference_pose = extract_docking_poses({'reference': {'molecule': reference_pose_mol}},
  File "/home/pallav/Softwares/packages/PyAutoFEP/docking_readers/generic_loader.py", line 76, in extract_docking_poses
    docking_mol_rd = mol_util.process_dummy_atoms(docking_mol_rd, verbosity=verbosity)
  File "/home/pallav/Softwares/packages/PyAutoFEP/mol_util.py", line 588, in process_dummy_atoms
    ''.format(molecule, rdkit.Chem.MolToSmiles(molecule), verbosity),
Boost.Python.ArgumentError: Python argument types in
    rdkit.Chem.rdmolfiles.MolToSmiles(bool)
did not match C++ signature:
    MolToSmiles(RDKit::ROMol mol, bool isomericSmiles=True, bool kekuleSmiles=False, int rootedAtAtom=-1, bool canonical=True, bool allBondsExplicit=False, bool allHsExplicit=False, bool doRandom=False)
    MolToSmiles(RDKit::ROMol mol, RDKit::SmilesWriteParams params)

Can you help me in understanding in what is the issue? Is it with the mol file i generated using Obabel?

pallavsen007 commented 1 year ago

I started with the mol2 files and created SMILES of all the molecules as shown in the tutorial, but again I am facing an issue with another thing,

python ~/Softwares/packages/PyAutoFEP/prepare_dual_topology.py --config_file=step2_rest2.ini --poses_input=lig_data/*.mol2
=============== mdp and run steps=================
         Complex                    Water          
        min01.mdp                 min01.mdp        
        min02.mdp                 min02.mdp        
        min03.mdp                  nve.mdp         
         nve.mdp                   nvt.mdp         
         nvt.mdp                   npt.mdp         
         npt.mdp                   md.mdp          
         md.mdp                       -            
==================================================
[20:31:59] sanitise [20:31:59] MOL: 
=================== STACK INFO ===================
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 3989, in <module>
    ligands_dict = parse_ligands_data(arguments.input_ligands, parameterize=input_parameterize,
  File "/home/pallav/Softwares/packages/PyAutoFEP/os_util.py", line 558, in wrap_trace
    return f(*args, **kwargs)
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 1452, in parse_ligands_data
    os_util.local_print('Failed to read molecule {} as a {} file. Please, check your input.'
  File "/home/pallav/Softwares/packages/PyAutoFEP/os_util.py", line 313, in local_print
    formatted_string = '\n{:=^50}\n{}{:=^50}\n'.format(' STACK INFO ', ''.join(traceback.format_stack()),
=================== STACK INFO ===================
[ERROR] Failed to read molecule lig_data/UFP3.mol2 as a .mol2 file. Please, check your input.

It would be kind of you if you could shed some light regarding this

AzraelXu commented 1 year ago

Failed to read molecule lig_data/UFP3.mol2 as a .mol2 file. Please, check your input.

Try to use mol file instead of mol2

pallavsen007 commented 1 year ago
python ~/Softwares/packages/PyAutoFEP/prepare_dual_topology.py --config_file=step2_rest2.ini --pose_loader='pdb' --poses_input='lig_data/*.mol'
=============== mdp and run steps=================
         Complex                    Water          
        min01.mdp                 min01.mdp        
        min02.mdp                 min02.mdp        
        min03.mdp                  nve.mdp         
         nve.mdp                   nvt.mdp         
         nvt.mdp                   npt.mdp         
         npt.mdp                   md.mdp          
         md.mdp                       -            
==================================================

=================== STACK INFO ===================
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 3989, in <module>
    ligands_dict = parse_ligands_data(arguments.input_ligands, parameterize=input_parameterize,
  File "/home/pallav/Softwares/packages/PyAutoFEP/os_util.py", line 558, in wrap_trace
    return f(*args, **kwargs)
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 1452, in parse_ligands_data
    os_util.local_print('Failed to read molecule {} as a {} file. Please, check your input.'
  File "/home/pallav/Softwares/packages/PyAutoFEP/os_util.py", line 313, in local_print
    formatted_string = '\n{:=^50}\n{}{:=^50}\n'.format(' STACK INFO ', ''.join(traceback.format_stack()),
=================== STACK INFO ===================
[ERROR] Failed to read molecule lig_data/UFP3.pdb as a .pdb file. Please, check your input.
pallavsen007 commented 1 year ago

okay, this gets resolved using pose_loader=generic. But I could not understand the options as such

pallavsen007 commented 1 year ago
Traceback (most recent call last):
  File "/home/pallav/Softwares/packages/PyAutoFEP/prepare_dual_topology.py", line 4346, in <module>
    merged_data = merge_topologies.merge_topologies(ligands_dict[state_a_name]['molecule'],
  File "/home/pallav/Softwares/packages/PyAutoFEP/merge_topologies.py", line 1011, in merge_topologies
    topology1.atomtype_dict[each_atom.atom_type], mol_region='const',
KeyError: 'PG2'

Does it not recognize the CGenFF atomtype naming or do I need to change the naming

luancarvalhomartins commented 1 year ago

Thank you very much for the message and your interest in PyAutoFEP. Sorry it took me some days to reply.

  1. pose_loader=pdb is supposed to be used when loading poses from multiple protein-ligand files. See section 3.2.1 in the manual for more info.
  2. Everytime you are passing small molecule files, avoid PDB files, if possible.
  3. See further info about each pose loader in the manual, section 3.2.
  4. When generating, did you check "Include parameters that are already in CGenFF"? Should you do so, would you mind sharing the input files that you are using so I can try reproduce and fix the bug?
pallavsen007 commented 1 year ago

Hi, Luan what to use if I am using a single protein ligand file.

xy21hb commented 1 year ago
  1. This problem is due to the special form of mol2 generated by obabel, which can be omitted by either correcting the format or generated by other tools, e.g. Maestro.
  2. When generating mol2 by obabel, espcially cutting large sdf file into mol2 molecule by molecule, obabel automatically adds a UNITY part after ATOMS but before BOND part, i.e., providing info on num of atoms and charge,

    @UNITY_ATOM_ATTR 87 1 charge 1

    This info is unfortunately cannot be read/regarded as a standard mol2 flow by some tools, including PyAutoFEP.

  3. To solve this, simple removing this UNITY part could work.
  4. Of course, using .mol file instead of .mol2 is not a recommended way to solve this due to .mol file's missing the atomic charge info.
pallavsen007 commented 1 year ago

ok, thanks a lot. Would try the same.