Hello: Greg and Curt your comments are very much appreciated. Thanks for getting back to me! Best, Markus
On Wed, Sep 21, 2016 at 8:31 PM, Greg Landrum <greg.land...@gmail.com> wrote: > Hi Markus, > > Curt's instincts are dead on: the problem here is the rings. > > I'll show the fix and then explain what's going on. You just need to add > one line to your code: > > core = "[a]12[a][a][a][a][a]1[a][a][a]2" > pattern = Chem.MolFromSmarts(core) > Chem.GetSSSR(pattern) > AllChem.Compute2DCoords(pattern) > > when I do this, I get the following depiction for "c1(ocn2)c2cccc1": > > (The highlighting is due to the substructure match that's done during the > generation of coordinates). > > So why is this necessary? > The code that generates 2D coordinates uses information about the size of > ring systems in the molecule as part of the coordinate generation. If no > ring information is present (which is true of molecules generated from > SMARTS since they are not fully sanitized on construction) then the code > calls FastFindRings(). This function is perfectly capable of identifying > all ring atoms and bonds, but it isn't very good at getting ring sizes > correct for fused systems (it finds rings, but not the smallest rings). The > consequences are the badly generated coordinates for fused ring systems > that you were seeing. > > I think the current behavior of the code "isn't really ideal": the > coordinate generation code should call the SSSR algorithm in these cases so > that it can generate better coordinates. I'll take a look at the code and > think about changing it. > > As an aside: if you're puzzled by the behavior of AllChem. > GenerateDepictionMatching2DStructure() you can always just take a look at > the drawing of the query molecule itself. It's not always the most > informative depiction when it comes to what the atom and bond queries are, > but you at least will see the coordinates. > > A second aside: the molecule depictions in that notebook indicate that you > are stuck using the fallback drawing code, which creates fairly ugly > pictures. You can get better drawings by either installing cairo and > pycairo (in which case the code should automatically use those) or telling > the drawing code to use SVG for the rendering: > > from rdkit.Chem.Draw import IPythonConsole > IPythonConsole.ipython_useSVG=True > > It really does make the drawings a lot better. > > I hope this helps, > -greg > > > > > > > On Wed, Sep 21, 2016 at 8:47 PM, Markus Metz <metm...@gmail.com> wrote: > >> Hello all: >> >> I am trying to perform a 2D alignment of molecules by using a pattern for >> which I am using Compute2DCoords. >> >> If I use a smarts string matching napthalene the 2D depiction is as one >> would expect. >> However, if I am switching to a 5,6 aromatic smarts pattern the matched >> benzoxazol the 2D structure looks rather unusual. >> >> Is there a way to match the 5,6 with the 6,6 pattern behavior? >> >> Any hint is very much appreciated, >> >> Markus >> >> P.S. a work book is attached. >> >> ------------------------------------------------------------ >> ------------------ >> >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdkit-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >> >> >
------------------------------------------------------------------------------
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss