1

I was given an sdf file to work with. The file contains molecules with their properties and my task would be to find the total number of them. So far I have only ever worked with sql files which I query through pgadmin. I must say that my googling around was not very fruitful, as I tried online converters that wouldn't work, or blogposts that were a bit too old to still work.

So my question is mainly, how does someone work with an sdf file? Can it be converted to a sql dump file so that I can query it? Is there another way to do so?

Thank you in advance!

jarlh
  • 42,561
  • 8
  • 45
  • 63
Paschalis
  • 47
  • 5
  • Does this help ? https://stackoverflow.com/questions/1953248/how-do-you-open-an-sdf-file-sql-server-compact-edition – VBoka Jan 07 '20 at 12:29
  • Did the person who gave you this file tell you what it is? In the reference above there are a number of methods for opening it. If you try it and it doesn't work, please _explain_ what you tried and what error message you got. – Nick.Mc Jan 07 '20 at 12:32
  • 1
    OK you need to ascertain whether it's a SQL CE data file or a the SDF file explained below. The easiest way is to open in notepad. If it's gibberish it's not the file mentioned below, and it might be a SQL CE file. But _surely_ you didn't get this file without some clue of what it actually is? – Nick.Mc Jan 08 '20 at 12:13
  • 1
    @VBoka Hope that at Chemistry Exchange you were able to find a perfect solution. If you happen to find a solution, please don't forget to add the hyperlink towards the end of your question. It will be a helpful cross reference for somebody in future visiting stackoverflow. All the best. – Amit Jan 09 '20 at 14:16

1 Answers1

3

If you are dealing with chemical structures/bioinformatics then most likely below is an answer that can get you started.

For better help, I will strongly suggest you to post the question to Chemistry Stackexchange (https://chemistry.stackexchange.com/).

One MOL file is one chemical structure. For example Benzoic acid and its MOL file for are as below. enter image description here enter image description here

See the anatomy of a MOL file here. As you can see its a plaintext file.

Now that you know a MOL file, a SDF (Structure Data File) is nothing but many mol files joined together. See the link here. SDF file is also a plaintext file.

I think it will be hard to align it to SQL but once you understand what each line of the SDF file means (and if there is consistent pattern in your SDF file) then you will be able to parse it and save it in respective SQL columns.

You convert the entire file as a text and save it but I guess meaningful query will be hard. So it is better to parse it.

Please let me know if you need any more help.

Amit
  • 2,018
  • 1
  • 8
  • 12
  • This is valuable info. The OP has tagged SDF (SQL CE file), It would appear that this file is nothing of the sort and that it is probably the file that you mention. – Nick.Mc Jan 08 '20 at 12:11
  • @Nick.McDermaid Thank you – Amit Jan 08 '20 at 12:25