I think this project is very cooooooooool. ;-)
https://github.com/thegodone/RDKitjs
This project is trying to convert c++ to javascript using emscripten.
Emscripten is an LLVM-based project that compiles C and C++ into highly-optimizable JavaScript in asm.js format.
So, if rdkit.js works well, I can write chemoinformatic function using only javascript.
It’s sounds nice.
I tried it.
I build rdkit.js by myself. But, if you installed nodejs and npm, you can latest version of rdkit.js from https://www.npmjs.com/package/rdkit.
I wrote very simple sample.
I used flask.
Like …..
iwatobipen$ tree . ├── __init__.py ├── app.py ├── static │ └── rdkit.js └── templates └── top.html
app.py.
#!/usr/local/bin/python from flask import Flask from flask import render_template app = Flask(__name__) @app.route('/') def toppage(): return render_template('top.html') if __name__ == '__main__': app.run(debug = True)
top.html
!DOCTYPE HTML> <head> <script type='text/javascript' src='/static/rdkit.js'></script> <script> function molwt( smi ){ var mol = RDKit.Molecule.fromSmiles( smi ); var mw = mol.getMW(); alert( mw ); } </script> </head> <body> <h>rdkitjs test</h><br><br> <form name='chemo'> Input smilestrings;<br> <input type='text' name='smi'> calc molwt<br> <input name='calc' value='cal' type='button' onClick='molwt( document.chemo.smi.value )'> </form> </body> </html>
It’s ready.
Now type ‘python app.py’ and access 127.0.0.1:5000
And input some smilestrings, and push the button.
I got following response.
Yah! Great!
Lots of function can use in the library.
I uploaded the code to github.