Difficulty orienting 2D depictions to a substructure

User 7f33ec9a5c

06-10-2009 05:15:31

Hi,


I am trying to orient 2D smiles depictions so a steroid core always appears in the same orientation.  I also want to change some of the stereocenters so that they show explicit hydrogens with the wedge bonds attached to the hydrogens (even though the hydrogens are implicit in the original smiles).  I'm sure this is a pretty common request, and I just need to be pointed at the documentation or an example.


I'm not good at navigating the ChemAxon documentation, so if you could just point me to the appropriate example, or list the API calls I need, I should be able to sort the rest out.


So far my code, taken from your depiction example and changed to C# looks like this, which does the depiction as I would like, but does not orient the scaffold based on the steroid core.


{...


Molecule mol = MolImporter.importMol(sMolString);


// Calculate the coordinates if needed (for example


// if the input is SMILES)


if (mol.getDim() == 0)


{


mol.clean(2, "O1");


}


//flip the depiction around to match a standard steroid core:


Molecule oScaffold = MolImporter.importMol(SteroidCore);


mol = HitDisplayUtil.getScaffoldOrientatedHit(oScaffold, mol);


// Generating the image


byte[] b = mol.toBinFormat(sFormat);


//write the response


Response.Clear();


Response.ContentType = "image/" + sType;


Response.BinaryWrite(b);


...}


public string SteroidCore


