Greg,
Great, I got it to work - there is one small problem though.
When I get SMILES string there is always an extra property with the
value of "0", doesn't exist in the SD output and I'm not sure where it's
coming from:
[H]Oc1c2c3c(cc1)CC1([H])N(C)CCC33C1([H])C=CC([H])(O[H])C3([H])O2 0 72
0.94463
^^^
this zero after SMILES and before "72".
Doesn't happen in SD file:
.....
M END
> <Resolution> (1)
72
> <Confidence_Estimate> (1)
0.9446319999999998
$$$$
What is it getting printed out and how can I supress it?
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