Dear Giuseppe,

I make progress on this topic, if you want to participate?

https://github.com/thegodone/RDKitjs

There are already some functions exposed like MMFF, addHs, fromSmiles, 
fromSmarts, ....

Best regards,

Dr. Guillaume GODIN
Project Manager
Innovation
CORPORATE R&D DIVISION
DIRECT LINE +41 (0)22 780 3645
MOBILE       +41 (0)79 536 1039

Firmenich SA
RUE DES JEUNES 1 | CASE POSTALE 239 | CH-1211 GENEVE 8


________________________________
De : Guillaume GODIN
Envoyé : mardi, 12. mai 2015 18:01
À : Giuseppe Marco Randazzo
Cc : rdkit-discuss@lists.sourceforge.net
Objet : RE:[Rdkit-discuss] rdkit and emscripten

Dear Marco,

I find a solution!

I prepare a github to explain it

best regards,

Dr. Guillaume GODIN
Project Manager
Innovation
CORPORATE R&D DIVISION
DIRECT LINE +41 (0)22 780 3645
MOBILE       +41 (0)79 536 1039

Firmenich SA
RUE DES JEUNES 1 | CASE POSTALE 239 | CH-1211 GENEVE 8


________________________________
De : Giuseppe Marco Randazzo [gmranda...@gmail.com]
Envoyé : mardi, 12. mai 2015 13:38
À : Guillaume GODIN
Cc : rdkit-discuss@lists.sourceforge.net
Objet : Re: [Rdkit-discuss] rdkit and emscripten

I thinks is a linking problem.

Do you link libSmilesParse.so?

from your line it seems that you link only -Llib/libGraphMol.so 
-Llib/libDescriptors.so -Llib/libRDGeneral.so -Llib/libRDGeometryLib.so


Marco





On 12 May 2015, at 12:53, Guillaume GODIN 
<guillaume.go...@firmenich.com<mailto:guillaume.go...@firmenich.com>> wrote:

Dear Marco,

Thanks for the tips.

I now look at expose the RDKit class directly in JS using emscripten.

I have a issue there :

//------****** code of the rdmol.cpp ********----

#include <emscripten/bind.h>

#include <GraphMol/ROMol.h>

#include <GraphMol/SmilesParse/SmilesParse.h>

#include <GraphMol/RDKitBase.h>


using namespace emscripten;

using namespace RDKit;

typedef ROMol Mol;


class Molecule {



public:



   unsigned int getNA(ROMol *rdmol) {

      return rdmol->getNumAtoms();

  }




   ROMol* fromSmiles(char *smiles) {

     return SmilesToMol(smiles);

  }




private:

  ROMol *rdmol;

};



// Binding code

EMSCRIPTEN_BINDINGS(rdmol) {

  class_<Molecule>("Molecule")

    .constructor<>()

    .function("getNA",&Molecule::getNA, allow_raw_pointers())

    .function("fromSmiles", &Molecule::fromSmiles, allow_raw_pointers())

    ;

}

//------***** end code *******-----

when I try to execute this command I add the following link issues. I cannot 
use the cmake / make procedure.


/emscripten/emscripten/em++ --bind -o rdmol.js ../rdmol.cpp -Icode -Iinclude 
-Llib/libGraphMol.so -Llib/libDescriptors.so -Llib/libRDGeneral.so 
-Llib/libRDGeometryLib.so


where -Icode and -Iinclude are the ln -fs to rdkit/code and boost/include 
folders

and -Llib/ are ln -fs to rdkit/lib folder.


my error is:

sh-3.2# /emscripten/emscripten/em++ --bind -o rdmol.js ../rdmol.cpp -Icode 
-Iinclude -Llib/libGraphMol.so -Llib/libDescriptors.so -Llib/libRDGeneral.so 
-Llib/libRDGeometryLib.so

warning: unresolved symbol: _ZNK5RDKit5ROMol11getNumAtomsEb

warning: unresolved symbol: 
_ZN5RDKit11SmilesToMolENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEibPNS0_3mapIS6_S6_NS0_4lessIS6_EENS4_INS0_4pairIKS6_S6_EEEEEE


warning: unresolved symbol: _ZTIN5RDKit5ROMolE



Do you have any suggestions to solve that ?


best regards


Dr. Guillaume GODIN
Project Manager
Innovation
CORPORATE R&D DIVISION
DIRECT LINE +41 (0)22 780 3645
MOBILE       +41 (0)79 536 1039

Firmenich SA
RUE DES JEUNES 1 | CASE POSTALE 239 | CH-1211 GENEVE 8


________________________________
De : Giuseppe Marco Randazzo [gmranda...@gmail.com<mailto:gmranda...@gmail.com>]
Envoyé : mardi, 12. mai 2015 10:36
À : Guillaume GODIN
Cc : 
rdkit-discuss@lists.sourceforge.net<mailto:rdkit-discuss@lists.sourceforge.net>
Objet : Re: [Rdkit-discuss] rdkit and emscripten