{


get


{


StringBuilder oSB = new StringBuilder();


oSB.Append("<?xml version=\"1.0\" ?>");


oSB.Append("<cml>");


oSB.Append("<MDocument>");


oSB.Append(" <MChemicalStruct>");


oSB.Append(" <molecule molID=\"m1\">");


oSB.Append(" <atomArray>");


oSB.Append(" <atom id=\"a1\" elementType=\"C\"");


oSB.Append(" x2=\"-5.059999942779541\" y2=\"-1.154966052124717\" />");


oSB.Append(" <atom id=\"a2\" elementType=\"C\"");


oSB.Append(" x2=\"-6.3936692838277995\" y2=\"-1.9249829926837574\" />");


oSB.Append(" <atom id=\"a3\" elementType=\"C\"");


oSB.Append(" x2=\"-6.3936692838277995\" y2=\"-3.4650168738018383\" />");


oSB.Append(" <atom id=\"a4\" elementType=\"C\"");


oSB.Append(" x2=\"-5.059999942779541\" y2=\"-4.235033814360879\" />");


oSB.Append(" <atom id=\"a5\" elementType=\"C\"");


oSB.Append(" x2=\"-3.7263306017312825\" y2=\"-3.4650168738018383\" />");


oSB.Append(" <atom id=\"a6\" elementType=\"C\"");


oSB.Append(" x2=\"-3.7263306017312825\" y2=\"-1.9249829926837574\" />");


oSB.Append(" <atom id=\"a7\" elementType=\"C\"");


oSB.Append(" x2=\"-2.392661260683024\" y2=\"-1.154966052124717\" />");


oSB.Append(" <atom id=\"a8\" elementType=\"C\"");


oSB.Append(" x2=\"-2.392661260683024\" y2=\"-4.235033814360879\" />");


oSB.Append(" <atom id=\"a9\" elementType=\"C\"");


oSB.Append(" x2=\"-1.0589919196347655\" y2=\"-3.4650168738018383\" />");


oSB.Append(" <atom id=\"a10\" elementType=\"C\"");


oSB.Append(" x2=\"-1.0589919196347655\" y2=\"-1.9249829926837574\" />");


oSB.Append(" <atom id=\"a11\" elementType=\"C\"");


oSB.Append(" x2=\"-1.0589919196347655\" y2=\"1.1550847695524045\" />");


oSB.Append(" <atom id=\"a12\" elementType=\"C\"");


oSB.Append(" x2=\"-2.392661260683024\" y2=\"0.385067828993364\" />");


oSB.Append(" <atom id=\"a13\" elementType=\"C\"");


oSB.Append(" x2=\"0.27467742141349305\" y2=\"-1.154966052124717\" />");


oSB.Append(" <atom id=\"a14\" elementType=\"C\"");


oSB.Append(" x2=\"0.27467742141349305\" y2=\"0.385067828993364\" />");


oSB.Append(" <atom id=\"a15\" elementType=\"C\"");


oSB.Append(" x2=\"1.739294644214355\" y2=\"0.8608672774056125\" />");


oSB.Append(" <atom id=\"a16\" elementType=\"C\"");


oSB.Append(" x2=\"1.7393112772802286\" y2=\"-1.6308565478795223\" />");


oSB.Append(" <atom id=\"a17\" elementType=\"C\"");


oSB.Append(" x2=\"2.6444550002058693\" y2=\"-0.3850399141384929\" />");


oSB.Append(" <atom id=\"a18\" elementType=\"H\"");


oSB.Append(" x2=\"0.43565998491724905\" y2=\"-2.6865288533992056\" />");


oSB.Append(" <atom id=\"a19\" elementType=\"H\"");


oSB.Append(" x2=\"-2.392661260683024\" y2=\"-2.694966052124717\" />");


oSB.Append(" <atom id=\"a20\" elementType=\"H\"");


oSB.Append(" x2=\"-1.0589919196347655\" y2=\"-0.38498299268375735\" />");


oSB.Append(" <atom id=\"a21\" elementType=\"H\"");


oSB.Append(" x2=\"-3.7263306017312825\" y2=\"-0.38498299268375735\" />");


oSB.Append(" <atom id=\"a22\" elementType=\"H\"");


oSB.Append(" x2=\"0.27467742141349316\" y2=\"1.925067828993364\" />");


oSB.Append(" <atom id=\"a23\" elementType=\"C\"");


oSB.Append(" x2=\"-7.72735329596503\" y2=\"-4.23500840347573\" />");


oSB.Append(" <atom id=\"a24\" elementType=\"H\"");


oSB.Append(" x2=\"-7.881195056312965\" y2=\"-3.066435544343956\" />");


oSB.Append(" </atomArray>");


oSB.Append(" <bondArray>");


oSB.Append(" <bond atomRefs2=\"a1 a2\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a1 a6\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a2 a3\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a3 a4\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a4 a5\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a7 a6\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a6 a5\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a5 a8\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a8 a9\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a9 a10\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a10 a13\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a7 a10\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a12 a7\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a11 a12\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a11 a14\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a13 a16\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a14 a13\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a15 a14\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a15 a17\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a16 a17\" order=\"1\" />");


oSB.Append(" <bond atomRefs2=\"a13 a18\" order=\"1\">");


oSB.Append(" <bondStereo>H</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" <bond atomRefs2=\"a7 a19\" order=\"1\">");


oSB.Append(" <bondStereo>H</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" <bond atomRefs2=\"a10 a20\" order=\"1\">");


oSB.Append(" <bondStereo>W</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" <bond atomRefs2=\"a6 a21\" order=\"1\">");


oSB.Append(" <bondStereo>W</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" <bond atomRefs2=\"a14 a22\" order=\"1\">");


oSB.Append(" <bondStereo>W</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" <bond atomRefs2=\"a3 a23\" order=\"1\">");


oSB.Append(" <bondStereo>W</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" <bond atomRefs2=\"a3 a24\" order=\"1\">");


oSB.Append(" <bondStereo>H</bondStereo>");


oSB.Append(" </bond>");


oSB.Append(" </bondArray>");


oSB.Append(" </molecule>");


oSB.Append(" </MChemicalStruct>");


oSB.Append("</MDocument>");


oSB.Append("</cml>");


return oSB.ToString();


}


}

ChemAxon a9ded07333

08-10-2009 12:29:16

Hi Michael,


