Skip to content

Commit

Permalink
version 1.1.0 dev 1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarsd committed Jun 30, 2020
1 parent fcc0875 commit c955c95
Show file tree
Hide file tree
Showing 38 changed files with 6,693 additions and 7,062 deletions.
Binary file added .DS_Store
Binary file not shown.
146 changes: 114 additions & 32 deletions component-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,136 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>Mol* PDBe Wrapper</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
</style>


<!-- Required for IE11 -->
<script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
<!-- Web component polyfill (only loads what it needs) -->
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-lite.js" charset="utf-8"></script>
<!-- Required to polyfill modern browsers as code is ES5 for IE... -->
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js" charset="utf-8"></script>

<link rel="stylesheet" type="text/css" href="https://wwwdev.ebi.ac.uk/pdbe/pdb-component-library/css/pdbe-molstar-light-0.1.0.css" />
<script type="text/javascript" src="build/pdbe-molstar-component-0.1.0.js"></script>
<link rel="stylesheet" type="text/css" href="build/pdbe-molstar-1.1.0-dev.1.css">
<script type="text/javascript" src="build/pdbe-molstar-component-1.1.0-dev.1.js"></script>
<style>
.msp-plugin .remove-header .msp-transform-header{
display: none !important;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.msp-plugin ::-webkit-scrollbar-thumb {
background-color: #474748 !important;
}
.viewerSection {
padding-top: 40px;
}
.msp-plugin .msp-form-control[disabled]{
opacity: 0.3;
background-color: black;
.controlsSection {
width: 300px;
float: left;
padding: 40px 0 0 40px;
margin-right: 30px;
}
.controlBox {
border: 1px solid lightgray;
padding: 10px;
margin-bottom: 20px;
}
#myViewer{
float:left;
width:450px;
height: 450px;
position:relative;
}
</style>
</head>
<body>

<div style="float:left;position: relative;width:400px;height: 400px;">
<pdbe-molstar
id="pdbeMolstarComponent"
molecule-id="3g46" hide-water="true" hide-expand-icon="true"
validation-annotation="true"
bg-color-r="255" bg-color-g="255" bg-color-b="255">
</pdbe-molstar>
</div>

<!-- Actions Menu -->
<div style="float:right; border:1px solid lightgray; width:300px;padding:10px;">

<h3><u>Canvas/ layout methods</u></h3>
<strong>Set Background</strong><br>
<button onclick="viewerInstance.canvas.setBgColor({r:255, g:255, b:255})">White</button>&nbsp;
<button onclick="viewerInstance.canvas.setBgColor({r:0, g:0, b:0})">Black</button><br><br>
<div class="controlsSection">

<h3>Canvas/ layout methods</h3>

<div class="controlBox">
<strong>Set Background</strong><br>
<button onclick="viewerInstance.canvas.setBgColor({r:255, g:255, b:255})">White</button>&nbsp;
<button onclick="viewerInstance.canvas.setBgColor({r:0, g:0, b:0})">Black</button><br><br>

<strong>Toggle controls menu</strong><br>
<button onclick="viewerInstance.canvas.toggleControls(false)">Hide</button>&nbsp;
<button onclick="viewerInstance.canvas.toggleControls(true)">Show</button>&nbsp;
<button onclick="viewerInstance.canvas.toggleControls()">Toggle</button><br><br>

<strong>Toggle Fullscreen</strong><br>
<button onclick="viewerInstance.canvas.toggleExpanded(true)">Show Fullscreen</button><br>
</div>

<h3>Visual Methods</h3>
<div class="controlBox">
<strong>Change representation visibility</strong><br>
<button onclick="viewerInstance.visual.visibility({water:false})">Hide Water Visual</button>&nbsp;
<button onclick="viewerInstance.visual.visibility({water:true})">Show Water Visual</button><br><br>

<strong>Toggle Spin</strong><br>
<button onclick="viewerInstance.visual.toggleSpin(true)">Rotate</button>&nbsp;
<button onclick="viewerInstance.visual.toggleSpin(false)">Stop</button>&nbsp;
<button onclick="viewerInstance.visual.toggleSpin()">Toggle</button><br><br>

<strong>Focus</strong><br>
<button onclick="viewerInstance.visual.focus([{struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18}])">Focus on Chain A:14-18</button><br><br>

<strong>Highlight</strong><br>
<button onclick="viewerInstance.visual.highlight({ data: [{ struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18 }], color:{r:255,g:255,b:0} })">Highlight Chain A:14-18</button>&nbsp;
<button onclick="viewerInstance.visual.clearHighlight()">Clear Highlight</button><br><br>

<strong>Selection</strong><br>
<button onclick="viewerInstance.visual.select({ data: [{ struct_asym_id: 'B', start_residue_number: 1, end_residue_number: 6, color:{r:255,g:255,b:0}, focus: true }]})">Select & Focus on Chain B:1-6</button><br><br>
<button onclick="
var selectSections = [
{
struct_asym_id: 'B',
start_residue_number: 8,
end_residue_number: 10,
color:{r:255,g:0,b:255},
sideChain: true
},
{
struct_asym_id: 'B',
start_residue_number: 2,
end_residue_number: 5,
color:{r:255,g:0,b:0}
}
]
viewerInstance.visual.select({ data: selectSections, nonSelectedColor: {r:255,g:255,b:255}})">Select on Chain B:2-5 & Chain B:8-10</button><br><br>

<button onclick="viewerInstance.visual.select({ data: [{struct_asym_id: 'B', color:{r:255,g:255,b:0}, focus:true}], nonSelectedColor: {r:255,g:255,b:255} })">Select & Focus on Chain B</button><br><br>

<button onclick="viewerInstance.visual.clearSelection()">Clear Selection</button><br><br>

<strong>Set highlight / selection colour</strong><br>
<button onclick="viewerInstance.visual.setColor({ highlight: {r:255,g:255,b:0} })">Yellow highlight</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ highlightColor: true })">Reset</button><br><br>
<button onclick="viewerInstance.visual.setColor({ select: {r:255,g:0,b:0} })">Red selection</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ selectColor: true })">Reset</button><br><br>

