Hi Kirk,

Quick FYI: the attachment on the original message didn't make it through.
Still, I think the idea is clear enough.

A general question I'd have is whether or not you really want to completely
ignore the nature of the bond to the non-ring atom. For example, with this
scheme you're going to end up getting the same ring systems for quinone and
1,4 cyclohexadiene derivatives:
O=C1C=CC(=O)C=C1 -> C1C=CCC=C1
CC1C=CC(C)C=C1 -> C1C=CCC=C1

Similarly, sulfones in rings will lead to thioethers:
O=S1(=O)CCCC1 -> S1CCCC1

Is that desirable? If not, you could try adding dummies connected with an
appropriate bond type so that you get:
O=C1C=CC(=O)C=C1 -> *=C1C=CC(=*)C=C1


On Fri, May 31, 2013 at 11:41 PM, Robert DeLisle <[email protected]>wrote:

> Maybe the logic is that sophisticated after all - Code Block 4 below.
>
>
The trick with adding the Hs to Ns is, unfortunately, necessary. You should
be adding them to aromatic heteroatoms.

Code Block 4:
> from rdkit import Chem
> from rdkit.Chem import AllChem
>
> sdin = Chem.SDMolSupplier('test.sdf')
> sdout = Chem.SDWriter('rings.sdf')
>
> for m in sdin:
>
>   em = Chem.EditableMol(Chem.Mol())
>   indexmap = {}
>
>   for a in m.GetAtoms():
>
>     if ( a.IsInRing() ):
>       indexmap[a.GetIdx()] = em.AddAtom(Chem.Atom(a.GetAtomicNum()))
>
>   for b in m.GetBonds():
>
>     if ( b.IsInRing() ):
>       em.AddBond(
> indexmap[b.GetBeginAtomIdx()],indexmap[b.GetEndAtomIdx()],b.GetBondType() )
>
>   for a in m.GetAtoms():
>     if ( a.IsInRing() and a.GetAtomicNum() == 7 ):
>

I would replace the above line with:
if a.GetIsAromatic() and a.GetAtomicNum() != 6:


>       for b in a.GetBonds():
>          if ( not b.IsInRing() ):
>            em.AddBond(em.AddAtom(Chem.Atom(1)), indexmap[a.GetIdx()],
> Chem.BondType.SINGLE)
>
>   for nm in Chem.GetMolFrags(em.GetMol(), asMols=True):
>

You probably should be calling either Chem.SanitizeMol() or Chem.RemoveHs()
here. I'd recommend the second variant because I don't think you want the
Hs in the output.


>     AllChem.Compute2DCoords(nm)
>     sdout.write(nm)
>

-greg
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to