[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

something related to the completeAromaticRings in rdRascalMCES #7997

Closed
rongfengzou opened this issue Nov 11, 2024 · 1 comment
Closed

something related to the completeAromaticRings in rdRascalMCES #7997

rongfengzou opened this issue Nov 11, 2024 · 1 comment
Labels

Comments

@rongfengzou
Copy link

I ran a test code here
`from rdkit import Chem
from rdkit.Chem import rdRascalMCES
from rdkit.Chem import rdFMCS

test_mol1 = Chem.MolFromSmiles('C1=COC=C1')
test_mol2 = Chem.MolFromSmarts('C1=CC=CC=C1')

rascal_opts = rdRascalMCES.RascalOptions()
rascal_opts.completeAromaticRings = False
rascal_opts.ringMatchesRingOnly = False

results = rdRascalMCES.FindMCES(test_mol1, test_mol2, rascal_opts)
print(f'Number of MCESs found : {len(results)}')

mcs = rdFMCS.FindMCS([test_mol1, test_mol2],
atomCompare=rdFMCS.AtomCompare.CompareElements,
bondCompare=rdFMCS.BondCompare.CompareOrder,
completeRingsOnly=False,
ringMatchesRingOnly=False,
timeout=120)
mcs_mol = Chem.MolFromSmarts(mcs.smartsString)
print(f'MCS SMARTS : {mcs.smartsString}')`

I thought both rdRascalMCES and rdFMCS will return mcs, but the result is that:
Number of MCESs found : 0
MCS SMARTS : [#6]:,-[#6]

Is that correct for rdRascalMCES?

@DavidACosgrove
Copy link
Collaborator

Hi @rongfengzou. There are a couple of issues here. The key one is that test_mol2 is generated using MolFromSmarts() rather than MolFromSmiles(). This means that the molecule is not Kekulized so the bonds remain as single and double. test_mol1 is created via MolFromSmiles() so the bonds are changed to aromatic. RASCAL finds matching bonds between molecules, and there are none in this case.
If you change the creation of test_mol2 to also use MolFromSmiles() you still get no matches. The reason for this is that RASCAL uses a similarity threshold, default 0.7, and won't do the search if it calculates that the similarity will be lower than that. The similarity is essentially the number of atoms and bonds in the MCES as a proportion of the number of atoms and bonds in the input structures. With small molecules, it only takes 1 or 2 bonds not to be in common for the similarity to be very much reduced.

from rdkit import Chem
from rdkit.Chem import rdRascalMCES
from rdkit.Chem import rdFMCS

test_mol1 = Chem.MolFromSmiles('C1=COC=C1')
test_mol2 = Chem.MolFromSmiles('C1=CC=CC=C1')

rascal_opts = rdRascalMCES.RascalOptions()
rascal_opts.completeAromaticRings = False
rascal_opts.ringMatchesRingOnly = False
rascal_opts.returnEmptyMCES = True
rascal_opts.similarityThreshold = 0.1

results = rdRascalMCES.FindMCES(test_mol1, test_mol2, rascal_opts)
print(f'Number of MCESs found : {len(results)}')
print(results[0].tier1Sim, results[0].tier2Sim)
print(results[0].atomMatches(), results[0].smartsString, results[0].similarity)

mcs = rdFMCS.FindMCS([test_mol1, test_mol2],
atomCompare=rdFMCS.AtomCompare.CompareElements,
bondCompare=rdFMCS.BondCompare.CompareOrder,
completeRingsOnly=False,
ringMatchesRingOnly=False,
timeout=120)
mcs_mol = Chem.MolFromSmarts(mcs.smartsString)
print(f'MCS SMARTS : {mcs.smartsString}')

produces

Number of MCESs found : 1
0.5333333333333333 0.4083333333333333
[(0, 0), (1, 1), (3, 4), (4, 5)] c(:c):c:c 0.4083333333333333
MCS SMARTS : [#6](:[#6]):[#6]:[#6]

which is probably more what you want. The RASCAL option returnEmptyMCES is useful in cases where no results are returned as it will allow you to see the tier1 and tier2 similarities which will probably tell you that the threshold has not been met for the full search to be performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants