How to use molecule drawing software Ketcher and PyScript together
This small example shows how to use Ketcher and PyScript.
The process is the following: Ketcher is a JavaScript app, that has js API. PyScript allows us call this api inside of browser.
In order to setup Ketcher and PyScript on your local machine do the following:
- Create a new folder. E.g.
pyketch
; cd
into it;- Download and unpack Ketcher standalone in this folder.
You should get the following folder structure:
pyketch └── ketcher ├── apple-touch-icon.png ├── asset-manifest.json ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html ├── logo.svg ├── manifest.json ├── robots.txt ├── static │ ├── css │ │ └── main.8e693d51.css │ ├── js │ │ ├── main.22c72ca0.js │ │ └── main.22c72ca0.js.LICENSE.txt │ └── media │ └── overlay.8faf238632c16c841197.svg └── templates ├── fg.sdf ├── library.sdf └── library.svg
- Now download
index.html
file from this gist intopyketch
folder; - Inside
pyketch
folder run the following command (you should have python installed):
This should be done, because ketcher and pyscript must run on the same page.python -m http.server 8000
- In your browser go to the http://localhost:8000
You should see the following:
Follow this link to try all this out in browser.