Dear All,
It's been a couple of weeks since Greg first helped me with this, and
after some further help I agreed that I would do my best to summarise
things for the benefit of the Group.
The attached file '' was provided to me by Greg, and
essentially does exactly what I (thought I) wanted - ie if required,
'cleans' up an input molecule by modifying aromatic nitrogen-containing
ring systems until a 'sanitizable' form is generated.
However, having tested this a bit further, I found that N-containing
heteroaromatics (which I originally posted the question about) are only
one of many possible issues when dealing with automated atom- and
bond-typing from PDB files!  So taking this approach would require a
significantly larger set of 'rules' to cover all possible problems (I'm
sure many people more experienced than me will have been aware of this
for a long time!).  As Greg said:
> Figuring out the correct chemistry for a pdb ligand is one of 
> those challenges at I wouldn't dream of attempting. Between 
> the various sources of ligand structures out there you can 
> probably find omsething at least halfway acceptable. For in 
> house stuff, I would assume that you can use the registry 
> number to get a smiles or mol block, right?
> You could use that with the rdkit substructure matching code 
> to test the pymol-assigned structures.

And indeed, this is the way that I ended-up going for in-house
structures - a script that extracts our corporate ID from the PDB file
and searches our database to return the SMILES.  Then (again, thanks to
Greg for more help here, and steering me away from some clumsy usage of
ConstrainedEmbed!) a substructure match is conducted between an RDKit
mol from the SMILES (refered to as 'db_mol' in the function below), and
the original ligand.

The main point here is to convert the original ligand structure to a set
of non-aromatic atoms joined by 'unspecified' bond-types.  Below is the
excerpt from what I am using with PyMOL: 'molfile3D' is a temporary
molfile that has been created using the PyMOL 'save' command, that gets
converted to the required 'connectivity substructure' that carries the
3D coordinates we will need later:

def make3DTemplate(molfile3D):

        mol = Chem.MolFromMolFile(molfile3D, False)
        for atom in mol.GetAtoms():
        for bond in mol.GetBonds():

        return mol

Then once we have this '3D template', the substructure match can be
conducted for the molecule built from the database SMILES string
(db_mol).  If the match is successful, the original 3D coordinates for
the atoms in the 'template' are then applied back to a conformer of our
new molecule.  Finally, this new molecule + conformation is returned as
the molblock, which I then read back in PyMOL to give a 'sanitized'
version of the bound ligand for any in-house crystal structure:

def outputMolBlock(db_mol, template_mol):

        matches = db_mol.GetSubstructMatches(template_mol)
        if not matches:
                raise ValueError,"no substruct match"
        if len(matches)>1:
                print "warning! more than one isomorphism found!"

        db_conf = db_mol.GetConformer()
        template_conf = template_mol.GetConformer()

        match = matches[0]

        # This sets the 3D coordinates for 
        for i,mIdx in enumerate(match):

        return Chem.MolToMolBlock(db_mol)

It wouldn't now be too much of a leap(?) to extend the same methodology
to public PDB structures - using the LigandExpo SDF.  See this post from
Noel on Blue Obelisk for background:

Also, just for interest - I am using cx_Oracle to connect to our
corporate database from Python, which is now allowing me to add a few
extra bits - like flagging up to people if the in-house structure they
have just opened has been previously crystallised in any other targets,
etc, etc.  If anybody is trying to do similar, but has not used
cx_Oracle, then give me a shout and I will see if I can help (although
SQL is definitely also on the list of things I know only barely enough

Kind regards


PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
Oakdene Court
613 Reading Road
Winnersh, Berkshire
RG41 5UA.
Tel: +44 118 977 3133

To access trading company registration and address details, please go to the 
Vernalis website at and click on the "Company address and 
registration details" link at the bottom of the page..


This email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit --
Rdkit-discuss mailing list

Reply via email to