Re: [Open Babel] extract a single compound from a multimolecular sdf

2017-11-05 Thread Craig James
This is really easy to do with a scripting language like Perl. Attached is a tar with two files: - SDF.pm, a general-purpose SDF parser (it can read files, standard input, or from an array) - sdf_filter.pl, which does exactly what you're looking for. Extract the two files to a directory

Re: [Open Babel] extract a single compound from a multimolecular sdf

2017-11-05 Thread David Hall
It appears there is a bug where numeric titles do not work with string comparisons. Leave out the single quotes and it works (on my machine). obabel ../input/in-3D.sdf -O 9782.sdf --filter "title=9782" > On Nov 5, 2017, at 8:17 PM, Sundar wrote: > > Hi David, > >

Re: [Open Babel] extract a single compound from a multimolecular sdf

2017-11-05 Thread Sundar
Hi David, 9782 is not the 9782th molecule in the file. I also will have to loop through sdf for various other numbers. I asked this as an example. Thanks, Sundar On Sun, Nov 5, 2017 at 7:13 PM, David Hall wrote: > Assuming you want the 9782’th molecule in the file,

Re: [Open Babel] extract a single compound from a multimolecular sdf

2017-11-05 Thread David Hall
Assuming you want the 9782’th molecule in the file, using the -f and -l options to obabel is what you are looking for. obabel ../input/in-3D.sdf -O 9782.sdf -f 9782 -l 9782 > On Nov 5, 2017, at 7:49 PM, Sundar wrote: > > Hi, > > I was trying to extract a single

[Open Babel] extract a single compound from a multimolecular sdf

2017-11-05 Thread Sundar
Hi, I was trying to extract a single molecule from a multimolecular sdf. I used the following but it didn't work. obabel ../input/in-3D.sdf -O 9782.sdf --filter "title='9782'" Let me how can I do this. Thanks, Jubilant