Remove empty space from structures with R and S groups We receive structures from a server within our company. Those structures are transferred as MOL files. Some of these structures contain R and/or S groups. Some of the creators of these structures create a really large empty space between the actual structure and the groups. We have currently ~30.000 structures in our database. Around 2.000 of these structures are flawed.

I have attached how such a structure might look at the bottom, as the image is quite large.

What I am trying to do now is to remove that empty space.

The process is currently receiving the MOL files wrapped within an XML file that does have additional information to store along with the structure. That process is written in Java. Up to now we do not have any library within the project to process and manipulate structures, as we have just parsed the MOL as String from the XML file and written it into a CLOB field in the database.

I know that libraries like the CDK exist, but right now I do not know if it can help me with that task.

I have pasted the actual mol file here.

If we open it with a viewer it looks like this:
Are you sure that the R and S are in the mol file and not part of the xml envelope?

Stereochemical R and S descriptors would not make any sense for a molecule like anthracene!

Is it conceivable that the letters come from Risk and Safety statements? 

It would be helpful if you could upload the original mol file somewhere.


EDIT 1

The file that you kindly uploaded is supposed to be a V2000 mol file, but it is not standards-compliant.

(The full specifications can be obtained from Accelrys upon registration.)

The first flaw is already in the header! The header is supposed to have a length of three lines.

The following CTAB should start with the counts line (in line 4 - note that we're not using zero-based indexing here).

With this flawed format, OpenBabel, a standard tool for the conversion of chemical data formats, casts an error.


EDIT 2

The rest of the file, including the stereochemical descriptors, seemed to be fine.

Once I had inserted the missing blank line in the header, a PNG could be generated using

obabel -imol 498268e9.txt -opng -O stuff.png




OpenBabel comes with bindings for Python, Java, C++ and whatnot. You might want to talk to your IT about some refactoring ;)