Hi all,

In my simple world, a molecule is just a graph with nodes corresponding
to atomic numbers, while the edges are either single, double, or triple
(no aromatic bindings). My graph miner reads in molecules as

OBAtomIterator atom;
mol.BeginAtom(atom);
do {
        InputNodeLabel inputnodelabel = (*atom)->GetAtomicNum();
} while (mol.NextAtom(atom));

Similar for the edges, i.e. bondorder = (*bond)->GetBondOrder(); It then
computes all fragments from the graphs that adhere to certain
conditions, such as minimum frequency.

Now, I want to match the found fragments back to (a subset of) the
molecules, e.g.:
m: n1(c2ccccc2)n(c(C)cc1=O)C
f: [#6]-[#6](=[#6]-[#6]-[#7]-[#6])(-[#7])
The example above won't match back to the molecule, although my graph
mining application has found f as a subgraph of m. I use this code (in
ruby) to match back:

c=OpenBabel::OBConversion.new
c.set_in_format 'smi'
m=OpenBabel::OBMol.new
c.read_string m, "n1(c2ccccc2)n(c(C)cc1=O)C"
m.set_aromatic_perceived             # seems necessary: Without
m.set_aromatic_perceived, even such simple examples as m = c1ccccc1 and
f = [#6]=[#6] won't match.
p=OpenBabel::OBSmartsPattern.new
if !p.init("[#6]-[#6](=[#6]-[#6]-[#7]-[#6])(-[#7])")
    puts "Error! Smarts pattern invalid."
    exit
end
p.match(m)

My problem is: the last line returns 'false'. What is the problem here?

Greetings
Andreas

Here is a depiction of the molecule:
http://www.daylight.com/daycgi/depict?6e31286332636363636332296e28632843296363313d4f2943

-- 
http://www.maunz.de
OpenPGP key: http://www.maunz.de/[email protected]_pub.asc

             Warning: dates in calendar are closer than they appear

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
OpenBabel-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to