I'm planning on rewriting  the CTab readers to fix issues like the
cdk:Remark nastyness but the title lines should still be working.

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
> SmilesParser smipar = new SmilesParser(bldr);
> IAtomContainer mol = smipar.parseSmiles("CCO ethanol");
> new MDLV2000Writer(System.out).write(mol);
> System.out.println("//");
> try (SDFWriter sdf = new SDFWriter(System.out)) {
> sdf.write(mol);
> }


Result:

ethanol
>
>   CDK     0625171540
>
>
>>   3  2  0  0  0  0  0  0  0  0999 V2000
>
>     0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>
>     0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>
>     0.0000    0.0000    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>
>   1  2  1  0  0  0  0
>
>   2  3  1  0  0  0  0
>
> M  END
>
> //
>
> ethanol
>
>   CDK     0625171540
>
>
>>   3  2  0  0  0  0  0  0  0  0999 V2000
>
>     0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>
>     0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>
>     0.0000    0.0000    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>
>   1  2  1  0  0  0  0
>
>   2  3  1  0  0  0  0
>
> M  END
>
> $$$$
>
>
How are you using them Tim?

John

On 24 June 2017 at 17:19, Tim Dudgeon <tdudgeon...@gmail.com> wrote:

> One possibility might be to use the value of IChemObject.getID() for the
> title line.
> Not sure if that would be a good or a bad idea. But I tried it and it
> doesn't work.
>
> Another thing I noticed is that CDK has a bad habit of adding an empty
> cdk:Remark property for no particular reason.
> But if you know about this then you can remove it before exporting so its
> not a major problem.
>
> Tim
>
>
>
> On 24/06/2017 15:45, Egon Willighagen wrote:
>
>> Mmm... I'd consider that a regression, as that was the intended
>> behavior...
>>
>> John, do you agree we should restore that behavior, or do you have a
>> better solution?
>>
>> Egon
>>
>>
>> On Sat, Jun 24, 2017 at 4:23 PM, Tim Dudgeon <tdudgeon...@gmail.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> I'm needing to write the title line (the first line in the record) for
>>> MDL
>>> formats.
>>> I'm using SDFWriter.write(mol) to write out the SD file.
>>> I've found that you can do this be setting the property
>>> CDKConstants.TITLE
>>> (which has a value of "cdk:Title") of the IAtomContainer to the value you
>>> want in the title line , but you also get this written as a SD file
>>> property, which is not what I want.
>>>
>>> Is there a way of better controlling this?
>>>
>>> Tim
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Cdk-user mailing list
>>> Cdk-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/cdk-user
>>>
>>
>>
>>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to