<strong>Reset Visual</strong><br>
<button onclick="viewerInstance.visual.reset({ camera: true })">Camera</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ theme: true })">Theme</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ camera: true, theme: true })">Camera & Theme</button><br><br>

<strong>Update data</strong><br>
<button onclick="viewerInstance.visual.update({moleculeId: '1cbs'})">Update data to create new visual</button><br>

</div>

</div>

<div class="viewerSection">
<h4>PDBe Mol* Web-component Demo</h4>

<!-- Molstar container -->
<div style="float:left;position: relative;width:400px;height: 400px;">
<pdbe-molstar id="pdbeMolstarComponent" molecule-id="2nnu" hide-controls="true"></pdbe-molstar>
</div>

</div>

<script>
var viewerInstance;
window.onload = function () {
Expand Down
190 changes: 112 additions & 78 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
<!DOCTYPE html>
<html>

<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>PDBe Molstar</title>


<!-- Molstar CSS & JS -->
<link rel="stylesheet" type="text/css" href="build/pdbe-molstar-0.1.0.css">
<script type="text/javascript" src="build/pdbe-molstar-plugin-0.1.0.js"></script>

<link rel="stylesheet" type="text/css" href="build/pdbe-molstar-1.1.0-dev.1.css">
<script type="text/javascript" src="build/pdbe-molstar-plugin-1.1.0-dev.1.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.msp-plugin ::-webkit-scrollbar-thumb {
background-color: #474748 !important;
}
.viewerSection {
padding-top: 40px;
}
.controlsSection {
width: 300px;
float: left;
padding: 40px 0 0 40px;
margin-right: 30px;
}
.controlBox {
border: 1px solid lightgray;
padding: 10px;
margin-bottom: 20px;
}
#myViewer{
float:left;
width:450px;
Expand All @@ -19,84 +41,96 @@
</head>

<body>
<h3>PDBe Molstar Plugin demo - Basic</h3>

<!-- Molstar container -->
<div id="myViewer"></div>

<!-- Actions Menu -->
<div style="float:right; border:1px solid lightgray; width:300px;padding:10px;">

<h3><u>Canvas/ layout methods</u></h3>

