Hi Suzanne,

The current release creates an explicit hydrogen atom where there is a H
within square brackets in the SMILES; this "feature" has been removed in
the development version. So, right now, where you are reading from SMILES
you will need to call DeleteHydrogens() so at least the constitutional
match is obtained.

But it seems like the isomorphism matcher is not respecting stereo in any
case. I'll look into it some more. I think it's a case of an unimplemented
feature, rather than a bug, but we should definitely add it if that's the
case.

Regards,
- Noel

On 13 March 2018 at 20:45, Susanne Salzmann <susanne.salzm...@basf.com>
wrote:

> Hello,
>
>
>
> I’ve been trying around with OBIsomorphismMapper and Stereochemistry. (See
> python code below)
>
>
>
> I’ve been using the stereochemically unspecified Smiles as well as Smiles
> with explicit stereocenter definition.
>
> When you look at the scripts output you see that CC(Cl)CCC and CCC[C@@H](Cl)C
> are no match, however,
>
> CCC[C@@H](Cl)C and CC(Cl)CCC as well as CCC[C@H](Cl)C and CCC[C@@H](Cl)C
>
> are found to be isomorphs. Can I make my code respect different
> stereochemistry?
>
>
>
> Many thanks,
>
> Susan
>
>
>
> No OBBuilder: CC(Cl)CCC CC(Cl)CCC 6
>
> No OBBuilder: CC(Cl)CCC CCC[C@@H](Cl)C 0
>
> No OBBuilder: CC(Cl)CCC CCC[C@H](Cl)C 0
>
> No OBBuilder: CCC[C@@H](Cl)C CC(Cl)CCC 6
>
> No OBBuilder: CCC[C@@H](Cl)C CCC[C@@H](Cl)C 7
>
> No OBBuilder: CCC[C@@H](Cl)C CCC[C@H](Cl)C 7
>
> No OBBuilder: CCC[C@H](Cl)C CC(Cl)CCC 6
>
> No OBBuilder: CCC[C@H](Cl)C CCC[C@@H](Cl)C 7
>
> No OBBuilder: CCC[C@H](Cl)C CCC[C@H](Cl)C 7
>
> OBuilder: CC(Cl)CCC CC(Cl)CCC smiles: 6 OBMol: 17
>
> OBuilder: CC(Cl)CCC CCC[C@@H](Cl)C smiles: 7 OBMol: 17
>
> OBuilder: CC(Cl)CCC CCC[C@H](Cl)C smiles: 7 OBMol: 17
>
> OBuilder: CCC[C@@H](Cl)C CC(Cl)CCC smiles: 6 OBMol: 17
>
> OBuilder: CCC[C@@H](Cl)C CCC[C@@H](Cl)C smiles: 7 OBMol: 17
>
> OBuilder: CCC[C@@H](Cl)C CCC[C@H](Cl)C smiles: 7 OBMol: 17
>
> OBuilder: CCC[C@H](Cl)C CC(Cl)CCC smiles: 6 OBMol: 17
>
> OBuilder: CCC[C@H](Cl)C CCC[C@@H](Cl)C smiles: 7 OBMol: 17
>
> OBuilder: CCC[C@H](Cl)C CCC[C@H](Cl)C smiles: 7 OBMol: 17
>
>
>
>
>
>
>
>
>
> #### Python code ####
>
>
>
> def getQuery(mol):
>     if isinstance(mol, ob.OBMol):
>         query = ob.CompileMoleculeQuery(mol)
>     elif isinstance(mol, str):
>         query = ob.CompileSmilesQuery(mol)
>     else:
>         raise TypeError("Unsupported type in input molecule: "+type(mol))
>     return query
>
> def simpleSearch(probe,ref):
>     query = getQuery(ref)
>     isomapper = ob.OBIsomorphismMapper.GetInstance(query)
>     isomorph = ob.vpairUIntUInt()
>     isomapper.MapFirst(probe, isomorph)
>     return isomorph
>
> if __name__=="__main__":
>     builder = ob.OBBuilder()
>     conv = ob.OBConversion()
>     conv.SetInFormat("smi")
>     smiles = ["CC(Cl)CCC", "CCC[C@@H](Cl)C", "CCC[C@H](Cl)C" ]
>     mols = []
>     for smi in smiles:
>         mol = None
>         mol = ob.OBMol()
>         smilesOK = conv.ReadString(mol, smi)
>         for mis in smiles:
>             print("No OBBuilder:", smi, mis, len(simpleSearch(mol, mis)))
>
>         if smilesOK:
>             builder.Build(mol)
>             mol.AddHydrogens()
>             mols.append(mol)
>
>     for m,mol in enumerate(mols):
>         for s,smi in enumerate(smiles):
>             print("OBuilder:", smiles[m], smi, "smiles:", 
> len(simpleSearch(mol, smi)), "OBMol:", len(simpleSearch(mol, mols[s])))
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to