It would be useful to show the molecules you expect to be matched and 
those which you expect not to be matched. But I suppose that you want to 
distinguish the molecules whose SMILES are c1ccccc1N and c1ccccc1N(C)C .

The SMARTS c1ccccc1N matches both these molecules but c1ccccc1[NH2] or 
c1ccccc1N([H])[H] matches only the first, when used like

   obabel -:"c1ccccc1N" -:"c1ccccc1N(C)C" -osmi -s"c1ccccc1N([H])[H]"

Conversion of any format to SMILES in OpenBabel will produce a string 
with 'explicit' hydrogen if the -xh option ('Output explicit hydrogens 
as such') is used.

   obabel -:C1=CC=CC=C1[NH2] -osmi -xh
   c1ccccc1[NH2]
   1 molecule converted

You can see the Kekule form is also converted to the aromatic form that 
is needed when used as SMARTS.

Fastsearch works ok when an explicit H form of SMILES is used as a query 
SMARTS, because although its is converted to SMILES in the first 
fingerprint phase and loses its explicit H, the original SMARTS form is 
used in the second phase. This does not apply when the query is a 
molecule in a file, although I can see a small modification (not yet 
made) that would make it so.

So it looks as if all you need is an extra OpenBabel conversion step.

Thank you for raising this issue.

(Note that obabel rather than babel is preferred. Note also that 
OpenBabel is unclear about the exact meaning of 'explicit' with respect 
to hydrogen, but the above works ok for the non-religious.)

Chris

On 08/01/2013 06:21, shanghq...@hotmail.com wrote:
> Dear member,
> Could someone please give me some advices about this problem?
> Thanks.
> Shang
> *From:* shanghq...@hotmail.com <mailto:shanghq...@hotmail.com>
> *Date:* 2013-01-05 09:45
> *To:* Craig James <mailto:cja...@emolecules.com>; openbabel-discuss
> <mailto:openbabel-discuss@lists.sourceforge.net>
> *CC:* yuecaili <mailto:yueca...@gmail.com>
> *Subject:* Re: [Open Babel] substructure search problem
> Hi All,
> Thanks for Craig's quick response.
> I want to build a compound registration system with openbabel and
> Chemdraw (used as molecule edtior) . The problem I encountered was that
> when I draw the following two molecules as substructure query, the
> system returned the same result.
> Although these two molecules are the same actually, I think their
> substructure search result should be different.
> I have tried the following three kinds of command lines:
> 1) babel chem.fs -Squery.mol result.smi
> 2) babel chem.fs -s'[H]N([H])C1=CC=CC=C1' result.smi
> 3) babel chem.fs -s'[H]N([H])c1ccccc1' result.smi
> Command 1 could work but returned the same result.  I have examined this
> command and found that both molecule 1 and 2 are converted to the same
> aromatic form:Nc1ccccc1. I think this is the reason of the same search
> result.
> Command 2 could not work  (The reason should be what you said in the
> last email)
> Command 3 could work and give the right result, but another problem is
> that Chemdraw can only generate the Kekule SMILES like
> "[H]N([H])C1=CC=CC=C1" . If I convert it to aromatic form, the form will
> be "Nc1ccccc1", the "H" will be lost.
> It is strange that when I use molecule 3 as a query, openbabel can
> convert it to aromatic form: c1cccc(c1)[NH]. and give the correct search
> result.
> So It is seems that something wrong happened in the process of
> convertion. I would like to know what the problem is and how I could
> convert the mol format or Kekule SMILES to aromatic form correctly.
> Thanks & Best regards,
> Shang
> ------------------------------------------------------------------------
> shanghq...@hotmail.com
> *From:* Craig James <mailto:cja...@emolecules.com>
> *Date:* 2013-01-04 03:13
> *To:* shanghq...@hotmail.com <mailto:shanghq...@hotmail.com>;
> OpenBabel-discuss <mailto:OpenBabel-discuss@lists.sourceforge.net>
> *Subject:* Re: [Open Babel] substructure search problem
>
>
> On Fri, Jan 4, 2013 at 4:25 AM, shanghq...@hotmail.com
> <mailto:shanghq...@hotmail.com> <shanghq...@hotmail.com
> <mailto:shanghq...@hotmail.com>> wrote:
>
>     __
>     Dear All,
>     I am using Openbabel to search substructure in my database. I found
>     that when I converted the following two Kekule SMILES
>     (1,2) generated by Chemdraw to aromatic form with Openbabel, I got
>     the same result:Nc1ccccc1
>     1) NC1=CC=CC=C1
>     2) [H]N([H])C2=CC=CC=C2
>     but I think their aromatic form should be Nc1ccccc1 and
>     [H]N([H])c1ccccc1, only then the substructure search result is
>     right. Could anyone tell me what the problem is? how can I solve
>     this problem. Thanks,
>
>
> You haven't given enough details.  What does "search substructure in my
> database" mean?  Are you using a babel command, or some other commercial
> or open-source database?  If it's a babel command, what is the exact
> command you are using?
>
> I suspect the problem is that you're confusing SMARTS and SMILES.  As
> SMILES, the Kekule and aromatic forms are equivalent.  But as SMARTS
> (which is how substructure searches are interpreted), they are not the
> same.  A Kekule form of the molecule generally won't find anything in a
> substructure search.
>
> Craig
>
>     Best regards,
>     Shang
>     ------------------------------------------------------------------------
>     shanghq...@hotmail.com <mailto:shanghq...@hotmail.com>
>
>     
> ------------------------------------------------------------------------------
>     Master Visual Studio, SharePoint, SQL, ASP.NET <http://ASP.NET>, C#
>     2012, HTML5, CSS,
>     MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>     with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>     MVPs and experts. ON SALE this month only -- learn more at:
>     http://p.sf.net/sfu/learnmore_122712
>     _______________________________________________
>     OpenBabel-discuss mailing list
>     OpenBabel-discuss@lists.sourceforge.net
>     <mailto:OpenBabel-discuss@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
>
>
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
>
>
>
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to