On Jul 1, 2017, at 17:19, Changge Ji <chicago...@gmail.com> wrote:
> I want to do some substructure match using MCS.
> It seems that Sanitize is needed for MCS.
> I met with the over valance error when using sanitize for some molecules.
> Like the following one :
> --------------------------------
> sa = Chem.MolFromSmiles('c1cocn1')
> sa =Chem.MolFromSmarts(Chem.MolToSmarts(sa))
> Chem.SanitizeMol(sa)
> ----------------------------------
> The error info says that Explicit valence for O is greater than permitted.
> Since I need to use smarts derived from MCS analysis, I can't use 
> Chem.MolFromSmiles(mol,kekuleSmiles=True).

I don't understand what you are doing. Where is the MCS?

Why do you take the oxazole SMILES and turn it into the SMARTS 

Why do you think you need to sanitize the MCS?

The result from MolFromSmarts isn't a chemical molecule, and it's not generally 
possible to do a SanitizeMol() on it. For example, the following fails:

>>> mol = Chem.MolFromSmarts("ccO")
>>> Chem.SanitizeMol(mol)
[23:26:28] non-ring atom 0 marked aromatic
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Sanitization error: non-ring atom 0 marked aromatic

Finally, I think you mean Chem.MolToSmiles() at the end. But I can't figure out 
why you need that.

Here's an example of how to get the MCS using the RDKit:

>>> from rdkit import Chem
>>> from rdkit.Chem import MCS
>>> benzoxazole = Chem.MolFromSmiles("n1c2ccccc2oc1")
>>> sulfamoxole = Chem.MolFromSmiles("O=S(=O)(Nc1nc(c(o1)C)C)c2ccc(N)cc2")
>>> zoxazolamine = Chem.MolFromSmiles("C1=CC2=C(C=C1Cl)N=C(O2)N")
>>> MCS.FindMCS([benzoxazole, sulfamoxole, zoxazolamine])
MCSResult(numAtoms=6, numBonds=6, smarts='[#6]:1:[#6]:[#6]:[#6]:[#6]:[#6]:1', 
>>> mcs_smarts = MCS.FindMCS([benzoxazole, sulfamoxole, zoxazolamine]).smarts
>>> mcs_smarts

Here's an example of using it:

>>> mcs_pat = Chem.MolFromSmarts(mcs_smarts)
>>> benoxaprofen.HasSubstructMatch(mcs_pat)

There is no need to do an explicit SanitizeMol().

Best regards,


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Rdkit-discuss mailing list

Reply via email to