<strong>Set Background</strong><br>
<button onclick="viewerInstance.canvas.setBgColor({r:255, g:255, b:255})">White</button>&nbsp;
<button onclick="viewerInstance.canvas.setBgColor({r:0, g:0, b:0})">Black</button><br><br>

<strong>Toggle controls menu</strong><br>
<button onclick="viewerInstance.canvas.toggleControls(false)">Hide</button>&nbsp;
<button onclick="viewerInstance.canvas.toggleControls(true)">Show</button>&nbsp;
<button onclick="viewerInstance.canvas.toggleControls()">Toggle</button><br><br>

<strong>Toggle Fullscreen</strong><br>
<button onclick="viewerInstance.canvas.toggleExpanded(true)">Show Fullscreen</button><br>

<h3><u>Visual Methods</u></h3>
<strong>Change the visual entities visibility</strong><br>
<button onclick="viewerInstance.visual.visibility({water:false})">Hide Water Visual</button>&nbsp;
<button onclick="viewerInstance.visual.visibility({water:true})">Show Water Visual</button><br><br>

<strong>Toggle Spin</strong><br>
<button onclick="viewerInstance.visual.toggleSpin(true)">Rotate</button>&nbsp;
<button onclick="viewerInstance.visual.toggleSpin(false)">Stop</button>&nbsp;
<button onclick="viewerInstance.visual.toggleSpin()">Toggle</button><br><br>

<strong>Focus</strong><br>
<button onclick="viewerInstance.visual.focus([{struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18}])">Focus on Chain A:14-18</button><br><br>

<div class="controlsSection">

<h3>Canvas/ layout methods</h3>

<strong>Selection</strong><br>
<button onclick="viewerInstance.visual.selection([{struct_asym_id: 'B', start_residue_number: 1, end_residue_number: 6, color:{r:255,g:255,b:0}}], {r:255,g:255,b:255}, true)">Select & Focus on Chain B:1-6</button><br><br>
<button onclick="
var selectSections = [
{
struct_asym_id: 'B',
start_residue_number: 8,
end_residue_number: 10,
color:{r:255,g:0,b:255}
},
{
struct_asym_id: 'B',
start_residue_number: 2,
end_residue_number: 5,
color:{r:255,g:0,b:0}
}
]
viewerInstance.visual.selection(selectSections, {r:255,g:255,b:255}, false)">Select on Chain B:2-5 & Chain B:8-10</button><br><br>
<div class="controlBox">
<strong>Set Background</strong><br>
<button onclick="viewerInstance.canvas.setBgColor({r:255, g:255, b:255})">White</button>&nbsp;
<button onclick="viewerInstance.canvas.setBgColor({r:0, g:0, b:0})">Black</button><br><br>

<button onclick="viewerInstance.visual.selection([{struct_asym_id: 'B', color:{r:255,g:255,b:0}}], {r:255,g:255,b:255}, true)">Select & Focus on Chain B</button><br><br>

<strong>Reset Visual</strong><br>
<button onclick="viewerInstance.visual.reset(true, false)">Camera</button>&nbsp;
<button onclick="viewerInstance.visual.reset(false, true)">Theme</button>&nbsp;
<button onclick="viewerInstance.visual.reset(true, true)">Camera & Theme</button><br><br>

<strong>Update data</strong><br>
<button onclick="viewerInstance.visual.update({moleculeId: '1cbs'})">Update data to create new visual</button><br><br>

<h3><u>Interactivity Methods</u></h3>
<strong>Highlight</strong><br>
<button onclick="viewerInstance.interactivity.highlight([{struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18}])">Highlight Chain A:14-18</button>&nbsp;
<button onclick="viewerInstance.interactivity.clearHighlight()">Clear Highlight</button><br><br>

