Hi,
> I am trying to count how many times a given moiety can be found in a
> database.
>
(...)
> If not, how can it be done with the API?
>
>
You could try something like this, with pybel:
#!/usr/bin/env python
import sys
import pybel
# ref :
# O=C(NCCCC1CCCC1)c1cccc(c1)C(=O)N moldId
substruct = "NC=O"
substructSmart = pybel.Smarts(substruct)
for mol in pybel.readfile("smi", sys.argv[1]):
subtructCount = len(substructSmart.findall(mol)) # That's the data
you're wanting
print substruct, ":", subtructCount, "in", mol.OBMol.GetTitle()
Output:
NC=O : 2 in molId
Is it ok for you?
Regards,
Pascal
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss