On 24/03/2011 16:22, Izhar Wallach wrote:
> Hi,
>
> I'm wondering what is the reason that the 'Match' method in the
> 'OBSmartsPattern' class automatically adds hydrogens to a molecule if the
> SMARTS pattern has a hydrogen in it.
> It seems to me that this hidden addition of hydrogens has a couple
> limitations:
> First, the indices that the 'GetUMapList' method reruns may be wrong with
> respect to the query molecule. This is particularly problematic if one wants
> to map the indices back to the atoms in the query molecule.
> Second, it modifies the input molecule such that for example checking for
> patterns under different PH conditions is hard.

The reason is so that SMARTS [C]([H])([H])([H])[H]  matches SMILES C and 
not SMILES CC.

The code in OBSmartsPattern::Match(OBMol &mol,bool single) is

     if(_pat->hasExplicitH) //The SMARTS pattern contains [H]
       {
         //Do matching on a copy of mol with explict hydrogens
         OBMol tmol = mol;
         tmol.AddHydrogens(false,false);
         return(matcher.match(tmol,_pat,_mlist,single));
       }
The code in the other version of Match() is similar.

Looking at this code it would seem that
a) it is a _copy_ of the input molecule that is modified (as the comment 
says)
b) the hydrogens will be added with atom indices larger than any of the 
existing atoms, the indices of which will not be changed. GetUMapList() 
may return indices that were not in the original molecule, but they will 
be hydrogens.

Do you find in practice that this (theoretical) interpretation does not 
apply?

If the explicit H in the SMARTS pattern is '#1', OBSmartsPattern does 
not add explicit H to the molecule. In the development code (for v2.3.1) 
the -s option on the command-line now does add it. See the thread 
started by by Fredrik Wallner on the Openbabel-Discuss list on 15 Nov 2010.

Chris

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to