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

add rdkit2oechem atommapper wrapper #24

Closed
richardjgowers opened this issue Jan 25, 2022 · 6 comments
Closed

add rdkit2oechem atommapper wrapper #24

richardjgowers opened this issue Jan 25, 2022 · 6 comments
Assignees

Comments

@richardjgowers
Copy link
Contributor

No description provided.

@IAlibay
Copy link
Contributor

IAlibay commented Jan 31, 2022

So as far as I see it, there are two things that need implementing here right?

  1. A method to convert rdkit molecules to oechem OEGraphMol
  2. A means of mapping back atom indices between the two

@mikemhenry
Copy link
Contributor

Maybe this was already linked, but here is a notebook that goes into point 1

https://gist.github.com/bannanc/810ccc4636b930a4522636baab1965a6

@IAlibay
Copy link
Contributor

IAlibay commented Feb 1, 2022

+1 we pinged the author today and they were ok to get it out under MIT.

They did point out that maybe it'd be better long term to leverage the openff code paths for this (since that notebook was exploratory work for that). I think we could do rdkit -> OpenFF -> oechem with minimal code (adds an extra optional dependency but I think long term we'd need it anyways)

@IAlibay
Copy link
Contributor

IAlibay commented Feb 1, 2022

I'm going to bump up the priority to medium here since I'm pretty sure it's necessary to get perses mappers working (we could just send through the original smiles / mol file, but we need to have a mapping between the oechem object and the rdkit molecule).

So I thought would have been possible to just rely on openff tk here and avoid spending time on this, but the issue is that we need to keep the mapping on the rdkit <-> oechem transforms so that we can use that to swap around atom mappings come out of things like perses.

i.e. what I'm thinking of is the following:

def rdkit_to_oechem(rdmol):
  ... create an oechem molecule from scratch and populate it with the rdkit molecule stuff
  return OEmol rdkit_to_oechem_mapping

@richardjgowers
Copy link
Contributor Author

In my mind we could do this with a decorator which intercepts rdkit molecules and converts the args, then sniffs outputs of the function it is wrapping and remaps and AtomMapping classes? Then theoretically any OEChem atommapper works as expected if we slap on the decorator...

@IAlibay
Copy link
Contributor

IAlibay commented Feb 1, 2022

I think so, you'd need to set it up to store the atom index map between the two objects on the way in and remap on the way out?

i.e.

def _remap(alchemical_map, transform_dictionary):
  return remapped_alchemical_map

def perses_mapper(rdkitmol, foo, bar):
   oemol, rd_to_oe_map = rkdit_to_oechem(rdkitmol)
   alchemical_atom_map = _perses_mapper(oemol) 
   return AtomMapping(_remap(alchemical_atom_map, rd_to_oe_map))

You can make it fancy with a decorator once that works I guess?

@IAlibay IAlibay self-assigned this Feb 1, 2022
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

3 participants