pv is a WebGL-based protein viewer whose goal is to once-for-all end the reign of Java applets on websites that require visualisation of protein structures. This repository implements bio-pv as a Web Component.
Hey! If you'd like to use this component on your webpage, please do the following:
<!-- the library for the webcomponent -->
<script src="dist/bundle.js" type="module"></script>
You should have a dist folder with bundle.js in your directory just like this repository. The pdb file should be in the same directory (at the same level) as index.html. You can import it from this repository.
This links to the relevant scripts to define the component and fetch data.
Where you want your Web Component to appear, add the following:
Note - You can click on any style listed in the table below to see the visualisation in that style. If you don't want to have the table on your webpage, hide the table using style="display:none;"
and pass the style of visualisation in structureStyle.
<div id=inspector>
<h1>Choose Style</h1>
<ul>
<li id=preset>Preset</li>
<li id=cartoon>Cartoon</li>
<li id=tube>Tube</li>
<li id=lines>Lines</li>
<li id=line-trace>Line Trace</li>
<li id=sline>Smooth Line Trace</li>
<li id=trace>Trace</li>
</ul>
<span><a href='index.html'>About</a> | Code on <a href="http://github.com/Nikhil-Vats/bio-pv-web-component">github.com</a></span>
</div>
<bio-pv-web id="bio-pv-web" quality="high" structureStyle="tube" fov="45" background-color="white" outline="true"></bio-pv-web>
Attribute | Accepted Values | Mandatory |
---|---|---|
quality |
high, low. | Yes |
structureStyle |
tube, sline, lines, lineTrace, trace, cartoon | Yes |
fov (field of view) |
0 - 360 | Yes |
background-color |
any valid identifier or rgb value or hex code | No (default is white) |
outline |
true, false | No (default is false) |
- Clone the repo
cd bio-pv-web
and thennpm install
to install dependencies.
All of the editable source files for css and js are in src
. To bundle for prod, run the following commands:
Assuming less is installed globally:
npm run less
Assuming webpack is installed globally:
npm run build
Run each of these commands in separate terminals:
To rebuild your js every time you save:
npm run dev
To serve your page at http://localhost:3456:
npm run server
To see a demo component implemented similarly to this component, visit biojs-webcomponent-prototype.