Hello Guillaume,

you have a vector of unsigned int "SparseIntVect<boost::uint32_t>” which is a 
vector of unsigned int.

Looking at the C++ public member function you can find “getVal(int index)”  
which give to you the correspondent bit as integer value.

So, you can iterate and convert to a string using stringstream.

Second things… is better to use getHashedFingerprint to have a limited size of 
fingerprint (2048 bit).

Here the fully woking example.


/******* START C++ CODE ******/
#include <GraphMol/FileParsers/MolSupplier.h>
#include <RDGeneral/RDLog.h>
#include <GraphMol/RDKitBase.h>
#include <DataStructs/SparseIntVect.h>
#include <GraphMol/Fingerprints/MorganFingerprints.h>
#include <sstream>

int main(int argc, char *argv[])
{
  RDKit::SmilesMolSupplier supplier(argv[1], " \t", 0, 1, false, true);
  RDKit::ROMol* mol;

  while (!supplier.atEnd()){
    mol = new RDKit::ROMol;
    mol = supplier.next();
    if (mol){
      RDKit::SparseIntVect<boost::uint32_t> *finger = 
RDKit::MorganFingerprints::getHashedFingerprint((*mol), 2);
      std::stringstream out;
      for(uint i = 0; i < finger->size(); i++){
        out << finger->getVal(i);
      }
      std::cout << out.str() << std::endl;
      delete finger;
    }
    delete mol;
    mol = NULL;
  }
}

/******* END C++ CODE ******/


/******** START CMakeListst.txt ********/
project(examplerdkit)
cmake_minimum_required(VERSION 3.0)
include_directories(${RDKIT_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
add_executable(test1 main.cpp)
target_link_libraries(test1 ${RDKIT_LIBRARIES})
/******** END CMakeListst.txt ********/

To compile:

mkdir build
cd build

export RDLIB="/usr/local/lib/“;
cmake .. -DRDKIT_INCLUDE_DIR=/usr/local/include/rdkit 
-DBoost_INCLUDE_DIR=/usr/local/include/boost/ 
-DRDKIT_LIBRARIES="${RDLIB}/libRDGeometryLib.dylib;${RDLIB}/libDepictor.dylib;${RDLIB}/libSmilesParse.dylib;$RDLIB/libGraphMol.dylib;${RDLIB}/libRDGeneral.dylib;${RDLIB}/libFileParsers.dylib;${RDLIB}/libFingerprints.dylib”

make

to use

echo "N1C=NC2=C1C(=O)N(C(=O)N2C)C     caffeina” >> caffeina.smi

./test1 caffena.smi

output:

./test1 caffeina.smi
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000100000000000000000000000000010000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000001000000000000000000000000000000000001000000000000000000000000000000002100000000000000000000000000000000000000000000000000000001000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000010000100000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000



Best regards,

Marco



On 11 May 2015, at 16:11, Guillaume GODIN 
<guillaume.go...@firmenich.com<mailto:guillaume.go...@firmenich.com>> wrote:

Dear Greg,

Sorry, I forget that link point.

So emscripten now see the fingerprint,

how to convert it on a readable format like base64 or a string... ?

Best regards,

Guillaume





Hi,

Are you sure that you have included the Fingerprints library in the link 
statement?


In the future please direct RDKit questions like this to the rdkit-discuss 
mailing list. You can find subscription info here:
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

-greg


Dear Gregory Landrum,

I started to build rdkit 2004_09 wrap to javascript using emscripten.

I was able to expose all your descriptors in a string and see it in a browser.

But, I have trouble to expose the fingerprint, it's look like there is a 
missing piece in the c++ implementation.

When I try to compile this part of my code I have the following issue:

SparseIntVect<boost::uint32_t> *finger;

finger = MorganFingerprints::getFingerprint(*mol, 2);

the compiler don't find the linking to your c++ code: warning: unresolved 
symbol: 
_ZN5RDKit18MorganFingerprints14getFingerprintERKNS_5ROMolEjPNSt3__16vectorIjNS4_9allocatorIjEEEEPKS8_bbbbPNS4_3mapIjNS5_INS4_4pairIjjEENS6_ISE_EEEENS4_4lessIjEENS6_INSD_IKjSG_EEEEEE

Did you have any advise to determine where I can find this ?

best regards,

Dr. Guillaume GODIN
Project Manager
Innovation
CORPORATE R&D DIVISION
DIRECTLINE +41 (0)22 780 3645
MOBILE       +41 (0)79 536 1039

Firmenich SA
RUE DES JEUNES 1 | CASE POSTALE 239 | CH-1211 GENEVE 8


**********************************************************************
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.
**********************************************************************
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to