Discussion:
[Open Babel] Using obabel to filter ligands by number of rotatable bonds
Dennis N Bromley
2013-11-21 21:01:33 UTC
Permalink
Hi everyone,

I am new to babel, so I apologize if this has been solved elsewhere. I
googled for it and wasn't able to find an answer.

I have some multi-molecule SDF files from ZINC and simply want to filter
them down to keep only those with a molecular weight < 1000 and rotatable
bonds < 20. Pretty generous. Unfortunately,

obabel consolidated_zinc_ligands.sdf -O filtered.sdf --filter
"ROTATABLE_BOND<20"

doesn't work. ROTATABLE_BOND seems to not do anything. Reading a bit
implies that this is a prooperty that must be in the SDF file itself,
correct? Filtering on "MW<1000" works just fine, and it turns out that
this is a specific plugin.

There is a smarts query for identifying rotatable bonds:

[!$(*#*)&!D1]-!@[!$(*#*)&!D1]

And this works just fine, but I don't know how to specify the "<20" part.
It does seem to work; obabel converts most of the ligands, presumable
those that have at least one.

Any help would be very much appreciated.

Thanks!
-denny-
Pascal Muller
2013-11-22 09:32:05 UTC
Permalink
Hi,



I have some multi-molecule SDF files from ZINC and simply want to filter
Post by Dennis N Bromley
them down to keep only those with a molecular weight < 1000 and rotatable
bonds < 20.
I use a python script for this. If it suits you, adjust for the file name
and file format you are using:

#!/usr/bin/python
import pybel

outputFilename = "output.smi"
output = open(outputFilename,"w")
for mol in pybel.readfile("smi", "test.smi"):
rotBonds = mol.OBMol.NumRotors()
if rotBonds < 3:
output.write(mol.write("smi"))


(needs to compile python bindings. Could include the mass filter too:
mw = mol.molwt ).

Regards,
Pascal
Noel O'Boyle
2013-11-22 09:38:01 UTC
Permalink
According to Google, this has come up on the list before:

http://www.mail-archive.com/openbabel-***@lists.sourceforge.net/msg02727.html

HTH,

- Noel
Post by Pascal Muller
Hi,
Post by Dennis N Bromley
I have some multi-molecule SDF files from ZINC and simply want to filter
them down to keep only those with a molecular weight < 1000 and rotatable
bonds < 20.
I use a python script for this. If it suits you, adjust for the file name
#!/usr/bin/python
import pybel
outputFilename = "output.smi"
output = open(outputFilename,"w")
rotBonds = mol.OBMol.NumRotors()
output.write(mol.write("smi"))
mw = mol.molwt ).
Regards,
Pascal
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Loading...