rdkit / RDKitjs-legacy

Obsolete codebase, please do not use.
BSD 3-Clause "New" or "Revised" License
32 stars 12 forks source link

Substructure/similarity search functions? #18

Open flatkinson opened 6 years ago

flatkinson commented 6 years ago

I might be missing something, but the substructure and similarity functionality does not seem to be exposed in the current version of RDKitjs (it was accessible in the old version). Do you have plans to add this in the near future?

virago-bot commented 6 years ago

Dear Francis,

The new implementation is based on the rdkit project. We have not fix the final nomenclature so we are in a transition phase.

Michael, Greg we should decide next steps asap.

Best regards,

Dr. Guillaume Godin

Le 4 juil. 2018 à 16:34, Francis Atkinson notifications@github.com<mailto:notifications@github.com> a écrit :

I might be missing something, but the substructure and similarity functionality does not seem to be exposed in the current version of RDKitjs (it was accessible in the old version). Do you have plans to add this in the near future?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/cheminfo/RDKitjs/issues/18, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALmofKe8degZgMH5T_00RNh59Csu-FRsks5uDNJ7gaJpZM4VCr62.


DISCLAIMER
This email and any files transmitted with it, including replies and forwarded copies (which may contain alterations) subsequently transmitted from Firmenich, are confidential and solely for the use of the intended recipient. The contents do not represent the opinion of Firmenich except to the extent that it relates to their official business.


flatkinson commented 6 years ago

Guillaume,

Please allow me to rephrase my original question, as I'm not sure it was clear what I was asking. The problem is that my C++ is limited and I haven't been able to work out the answer to my question by browsing the source code.

So: when using the RDKit from Python, I can instantiate a molecule object which has, for example, a HasSubstructMatch method. This is handled by a layer of Python code that wraps a native RDKit C++ object and associated methods. Where this wrapping is not done, the functionality provided by C++ is not available from Python.

Similarly, the Emscripten toolchain compiles all of the RDKit C++ source to WASM, so all objects/methods in C++ RDKit are potentially available from JavaScript. However, for a given C++/WASN method to be accessible from JavaScript, there needs to be a wrapping step, similar to what is done in Python. So far, your team has, done this wrapping manually for some RDKit C++ objects/methods, but not all, and that, where the wrapping has not yet been done, the functionality is not accessible. Thus, at the moment, there is no RDKitjs equivalent of the HasSubstructMatch/GetSubstructMatches methods, and RDKit-based substructure-searching is not yet available from JavaScript. Is my understanding correct?

The other possibility I've considered is that the wrapping is more for convenience, and that all the RDKit functionality is available from JavaScript, if you know how to do it. If this is the case, I just haven't been able to work it out.

I hope this version of the question makes more sense.

Many thanks,

    Francis
targos commented 6 years ago

Unfortunately, we were not able to come up with a solution that doesn't require us to write the bindings for each function manually.

flatkinson commented 6 years ago

OK, I see. May I ask if this remains a long-term goal, or if you see any other potential ways forward?

kathrynloving commented 5 years ago

Chiming in as another person interested in the substructure/similarity search functions. (And also ReplaceCore, ReplaceSidechains, GetMolFrags, for SAR analysis.)

You mentioned above that you must write the bindings for each function manually... I think there's enough interest in this project that people would be willing contribute these to the project for the functions they need. (I would, anyway.)

Could you provide a detailed "how to" for one function that we could use as a template for adding more? Thanks!

thegodone commented 5 years ago

Hello,


First step env configuration: You need a linux/Mac env (use Docker if required):

Follow "README" instruction for installation. This will give you also an environnement to develop.


Old sources are still in the repo

There is a "old" session where we store old wrapping style code. main function is there https://github.com/cheminfo/RDKitjs/blob/master/old/src/rdmol.cpp & https://github.com/cheminfo/RDKitjs/blob/master/old/src/rdmol.h If you want to contribute that's very nice.


Major issue works with two molecules

One major issue we had is to compare two molecules (two objects), this is easy in python RDKit or C++ but not so simple in javascript.


Old code style

/**

/**

define BIND_Chem_rdForceFieldHelpers() \

{ \ function("MMFFOptimizeMolecule", &MMFFOptimizeMolecule, allow_raw_pointers()); \ }

Lot of code (old) need to be converted into new style.


RDKit function need to exist at c++ level:

We can also add new RDKit c++ functions.

Caution, If you need a function only available at the python level in RDKit, you will need to translate it to c++ than write the mapping function. Or better is to write a js function that emulates python fonction. there are lot of example of function I wrote following the same principal but using all style code.


Function Naming Matters:

In the new style we decided to use same function names as RDKit. this is to simplify the user code transfer from python to js.

Guillaume