Re: [Open Babel] generate a smarts with explicit H

2011-01-28 Thread Andrew Dalke
On Jan 28, 2011, at 3:06 AM, Craig A. James wrote: > However, OpenBabel seems to fall flat on SMARTS like this: [CH2,CH3,CH4] > > $ echo "OCO" | obgrep '[CH2,CH3,CH4]' > $ echo "O[CH2]O" | obgrep '[CH2,CH3,CH4]' > OCO > > Both of these should return the same answer since the input molecule

Re: [Open Babel] generate a smarts with explicit H

2011-01-28 Thread Pascal Muller
Dear all, I want to thank you again: combining Andrew and Craig answer, I was able to go a step further and convert e.g. a urea into : [CH3][CH2][C,N,O][C,N,O][C,N,O] which is exactly the kind of smarts I wanted for my analogs search. At least at this stage of my reflexion :) Regards, Pascal -

Re: [Open Babel] generate a smarts with explicit H

2011-01-27 Thread Craig A. James
> On Jan 26, 2011, at 11:54 AM, Chris Morley wrote: > As may have been discussed here earlier, maybe this option should output > explicit hydrogen as [H] rather than a hydrogen count on another atom. > SMARTS [CH2] matches a C with exactly two Hs; SMARTS [H]C[H] will match a > carbon with at lea

Re: [Open Babel] generate a smarts with explicit H

2011-01-27 Thread Pascal Muller
Dear all, Thanks for your answers! I have no objection to Chris' code modification proposal. With Craig's suggestion and Noel's blog (so useful for code inspiration (plagiarism...) - at least for me :), I got this working with pybel: conv = ob.OBConversion() conv.SetInAndOutFormats("smi", "can"

Re: [Open Babel] generate a smarts with explicit H

2011-01-26 Thread Andrew Dalke
On Jan 26, 2011, at 11:54 AM, Chris Morley wrote: > As may have been discussed here earlier, maybe this option should output > explicit hydrogen as [H] rather than a hydrogen count on another atom. > SMARTS [CH2] matches a C with exactly two Hs; SMARTS [H]C[H] will match a > carbon with at leas

Re: [Open Babel] generate a smarts with explicit H

2011-01-26 Thread Chris Morley
On 26/01/2011 01:16, Craig A. James wrote: On 1/25/11 3:33 PM, Andrew Dalke wrote: On Jan 25, 2011, at 4:01 PM, Pascal Muller wrote: Using pybel, I would like to generate a smarts with explicit H before doing a substructure search. ... scaffoldSmiles = mol.write("can") scaffoldSmarts = p

Re: [Open Babel] generate a smarts with explicit H

2011-01-25 Thread Craig A. James
On 1/25/11 3:33 PM, Andrew Dalke wrote: > On Jan 25, 2011, at 4:01 PM, Pascal Muller wrote: >> Using pybel, I would like to generate a smarts with explicit H before >> doing a substructure search. > > ... >> scaffoldSmiles = mol.write("can") >> scaffoldSmarts = pybel.Smarts(scaffoldSmiles) > >

Re: [Open Babel] generate a smarts with explicit H

2011-01-25 Thread Andrew Dalke
On Jan 25, 2011, at 4:01 PM, Pascal Muller wrote: > Using pybel, I would like to generate a smarts with explicit H before > doing a substructure search. ... > scaffoldSmiles = mol.write("can") > scaffoldSmarts = pybel.Smarts(scaffoldSmiles) The problem is this the write("can") step. It convert

[Open Babel] generate a smarts with explicit H

2011-01-25 Thread Pascal Muller
Dear all, Using pybel, I would like to generate a smarts with explicit H before doing a substructure search. Actually, I'm seeking analogs of a reference molecule - let's say HO-CH2-NH2. I want to keep the HO-CH2 part (the "scaffold"). I delete the NH2 and generate the smarts for HO-CH2 (and I ho