From: Peter S. S. <sh...@gm...> - 2016-10-24 21:39:55
|
Hi, Dimitri, I have two questions about your code. 1. Why are you incrementing the atom index by 1? Are there functions in RDKit, for example, that use atom indices using index-origin 1? Or is it rather because chemists in your target audience will be thinking of the first atom in, say, a structure from an sd file as atom #1? 2. Regarding the last line, most of the RDKit code I've seen in past examples displays the molecule using code like the following. When is it necessary/not necessary to remove the "svg" string from the results of GetDrawingText()? svg = drawer.GetDrawingText().replace('svg:','') SVG(svg) Thanks, -P. On Mon, Oct 24, 2016 at 2:31 PM, Dimitri Maziuk <dm...@bm...> wrote: > Since you already got your answer I'll just post this for posterity: > > > import sys > import rdkit > import rdkit.Chem > import rdkit.Chem.AllChem > import rdkit.Chem.Draw > import rdkit.Chem.Draw.rdMolDraw2D > > mol=rdkit.Chem.SupplierFromFilename(sys.argv[1],removeHs=False).next() > dr=rdkit.Chem.Draw.rdMolDraw2D.MolDraw2DSVG(800,800) > dr.SetFontSize(0.3) > op = dr.drawOptions() > for i in range(mol.GetNumAtoms()) : > op.atomLabels[i]=mol.GetAtomWithIdx(i).GetSymbol() + str((i+1)) > rdkit.Chem.AllChem.Compute2DCoords(mol) > dr.DrawMolecule(mol) > dr.FinishDrawing() > svg=dr.GetDrawingText() > > > -- > Dimitri Maziuk > Programmer/sysadmin > BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu > > > ------------------------------------------------------------ > ------------------ > 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 > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > |