patrickfuller / imolecule

An embeddable webGL molecule viewer and file format converter.
http://patrickfuller.github.io/imolecule/
MIT License
86 stars 18 forks source link

Add pybel highlight support (for hex colors only) #7

Closed bjonnh closed 9 years ago

bjonnh commented 9 years ago

This adds support for highlighting using pybel operations:

import pybel
import imolecule
mol = pybel.readstring("smi","OCN(CC)CCS")
pybel._operations['highlight'].Do(mol.OBMol, "[#6][#7] #FF0000") 
pybel._operations['highlight'].Do(mol.OBMol, "[#1][#8] #0000FF") 
pybel._operations['highlight'].Do(mol.OBMol, "[#16][#6] #00FF00") 
imolecule.draw(mol, shader="phong",format="pybel", display_html=True)

highlighter

patrickfuller commented 9 years ago

Great, I'll merge this.