<strong>Selection</strong><br>
<button onclick="viewerInstance.interactivity.select([{struct_asym_id: 'A', start_residue_number: 73, end_residue_number: 81}])">Select Chain A:73-81</button><br><br>
<button onclick="viewerInstance.interactivity.select([{struct_asym_id: 'A', start_residue_number: 30, end_residue_number: 38, sideChain: true}])">Select Chain A:30-38 and show side-chain</button><br><br>
<button onclick="viewerInstance.interactivity.clearSelection()">Clear Selection</button><br><br>
<strong>Toggle controls menu</strong><br>
<button onclick="viewerInstance.canvas.toggleControls(false)">Hide</button>&nbsp;
<button onclick="viewerInstance.canvas.toggleControls(true)">Show</button>&nbsp;
<button onclick="viewerInstance.canvas.toggleControls()">Toggle</button><br><br>

<strong>Toggle Fullscreen</strong><br>
<button onclick="viewerInstance.canvas.toggleExpanded(true)">Show Fullscreen</button><br>
</div>

<h3>Visual Methods</h3>
<div class="controlBox">
<strong>Change representation visibility</strong><br>
<button onclick="viewerInstance.visual.visibility({water:false})">Hide Water Visual</button>&nbsp;
<button onclick="viewerInstance.visual.visibility({water:true})">Show Water Visual</button><br><br>

<strong>Toggle Spin</strong><br>
<button onclick="viewerInstance.visual.toggleSpin(true)">Rotate</button>&nbsp;
<button onclick="viewerInstance.visual.toggleSpin(false)">Stop</button>&nbsp;
<button onclick="viewerInstance.visual.toggleSpin()">Toggle</button><br><br>

<strong>Focus</strong><br>
<button onclick="viewerInstance.visual.focus([{struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18}])">Focus on Chain A:14-18</button><br><br>

<strong>Highlight</strong><br>
<button onclick="viewerInstance.visual.highlight({ data: [{ struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18 }], color:{r:255,g:255,b:0} })">Highlight Chain A:14-18</button>&nbsp;
<button onclick="viewerInstance.visual.clearHighlight()">Clear Highlight</button><br><br>

<strong>Selection</strong><br>
<button onclick="viewerInstance.visual.select({ data: [{ struct_asym_id: 'B', start_residue_number: 1, end_residue_number: 6, color:{r:255,g:255,b:0}, focus: true }]})">Select & Focus on Chain B:1-6</button><br><br>
<button onclick="
var selectSections = [
{
struct_asym_id: 'B',
start_residue_number: 8,
end_residue_number: 10,
color:{r:255,g:0,b:255},
sideChain: true
},
{
struct_asym_id: 'B',
start_residue_number: 2,
end_residue_number: 5,
color:{r:255,g:0,b:0}
}
]
viewerInstance.visual.select({ data: selectSections, nonSelectedColor: {r:255,g:255,b:255}})">Select on Chain B:2-5 & Chain B:8-10</button><br><br>

<button onclick="viewerInstance.visual.select({ data: [{struct_asym_id: 'B', color:{r:255,g:255,b:0}, focus:true}], nonSelectedColor: {r:255,g:255,b:255} })">Select & Focus on Chain B</button><br><br>

<button onclick="viewerInstance.visual.clearSelection()">Clear Selection</button><br><br>

<strong>Set highlight / selection colour</strong><br>
<button onclick="viewerInstance.visual.setColor({ highlight: {r:255,g:255,b:0} })">Yellow highlight</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ highlightColor: true })">Reset</button><br><br>
<button onclick="viewerInstance.visual.setColor({ select: {r:255,g:0,b:0} })">Red selection</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ selectColor: true })">Reset</button><br><br>

<strong>Reset Visual</strong><br>
<button onclick="viewerInstance.visual.reset({ camera: true })">Camera</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ theme: true })">Theme</button>&nbsp;
<button onclick="viewerInstance.visual.reset({ camera: true, theme: true })">Camera & Theme</button><br><br>

<strong>Update data</strong><br>
<button onclick="viewerInstance.visual.update({moleculeId: '1cbs'})">Update data to create new visual</button><br>

</div>

</div>

<div class="viewerSection">
<h4>PDBe Mol* JS Plugin Demo</h4>

<!-- Molstar container -->
<div id="myViewer"></div>

</div>

<script>

const pdbeUrl = "https://wwwdev.ebi.ac.uk/pdbe/";

//Create plugin instance
var viewerInstance = new PDBeMolstarPlugin();

Expand Down
Loading

0 comments on commit c955c95

Please sign in to comment.