Re: [Rdkit-discuss] Functions to call to generate wedge information when given 3D coordinates (C++)

2017-04-07 Thread Greg Landrum
Tom,

On Fri, Apr 7, 2017 at 3:28 AM, Shubbey McBean 
wrote:

> Thanks for the response, Greg!
>
> When I set  cleanIt=false, I get the same results as if I didn't call
> assignStereoChemistry() at all.  In this case, the fused ring example
> (cases 1 and 2 in the GitHub thread) look correct, but, as you noted, the
> third case looks wrong.
>
> So I guess the question is, why is the stereo cleanup removing the
> stereochemistry in my fused ring example?  With hydrogens showing, I'd
> expect to have case 1 showing up/down wedges on H and case 2 showing
> down/down or up/up. It does this when cleanIt=false (or when I don't call
> assignStereoChemistry).
>

If you wanted a 2D representation of the 3D structure that ignores chemical
conventions, then wedging would be appropriate. So this:
[image: Inline image 1]


Would be drawn as something like this:
[image: Inline image 2]

However, from a chemical perspective, this isn't reasonable: those two
bridging carbons are not chiral centers, so stereochemistry is not normally
indicated. This is why the cleanIt argument to assignStereochemistry()
removes the chiral specification and the bond wedging code does not add a
wedge there.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Functions to call to generate wedge information when given 3D coordinates (C++)

2017-04-07 Thread Shubbey McBean
Thanks for the response, Greg!

When I set  cleanIt=false, I get the same results as if I didn't call
assignStereoChemistry() at all.  In this case, the fused ring example
(cases 1 and 2 in the GitHub thread) look correct, but, as you noted, the
third case looks wrong.

So I guess the question is, why is the stereo cleanup removing the
stereochemistry in my fused ring example?  With hydrogens showing, I'd
expect to have case 1 showing up/down wedges on H and case 2 showing
down/down or up/up. It does this when cleanIt=false (or when I don't call
assignStereoChemistry).

Much appreciated,

Tom
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Functions to call to generate wedge information when given 3D coordinates (C++)

2017-04-07 Thread Greg Landrum
Hi,

Sorry I haven't followed up on the github questions yet. Between travel and
getting the release ready I've been pretty busy.

I think this code snippet is mostly correct:

Kekulize(mol);
assignChiralTypesFrom3D(mol);
assignStereochemistry(mol,true,true);
compute2DCoords(mol);

const Conformer  = mol.getConformer();
WedgeMolBonds(mol,);


though I would also call sanitizeMol at the beginning of all of that in
order to make sure that implicit properties are there and that rings have
been found.

I think that where you're getting confused is with what
assignStereochemistry() is doing.
The second argument "cleanIt" (
http://rdkit.org/docs/cppapi/namespaceRDKit_1_1MolOps.html#abae38bdd181c070deee55a4d3ee12885)
tells the RDKit to remove stereochemistry specifications on atoms/bonds
that cannot have stereochemistry (the documentation says "bonds", but it's
actually both atoms and bonds). So if you have an atom that cannot be a
chiral center, you will end up with no wedging.

That's why this molecule:
[image: Inline image 1]
ends up losing the wedging on the ring to the right: that atom cannot be a
chiral center.

If you really want the wedging to be there, even if it's chemically
unreasonable, you should be able to get that like this:
assignStereochemistry(mol,false,true);

Best,
-greg



On Thu, Apr 6, 2017 at 4:22 PM, Shubbey McBean 
wrote:

> Hello again!
>
> RDKit nicely provides several functions to accept molecule input under the
> FileParsers module.  For example, we have MolFileToMol(), MolBlockToMol(),
> Mol2FileToMol(), and so forth.  Each of these parses the input and then
> does various cleanup to generate stereochemistry and such.
>
> In my case, my input is passed simply as raw molecule information (elems +
> 3D coordinates). So I generate the molecule manually, as follows:
>
> RWMol mol;
> // my info in atom and bond structs
> for(int i=0;i mol.addAtom(new Atom(atom[i].element));
>   }
>
>   for(int i=0;i mol.addBond(bond[i].atom1,bond[i].atom2,type);
>   }
>   Conformer *confp = new Conformer(atom.size());
>   for(int i=0;i confp->setAtomPos(i, RDGeom::Point3D(atom[i].x,atom[i].y,atom[i].z));
>   }
>   mol.addConformer(confp,true);
>
> At this point I have a molecule but it isn't cleaned up.  My question is,
> what is the most concise order of operations I need to generate a 2D
> depiction, including wedge information, from this setup?  I have tried a
> few different approaches and am getting mixed results-- some approaches
> produce better results than others, but it isn't consistent (one method may
> get a better result on one molecule, but worse on another).  I posted more
> about this in a bug report (may not be a bug) here: https://github.com/
> rdkit/rdkit/issues/1379
>
> So here is an example of something I've tried:
>
> Kekulize(mol);
> assignChiralTypesFrom3D(mol);
> assignStereochemistry(mol,true,true);
> compute2DCoords(mol);
>
> const Conformer  = mol.getConformer();
> WedgeMolBonds(mol,);
>
> As noted in the github post, the assignStereochemistry() part can
> sometimes cause wedging to disappear completely.  I chose this particular
> order by groking through the FileParser routines to see how they handled
> molecules post-3D input.
>
> I feel like I am overcomplicating this.  Is there a recommended approach?
>
> Thanks!
>
>
>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss