Hi,

The problem is connected with the lack of explicit Hs in the aromatic
version of the SMILES. The general rule is that if an aromatic heteroatom
needs to have an H on it in order for the valence to make sense, then you
need to include that in the SMILES. This does not hold when you express the
SMILES in Kekule form (your second example), where the H counts are clear.

Here's an example:

In [2]: m = Chem.MolFromSmiles('[nH]1c(=O)[nH]c(=O)cc1')

In [3]: Chem.MolToSmiles(m)
Out[3]: 'O=c1cc[nH]c(=O)[nH]1'

In [4]: m = Chem.MolFromSmiles('N1C(=O)NC(=O)C=C1')

In [5]: Chem.MolToSmiles(m)
Out[5]: 'O=c1cc[nH]c(=O)[nH]1'

I hope this helps,
-greg





On Thu, Aug 4, 2016 at 5:13 AM, macbook <monicacul...@126.com> wrote:

> Dear all,
>
> There are several  questions I want to ask for help.
>
> 1. When I read a molecular by  MolFromSmiles and MolFromSmarts,it  throw
> an exception,As shown below , the molecule “n1c(=O)nc(=O)cc1” can’t be read
> by MolFromSmiles while MolFromSmarts work well.So what the difference
> between MolFromSmiles and MolFromSmarts when read a molecular smiles?( I
> still expect MolFromSmarts is compatible with MolFromSmile and more
> advanced.)
>
> 2.The smiles “n1c(=O)nc(=O)cc1” and “N1C(=O)NC(=O)C=C1” is two kinds of
> ways to write the structure,when I use the HasSubStructureMatch test it ,I
> expect the one is contained within the other,but the result is  inconsistent
> with my expect, I just want to know why? Did I misunderstand this function?
>
> >>> mfsmi *=* AllChem*.*MolFromSmiles
> >>> mfsma *=* AllChem*.*MolFromSmarts
> >>> asub *=* mfsma("n1c(=O)nc(=O)cc1")
> >>> a *=* mfsmi("n1c(=O)nc(=O)cc1")
> >>> a1 *=* mfsma("n1c(=O)nc(=O)cc1")
> >>> a*.*HasSubstructureMatch(asub)
> Traceback (most recent call last):
>   File "<input>", line *1*, in <module>
>     a.HasSubstructureMatch(asub)
> *AttributeError*: 'NoneType' object has no attribute
> 'HasSubstructureMatch'
> >>> a1*.*HasSubstructMatch(asub)
> True
> >>> bsub *=* mfsma("N1C(=O)NC(=O)C=C1")
> >>> b *=* mfsmi("N1C(=O)NC(=O)C=C1")
> >>> b1 *=* mfsma("N1C(=O)NC(=O)C=C1")
> >>> b*.*HasSubstructMatch(bsub)
> False
> >>> b1*.*HasSubstructMatch(bsub)
> True
> >>> a1*.*HasSubstructMatch(bsub)
> False
> >>> b*.*HasSubstructMatch(asub)
> True
> >>> b1*.*HasSubstructMatch(asub)
> False
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to