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

Filter results by SMIRKS or other chemical descriptors #43

Closed
mattwthompson opened this issue May 6, 2024 · 3 comments
Closed

Filter results by SMIRKS or other chemical descriptors #43

mattwthompson opened this issue May 6, 2024 · 3 comments

Comments

@mattwthompson
Copy link
Member

No description provided.

@mattwthompson
Copy link
Member Author

In #44 I have a proposal that adds a couple of functions that return lists of IDs which can then be fed through to the various MoleculeStore.get_x methods. The idea is something like

In [20]: store.get_dde('openff-2.1.0', molecule_ids=store.filter_by_smirks("[#6]#[#6]"))
Out[20]:
[DDE(qcarchive_id=37016444, force_field='openff-2.1.0', difference=-5.333306021926276e-06),
 DDE(qcarchive_id=37016445, force_field='openff-2.1.0', difference=-0.6762625367734985),
 DDE(qcarchive_id=37016446, force_field='openff-2.1.0', difference=nan)]

In [21]: from yammbs.checkmol import ChemicalEnvironment

In [22]: store.get_rmsd('openff-2.1.0', molecule_ids=store.filter_by_checkmol(ChemicalEnvironment.Alkyne))
Out[22]:
[RMSD(qcarchive_id=37015996, force_field='openff-2.1.0', rmsd=0.7047817362519956),
 RMSD(qcarchive_id=37016945, force_field='openff-2.1.0', rmsd=0.022691976546048032),
 RMSD(qcarchive_id=37016286, force_field='openff-2.1.0', rmsd=0.03265649619028413),
 RMSD(qcarchive_id=37016444, force_field='openff-2.1.0', rmsd=0.009567076814051558),
 RMSD(qcarchive_id=37016445, force_field='openff-2.1.0', rmsd=0.009781303169628252),
 RMSD(qcarchive_id=37016446, force_field='openff-2.1.0', rmsd=0.00955735978797403)]

In [23]: [store.get_smiles_by_molecule_id(store.get_molecule_id_by_qcarchive_id(id_)) for id_ in [37015996, 37016945, 37016286]
    ...: ]
Out[23]:
['[H:15][c:3]1[c:5]([c:9]([c:13]([c:10]([c:6]1[H:18])[H:22])[C:1]#[C:2][c:14]2[c:11]([c:7]([c:4]([c:8]([c:12]2[H:24])[H:20])[H:16])[H:19])[H:23])[H:21])[H:17]',
 '[H:7][C:3]#[C:1][C:2]([H:4])([H:5])[H:6]',
 '[H:8][C:3]#[C:1][C:2](=[C:4]([H:6])[H:7])[H:5]']

I'm not sure why the results are different; the molecules missing from the first query sure like like alkynes to me:

image

@mattwthompson
Copy link
Member Author

It would be worth adding atom tags to the SMIRKS pattern above (even though I'm pretty sure the toolkit just passes them through as SMARTS to RDKit/OEChem?). Otherwise the funkiness might be due to aromaticity

@mattwthompson
Copy link
Member Author

@ntBre noticed that this comparison has two differences - DDE vs RMSD in addition to Checkmol/SMARTS filtering. Being consistent with either produces results one expects. Thanks Brent!

In [3]: store = MoleculeStore("yammbs/_tests/data/ch.sqlite")

In [4]: store.get_dde('openff-2.1.0', molecule_ids=store.filter_by_checkmol(ChemicalEnvironment.Alky
   ...: ne))
Out[4]:
[DDE(qcarchive_id=37016444, force_field='openff-2.1.0', difference=-5.333306021926276e-06),
 DDE(qcarchive_id=37016445, force_field='openff-2.1.0', difference=-0.6762625367734985),
 DDE(qcarchive_id=37016446, force_field='openff-2.1.0', difference=nan)]

In [5]: store.get_dde('openff-2.1.0', molecule_ids=store.filter_by_smirks("[#6]#[#6]"))
Out[5]:
[DDE(qcarchive_id=37016444, force_field='openff-2.1.0', difference=-5.333306021926276e-06),
 DDE(qcarchive_id=37016445, force_field='openff-2.1.0', difference=-0.6762625367734985),
 DDE(qcarchive_id=37016446, force_field='openff-2.1.0', difference=nan)]

In [6]: store.get_rmsd('openff-2.1.0', molecule_ids=store.filter_by_smirks("[#6]#[#6]"))
Out[6]:
[RMSD(qcarchive_id=37015996, force_field='openff-2.1.0', rmsd=0.7047817362519956),
 RMSD(qcarchive_id=37016945, force_field='openff-2.1.0', rmsd=0.022691976546048032),
 RMSD(qcarchive_id=37016286, force_field='openff-2.1.0', rmsd=0.03265649619028413),
 RMSD(qcarchive_id=37016444, force_field='openff-2.1.0', rmsd=0.009567076814051558),
 RMSD(qcarchive_id=37016445, force_field='openff-2.1.0', rmsd=0.009781303169628252),
 RMSD(qcarchive_id=37016446, force_field='openff-2.1.0', rmsd=0.00955735978797403)]

In [7]: store.get_rmsd('openff-2.1.0', molecule_ids=store.filter_by_checkmol(ChemicalEnvironment.Alk
   ...: yne))
Out[7]:
[RMSD(qcarchive_id=37015996, force_field='openff-2.1.0', rmsd=0.7047817362519956),
 RMSD(qcarchive_id=37016945, force_field='openff-2.1.0', rmsd=0.022691976546048032),
 RMSD(qcarchive_id=37016286, force_field='openff-2.1.0', rmsd=0.03265649619028413),
 RMSD(qcarchive_id=37016444, force_field='openff-2.1.0', rmsd=0.009567076814051558),
 RMSD(qcarchive_id=37016445, force_field='openff-2.1.0', rmsd=0.009781303169628252),
 RMSD(qcarchive_id=37016446, force_field='openff-2.1.0', rmsd=0.00955735978797403)]

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

No branches or pull requests

1 participant