#86 Better handling of SD data fields

open
cdk.io (23)
5
2012-10-08
2006-04-27
Noel O'Boyle
No

I think that handling of SD data fields can be made
more straightforward.

For example, if I wish to read in an SD file, and write
it out again retaining all of the data fields in the SD
file, I need to use the following procedure for each
molecule:

(1) create an empty HashMap
(2) add all of the entries in a molecule's properties
HashMap (except for Title and Remark) to the empty HashMap
(3) pass this new HashMap to the MDLWriter's
setSDFields() method

This is not an ideal solution because:
(1) In general, you always want to retain the fields in
an SD file
(2) If you have a field named 'Title' or 'Remark' this
will clash with the Title/Remark in the Properties
(3) In terms of object-orientation, the values of SD
fields are molecule-centric information, not
file-centric (and so it seems strange to use MDLWriter
to set these values).

The following comments were made on the mailing list
regarding these questions:

As a suggestion - could this be implemented as
IOSettings option?

Yes, implementing this as an IOSetting is the best idea.

It is more difficult to distinguish between different
types of properties...
Will need to think about how to convert this into
abstract concepts and a
clean design...

Regards,
Noel

Discussion