On Jul 1, 2017, at 17:19, Changge Ji 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
'[#6]1:[#6]:[#8]:[#6]:[#7]:1'?
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 "", line 1, in
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("n1c2c2oc1")
>>> 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',
completed=1)
>>> mcs_smarts = MCS.FindMCS([benzoxazole, sulfamoxole, zoxazolamine]).smarts
>>> mcs_smarts
'[#6]:1:[#6]:[#6]:[#6]:[#6]:[#6]:1'
Here's an example of using it:
>>> mcs_pat = Chem.MolFromSmarts(mcs_smarts)
>>> benoxaprofen.HasSubstructMatch(mcs_pat)
True
There is no need to do an explicit SanitizeMol().
Best regards,
Andrew
da...@dalkescientific.com
--
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
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss