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

• You are right about anthracene. I had made up the sample, as I was not sure if I was allowed to past the real ones. I have added a concrete example in the question. – cheffe Mar 5 '14 at 8:25
• So the R and S groups may just be removed? I ask as I do not find them in your image any more :) – cheffe Mar 5 '14 at 12:29
• By default, they are omitted and I haven't searched for a way to blend them in again ;) – Klaus-Dieter Warzecha Mar 5 '14 at 12:34
• I'll have a look into it. Although it is helpful to get to know open babel and the formatting issue, I still need to know how to get rid of the whitespace, without loosing the R and S groups ... – cheffe Mar 5 '14 at 14:33
• There's a misunderstanding. The information is still in the mol file. It just isn't shown somewhere in the image when a well-formed mol file is processed. – Klaus-Dieter Warzecha Mar 5 '14 at 15:58