Bad Conformer Id Error when using rdkit function rdMolAlign.AlignMol()

976 Views Asked by At

I was trying to run a docking simulation using rdkit library. But while running I am getting a value error stating: ValueError: Bad Conformer Id.

The 4POJ.pdb file can be downloaded from the RCSB Protein data bank here: 4POJ

Below is the code I am running, and in that line 8, rdMolAlign.AlignMol is the part I am getting this type of error.

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdMolAlign

receptor= Chem.MolFromPDBFile('4POJ.pdb')
ligand= Chem.MolFromSmiles('CC(C(=O)O)N')

rdMolAlign.AlignMol(ligand,receptor)

ff=AllChem.MMFFGetMoleculeForceField(ligand,AllChem.MMFFGetMoleculeProperties(ligand),mmffvariant='MMFF94')

binding_energy= ff.Calcenergy()

print('binding energy:',binding_energy, 'kcal/mol')
1

There are 1 best solutions below

0
Vandan Revanur On

There were a couple of things which were missing in your code. Before you AlignMol you need to get the conformer information of the ligands. This can be done with Chem.AllChem.EmbedMultipleConfs. And to calculate the binding energy you need to Setup the forcefield.

With those changes I am able to get the binding energy. Here is the modified code:

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdMolAlign

receptor= Chem.MolFromPDBFile('4poj.pdb')
ligand = Chem.MolFromSmiles('CC(C(=O)O)N')
Chem.AllChem.EmbedMultipleConfs(ligand, numConfs=10)

rdMolAlign.AlignMol(ligand,receptor)

# Setup forcefield
mp = Chem.rdForceFieldHelpers.MMFFGetMoleculeProperties(ligand)
ff = Chem.rdForceFieldHelpers.MMFFGetMoleculeForceField(ligand, mp)

binding_energy= ff.CalcEnergy()
print('binding energy:',binding_energy, 'kcal/mol')

We get the output:

>> binding energy: 26.948799001339836 kcal/mol