HitDisplayUtil.getScaffoldOrientatedHit() is designed only for inner use (it's mentioned in the API doc).
Instead of it you should use HitDisplayTool. Its usage is described in our JChem Developers Guide:


http://www.chemaxon.com/jchem/doc/guide/utils/index.html#hitcoloring  ("Visualization of hits")


You can also find a detailed example (VisualizationExample) mentioned in this guide.
Write me if you need further help.


Regards,
Tamás

User 7f33ec9a5c

08-10-2009 18:34:49

Hi,


One of the major things I am trying to do in the allignment is change the wedges on the bonds that represent a steriocenter.  This often involves depicting Implicit Hydrogens in order to represent the wedge bond as attached to a hydrogen.


To give an example, let's use the steroid, Ouabain: 


Smiles:


C[C@@H]1O[C@@H](O[C@H]2C[C@@H](O)[C@]3(CO)[C@H]4[C@H](O)C[C@]5(C)[C@H](CC[C@]5(O)[C@@H]4CC[C@]3(O)C2)C6=CC(=O)OC6)[C@H](O)[C@H](O)[C@H]1O


My chemists want to see the steroid core in a very specific orientation as shown below, with no wedge bonds in the core ring structure, they want the wedge bonds on the small functional groups (or H) that surround the steriocenter.


In the image below, you can see the original depiction produced by Marvin, Implicit hydrogens are not used to represent the steriocenters, so wedge bonds end up in the rings in the steroid core.  The second image depicts how I would like the core to appear, and the third image shows the structure properly alligned (I did this by hand).


I think the issues that I am having are: 1). The HitDisplayTool.GetHit() function requires a substructure match between the query to allign and the molecule.  If I draw all the steriocenters in the query, this often will not match the molecule.  However, if I draw just the rings of the steriod core, I will always get a substructure match and an allignment, but I won't imply the detail of having certain steriocenters defined the way I want.  2). If I explicitly define Hydrogens in the query core, and they are implicit in the molecule, the core match seems to fail.


Can you please suggest a way that I can re-define the steriocenters so the wedge bonds do not appear in the ring structures?



Thanks,


~Mike


 


 


 


 

User 7f33ec9a5c

08-10-2009 18:58:49

The picture below shows the core I used for allignment, and the alligned molecule.  It contains explicit hydrogens which define a steriocenters with wedge bonds. 


Most of the allignment works as expected, but the implicit hydrogens in the steriocenters that are explicitly defined dissapear in the alligned molecule, and the wedge bonds migrate to the ring structure.


How do I force the implicit hydrogens to depict, and the wedge bonds into the steriocenters to appear on the bond to the hydrogen?


 

ChemAxon 25dcd765a3

12-10-2009 20:45:24

Hi,


If the target molceule does not contain explicit Hydrogens but the query does, then during the arrangement, the implicit Hydrogens are not converted to explicit ones. (We plan to change it in the future, to change implicit Hs to explicit, if the template contains explicit Hs.)


To overcome this problem the cleaning algorithm has an option to add explicit Hydrogens to chiral atoms.


( See http://www.chemaxon.com/marvin/help/sci/cleanoptions.html#2d ,


http://www.chemaxon.com/marvin/help/developer/beans/api/chemaxon/struc/MoleculeGraph.html#clean%28int,%20java.lang.String%29 )


So, after importing your target molecule, you should clean it 2D:


Molecule mol = MolImporter.importMol(sMolString);
mol.clean(2, "H"); // clean and add explicit H to chiral centers

 


Other issues:


The core structure for alignment at the 2nd line of  allignment issues.JPG will not match to your molecule (first line) due to the following reasons:


1) Atom types does not match. The molecule for alignment has explicit Hydrogen at the connection of the 5 membered and 6 membered ring while your original molecule (Ouabain) has an OH group at this position. To solve this problem you can change the explicit Hydrogen to ANY atom in the structure for alignment. So it will match to any atom.


2) The stereo match fails. The stereo informations are different in the template (molecule for alignment) and in your query (original molecule - Ouabain). You can set the search option used by HitDisplayTool to ignore stereo matching (SearchConstants.STEREO_IGNORE) in MolSearchOptions.setStereoSearchType().


 


Andras

ChemAxon a3d59b832c

13-10-2009 11:28:55

Hi,


A few corrections to Volfi's answer:


1. Any atom will not match H, you will have to use AH instead.


2. An even better approach would be to use the ring scaffold only, without ligands. In this case you will not need to bother with the atom types and stereochemistry.


3. Instead of using HitDisplayTool, it is also possible to use Standardizer's template-based cleaning action. For more details about this, see:


http://www.chemaxon.com/jchem/doc/user/StandardizerConfiguration.html#cleansec


(This solution may be more convenient regarding software environment or licensing.)


 


Nevertheless, the explicit H correction will still be needed as a second step.


Best regards,


Szabolcs