P.S. to previous question - looks like "0" property is actually _Name. If I set it to "" it doesn't get printed out, but there's an extra space in the output due to the missing value. Is there any way to suppress _Name output completely?
Thank you, Igor On Tue, 2008-08-05 at 20:07 +0200, Greg Landrum wrote: > Dear Igor, > > This is a good one for the mailing list, so I'm cross-posting my reply. > > On Tue, Aug 5, 2008 at 6:47 PM, Igor Filippov [Contr] > <[email protected]> wrote: > > > > Is there any way to convert a mol object into an SD file (i.e. CTAB plus > > user-defined properties) and have the result in a string? > > MolToMolBlock() only outputs CTAB portion without the properties. > > Indeed there is. You can construct an SDWriter (defined in > $RDBASE/GraphMol/FileParsers/MolWriters.h) using a pointer to a > stringstream, then use the SDWriter's write() method. It's probably > safest to call the flush() method before reading your text out of the > stringstream. > > An example for using this with a SmilesWriter is in the function > testSmilesWriter2() in testMolWriter.cpp. Using an SDWriter is exactly > equivalent. > > -greg

