Multiple Widget Embedding for Jolecule

27 Apr 2011 // protein

Finally, I've got the Jolecule widgets working properly. That is, multiple widgets working on the same page. That took some fugly global-variable name-mangling meta-programming code. But hey, it's javascript, so you are supposed to write fugly code.

What this means is that you can create annotated views for different proteins, then hot-link it back on your blog/website/journal-article to have fast loading interactive protein widgets.

I've also added a handy "link" button below every text box of the annotated views, where you can grab the appropriate embedding HTML code for your annotated views.

If you install multiple widgets, there will be some renaming to be had. If you are embedding the second widget, you will have to change:

embed1_dict => embed2_dict

And you will have to change in two places (between the <script> tags and between the <div> tags)

embed1_tag => embed2_tag

Then you keep renaming for each new widget.

As an example I show how trypsin interacts with trypsin inhibitor. So first, you have different displays for the two proteins.

Trypsin
Trypsin Inhibitor

And then you have several views of the same proteins. They are both really looking at the same protein, as you can see by flipping through the views.

Complex of the Trypsin Inhibitor bound to Trypsin