forlilab / Meeko

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

Converting PQBQT to multiple RDKIT molecules #140

Closed QY0831 closed 2 months ago

QY0831 commented 2 months ago

Hi dev, Is there a way to convert all poses to RDKIT molecules?

>>> op = 'vina_out.pdbqt'
>>> pdbqt_mol = PDBQTMolecule.from_file(op, skip_typing=True)
>>> rdkitmol_list = RDKitMolCreate.from_pdbqt_mol(pdbqt_mol)
>>> rdkitmol_list
[<rdkit.Chem.rdchem.Mol object at 0x7f23c13d2970>]
>>> pdbqt_mol
<Molecule named forcefield_5241_out containing 2 poses of 35 atoms>

I set 'num_modes=2' in vina, so there are two poses in the PDBQT file. I know that it only return one rdkit mol if only one ligand was docked, but I want to get all the poses, Is there a way to do that? Thanks

diogomart commented 2 months ago

Hello, The poses are stored as conformers in the molecule. If there are flexible sidechains or multiple simultaneous ligands, the returned list will have multiple rdkit mols.

QY0831 commented 2 months ago

Successfully converted into multiple objects, thanks!

>>> print([x.GetId() for x in rdmol.GetConformers()])
[0, 1]
>>> m1 = Chem.Mol(rdmol, confId=0)
>>> m2 = Chem.Mol(rdmol, confId=1)