Re: [Cdk-user] Title line for MDL formats

2017-06-28 Thread Tim Dudgeon

OK, thanks. Behaviour is good with 2.0.

Timm


On 26/06/2017 09:51, John Mayfield wrote:

Use version 2.0 :-)

On 26 June 2017 at 08:31, Tim Dudgeon > wrote:


Here's what I see:

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser parser = new SmilesParser(bldr);
IAtomContainer mol1 = parser.parseSmiles("CCO");
IAtomContainer mol2 = parser.parseSmiles("CCO ethanol");
SDFWriter sdf = new SDFWriter(System.out);
sdf.write(mol1);
sdf.write(mol2);

Outputs:


  CDK 0626170823

  3 2 0 0 0 0 0 0 0 0999 V2000
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. 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
> 
null


ethanol
  CDK 0626170823

  3 2 0 0 0 0 0 0 0 0999 V2000
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. 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



Note that for mol1 no title is set but a property named cdk:Title
is output with a value of "null".
For mol2 the title is set and output correctly, but the property
cdk:Title is also output.
This is with version 1.5.14.

Tim



On 25/06/2017 15:40, John Mayfield wrote:

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.0.0. C   0  0  0  0  0  0  0  0  0
 0  0  0

0.0.0. C   0  0  0  0  0  0  0  0  0
 0  0  0

0.0.0. 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.0.0. C   0  0  0  0  0  0  0  0  0
 0  0  0

0.0.0. C   0  0  0  0  0  0  0  0  0
 0  0  0

0.0.0. 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 > 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
> 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
   

Re: [Cdk-user] Title line for MDL formats

2017-06-26 Thread John Mayfield
Relevant commit:
https://github.com/cdk/cdk/commit/20d57ed9e92e187e3ef3f356d4236534bff0bce2

You can actually control the that set from an option if IIRC so you a work
around in 1.5.14 might be to add those to the ignore. I can remember though
if this might also remove the title line - there were some other commit
around then for example null is now blank.

John

On 26 June 2017 at 09:51, John Mayfield  wrote:

> Use version 2.0 :-)
>
> On 26 June 2017 at 08:31, Tim Dudgeon  wrote:
>
>> Here's what I see:
>>
>> IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
>> SmilesParser parser = new SmilesParser(bldr);
>> IAtomContainer mol1 = parser.parseSmiles("CCO");
>> IAtomContainer mol2 = parser.parseSmiles("CCO ethanol");
>> SDFWriter sdf = new SDFWriter(System.out);
>> sdf.write(mol1);
>> sdf.write(mol2);
>>
>> Outputs:
>>
>>
>>   CDK 0626170823
>>
>>   3 2 0 0 0 0 0 0 0 0999 V2000
>>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>>   0. 0. 0. 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
>> > 
>> null
>>
>> 
>> ethanol
>>   CDK 0626170823
>>
>>   3 2 0 0 0 0 0 0 0 0999 V2000
>>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>>   0. 0. 0. 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
>>
>> 
>>
>> Note that for mol1 no title is set but a property named cdk:Title is
>> output with a value of "null".
>> For mol2 the title is set and output correctly, but the property
>> cdk:Title is also output.
>> This is with version 1.5.14.
>>
>> Tim
>>
>>
>>
>> On 25/06/2017 15:40, John Mayfield wrote:
>>
>> 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.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>>
>>> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>>
>>> 0.0.0. 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.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>>
>>> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>>
>>> 0.0.0. 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  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 
 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
> 

Re: [Cdk-user] Title line for MDL formats

2017-06-26 Thread John Mayfield
Use version 2.0 :-)

On 26 June 2017 at 08:31, Tim Dudgeon  wrote:

> Here's what I see:
>
> IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
> SmilesParser parser = new SmilesParser(bldr);
> IAtomContainer mol1 = parser.parseSmiles("CCO");
> IAtomContainer mol2 = parser.parseSmiles("CCO ethanol");
> SDFWriter sdf = new SDFWriter(System.out);
> sdf.write(mol1);
> sdf.write(mol2);
>
> Outputs:
>
>
>   CDK 0626170823
>
>   3 2 0 0 0 0 0 0 0 0999 V2000
>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>   0. 0. 0. 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
> > 
> null
>
> 
> ethanol
>   CDK 0626170823
>
>   3 2 0 0 0 0 0 0 0 0999 V2000
>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>   0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
>   0. 0. 0. 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
>
> 
>
> Note that for mol1 no title is set but a property named cdk:Title is
> output with a value of "null".
> For mol2 the title is set and output correctly, but the property cdk:Title
> is also output.
> This is with version 1.5.14.
>
> Tim
>
>
>
> On 25/06/2017 15:40, John Mayfield wrote:
>
> 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.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>
>> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>
>> 0.0.0. 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.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>
>> 0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
>>
>> 0.0.0. 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  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 
>>> 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! 

Re: [Cdk-user] Title line for MDL formats

2017-06-26 Thread Tim Dudgeon

Here's what I see:

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser parser = new SmilesParser(bldr);
IAtomContainer mol1 = parser.parseSmiles("CCO");
IAtomContainer mol2 = parser.parseSmiles("CCO ethanol");
SDFWriter sdf = new SDFWriter(System.out);
sdf.write(mol1);
sdf.write(mol2);

Outputs:


  CDK 0626170823

  3 2 0 0 0 0 0 0 0 0999 V2000
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. 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



null


ethanol
  CDK 0626170823

  3 2 0 0 0 0 0 0 0 0999 V2000
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. C 0 0 0 0 0 0 0 0 0 0 0 0
  0. 0. 0. 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



Note that for mol1 no title is set but a property named cdk:Title is 
output with a value of "null".
For mol2 the title is set and output correctly, but the property 
cdk:Title is also output.

This is with version 1.5.14.

Tim



On 25/06/2017 15:40, John Mayfield wrote:
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.0.  0. C   0  0  0  0  0  0  0  0  0  0
 0  0

0.0.  0. C   0  0  0  0  0  0  0  0  0  0
 0  0

0.0.  0. 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.0.  0. C   0  0  0  0  0  0  0  0  0  0
 0  0

0.0.  0. C   0  0  0  0  0  0  0  0  0  0
 0  0

0.0.  0. 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 > 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
> 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 

Re: [Cdk-user] Title line for MDL formats

2017-06-24 Thread Egon Willighagen
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  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



-- 
E.L. Willighagen
Department of Bioinformatics - BiGCaT
Maastricht University (http://www.bigcat.unimaas.nl/)
Homepage: http://egonw.github.com/
LinkedIn: http://se.linkedin.com/in/egonw
Blog: http://chem-bla-ics.blogspot.com/
PubList: http://www.citeulike.org/user/egonw/tag/papers
ORCID: -0001-7542-0286
ImpactStory: https://impactstory.org/u/egonwillighagen

--
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