+
+<script src="/static/jquery.min.js"></script>
+<script src="https://unpkg.com/ngl"></script>
+
+<script>
+$('.majorpointslegend').click(function(){
+ $(this.parentNode).find('.hiders').toggle();
+ if($(this.parentNode).find('.majorpointslegend').text()=='Show input parameters'){
+ $(this.parentNode).find('.majorpointslegend').text('Hide input parameters');
+ }else{
+ $(this.parentNode).find('.majorpointslegend').text('Show input parameters');
+ }
+});
+</script>
+
+{% if task.type == "remd" or task.type == "dock" %}
+<script>
+function display_model(numstr){
+
+{% if task.md_pdbref %}
+ var stage = new NGL.Stage("viewport_M"+numstr);
+ stage.setParameters( { backgroundColor: "white",fogFar: 60, fogNear: 45 } );
+ Promise.all([
+ stage.loadFile( "/myfiles/download-file/{{task.jobdirname}}/plik1.pdb" ,{defaultRepresentation: false}) .then( function( o ){
+ o.addRepresentation( "cartoon",{ name:"ref", color:"grey"
+ })
+ o.addRepresentation( "line", {name:"refsc",visible: false,
+ sele:"not hydrogen and sidechainAttached"
+ })
+ return o
+ }),
+ stage.loadFile(
+ "/myfiles/download-file/{{task.jobdirname}}/MODEL"+numstr+".pdb",{defaultRepresentation: false}) .then( function( o ){
+ {% if task.damino %}
+ o.addRepresentation( "licorice",{ name: "unres", color:
+ "residueindex",colorScale:["blue","cyan", "green",
+ "yellow","orange", "red"], sele:".CA"
+ })
+ o.addRepresentation( "licorice",{ name: "unressc", visible: false, color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ , sele:"*" })
+ {% else %}
+ o.addRepresentation( "cartoon",{ name: "unres", color:
+ "residueindex",colorScale:["blue","cyan", "green",
+ "yellow","orange", "red"]
+ })
+ o.addRepresentation( "line",{ name: "unressc", visible: false, color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ , sele:"not hydrogen and sidechainAttached" })
+ {% endif %}
+ return o
+ })
+ ]).then(function (ol1) {
+ ol1[ 1 ].superpose(ol1[ 0 ], false, ".CA")
+ ol1[ 0 ].autoView()
+ })
+ var ref=true;
+ var side=false;
+ var toggleAll = document.getElementById( "toggleRefM"+numstr );
+ toggleAll.addEventListener( "click", function(){
+ ref=! ref;
+ stage.getRepresentationsByName(
+ "ref" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+ if (side) {
+ stage.getRepresentationsByName(
+ "refsc" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+ }
+
+ } );
+ var toggleSidechains =document.getElementById("toggleSidechainsM"+numstr );
+ toggleSidechains.addEventListener( "click", function(){
+ side=!side;
+ if (ref) {
+ stage.getRepresentationsByName(
+ "refsc" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+ }
+ stage.getRepresentationsByName("unressc").list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+
+ } );
+{% else %}
+ var stage = new NGL.Stage("viewport_M"+numstr);
+ stage.setParameters( { backgroundColor: "white",fogFar: 60, fogNear: 45 } );
+ stage.loadFile( "/myfiles/download-file/{{task.jobdirname}}/MODEL"+numstr+".pdb",{defaultRepresentation: false}) .then( function( o ){
+ {% if task.damino %}
+ o.addRepresentation( "licorice",{ name: "unres", color:
+ "residueindex",colorScale:["blue","cyan", "green",
+ "yellow","orange", "red"],sele:".CA"
+ });
+ o.addRepresentation( "licorice",{ name: "unressc", visible: false, color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ , sele:"*" });
+ {% else %}
+ o.addRepresentation( "cartoon",{ name: "unres", color:
+ "residueindex",colorScale:["blue","cyan", "green",
+ "yellow","orange", "red"]
+ });
+ o.addRepresentation( "line",{ name: "unressc", visible: false, color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ , sele:"not hydrogen and sidechainAttached" });
+ {% endif %}
+ o.autoView();
+ })
+ var toggleSidechains =document.getElementById("toggleSidechainsM"+numstr );
+ toggleSidechains.addEventListener( "click", function(){
+ stage.getRepresentationsByName("unressc").list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+
+ } );
+
+{% endif %}
+}
+
+
+window.addEventListener("resize",
+function (event) {
+ stage.handleResize();
+},false);
+
+
+display_model("1")
+
+
+var slideIndex = 1;
+var y = document.getElementsByClassName("model");
+var lista=[];
+var ii;
+for (ii = 0; ii < y.length; ii++) {
+ lista.push(0)
+}
+lista[0]=1;
+showDivs(slideIndex);
+
+function plusDivs(n) {
+ showDivs(slideIndex += n);
+}
+
+function showDivs(n) {
+ var i;
+ var x = document.getElementsByClassName("model");
+ if (n > x.length) {slideIndex = 1}
+ if (n < 1) {slideIndex = x.length}
+ for (i = 0; i < x.length; i++) {
+ x[i].style.display = "none";
+ }
+ x[slideIndex-1].style.display = "block";
+
+ if (lista[slideIndex-1] == 0 && slideIndex == 2) {
+ display_model("2")
+ }
+
+ if (lista[slideIndex-1] == 0 && slideIndex == 3) {
+ display_model("3")
+ }
+
+ if (lista[slideIndex-1] == 0 && slideIndex == 4) {
+ display_model("4")
+ }
+
+ if (lista[slideIndex-1] == 0 && slideIndex == 5) {
+ display_model("5")
+ }
+
+
+ if (lista[slideIndex-1] == 0) {lista[slideIndex-1]=1}
+}
+</script>
+{% endif %}
+
+{% if not task.done %}
+<script>
+function worker() {
+ $.ajax({
+ data:{csrfmiddlewaretoken: '{{ csrf_token }}'},
+ url: "/refresh_done/",
+ type:"post",
+ success: function(data) {
+ document.location.reload();
+ },
+ complete: function() {
+ // Schedule the next request when the current one's complete
+ setTimeout(worker, 30000);
+ }
+ });
+};
+$(document).ready(function() {
+ // run the first time; all subsequent calls will take care of themselves
+ setTimeout(worker, 30000);
+});
+</script>
+{% endif %}
+
+{% if task.type == "min" %}
+<script>
+window.addEventListener("resize",
+ function (event) {
+ stage.handleResize();
+ },false);
+
+var stage_unres = new NGL.Stage("viewport_unres");
+stage_unres.setParameters( { backgroundColor: "white" } );
+/**
+[color_Red, color_Green, color_Blue, ellipsoid_width, ellipsoid_length ]
+*/
+var resdb = { 'CYS': [1.000, 1.000, 0.000, 1.33741, 2.96868],
+ 'MET': [0.000, 1.000, 0.000, 1.36694, 3.08863],
+ 'PHE': [0.000, 0.392, 0.000, 1.48323, 3.04238],
+ 'ILE': [0.000, 1.000, 0.000, 1.44098, 3.17389],
+ 'LEU': [0.000, 1.000, 0.000, 1.51054, 2.52078],
+ 'VAL': [0.000, 1.000, 0.000, 1.42072, 2.68924],
+ 'TRP': [0.000, 0.392, 0.000, 1.23867, 3.47403],
+ 'TYR': [0.596, 0.984, 0.596, 1.23060, 3.35434],
+ 'ALA': [0.000, 1.000, 0.000, 1.23266, 1.72686],
+ 'GLY': [1.000, 1.000, 1.000, 1.24626, 1.11383],
+ 'THR': [1.000, 0.000, 1.000, 1.28674, 2.59210],
+ 'SER': [1.000, 0.000, 1.000, 1.22820, 1.68800],
+ 'GLN': [1.000, 0.000, 1.000, 1.24239, 2.22201],
+ 'ASN': [1.000, 0.000, 1.000, 1.24447, 2.24946],
+ 'GLU': [1.000, 0.000, 0.000, 1.25448, 2.05551],
+ 'ASP': [1.000, 0.000, 0.000, 1.25417, 1.77556],
+ 'HIS': [1.000, 0.000, 1.000, 1.21103, 3.02627],
+ 'ARG': [0.000, 0.000, 1.000, 1.13573, 3.25143],
+ 'LYS': [0.000, 0.000, 1.000, 1.22604, 4.50054],
+ 'PRO': [0.000, 1.000, 1.000, 1.35131, 2.20525]
+ };
+stage_unres.loadFile("/myfiles/download-file/{{task.jobdirname}}/file_GB000.pdb", {defaultRepresentation: false}).then
+ (function ( o ){
+ var shape = new NGL.Shape("shape")
+ var chain = ""
+ o.addRepresentation("licorice");
+ o.structure.eachAtom(function(atom){
+ if (atom.atomname == "CA" && atom.chainname == chain) {
+ px=CAx+(atom.x-CAx)/2;
+ py=CAy+(atom.y-CAy)/2;
+ pz=CAz+(atom.z-CAz)/2;
+ shape.addSphere([px,py,pz],[0.643, 0.933, 0.960],0.6,"p");
+ }
+ if (atom.atomname == "CA") {
+ chain= atom.chainname
+ CAx= atom.x;
+ CAy= atom.y
+ CAz= atom.z
+ }
+ if (atom.atomname == "CB") {
+ mx = (atom.x-CAx);
+ my = (atom.y-CAy);
+ mz = (atom.z-CAz);
+ norm=Math.sqrt(mx*mx+my*my+mz*mz);
+ res=atom.resname;
+ var longaxis=resdb[res][4]
+ var shortaxis=resdb[res][3]
+ mx = mx /norm*longaxis;
+ my = my /norm*longaxis;
+ mz = mz /norm*longaxis;
+ resn=res+atom.resno
+ shape.addEllipsoid([ atom.x, atom.y, atom.z ],
+ [ resdb[res][0], resdb[res][1], resdb[res][2]],
+ shortaxis, [ mx, my, mz ], [ 0, shortaxis, 0 ],resn);
+ }
+ });
+ var shapeComp = stage_unres.addComponentFromObject(shape)
+ shapeComp.addRepresentation("buffer")
+ o.autoView();
+});
+
+
+
+var stage = new NGL.Stage("viewport_min");
+stage.setParameters( { backgroundColor: "white" } );
+Promise.all([
+ stage.loadFile( "/myfiles/download-file/{{task.jobdirname}}/file_GB000.pdb" ,{defaultRepresentation: false}) .then( function( o ){
+ o.addRepresentation( "backbone",{ color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ })
+ o.addRepresentation( "licorice",{ color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange","red"]
+ })
+ return o
+ }),
+
+ stage.loadFile("/myfiles/download-file/{{task.jobdirname}}/plik.pdb",{defaultRepresentation: false}) .then( function( o ){
+ o.addRepresentation( "backbone",{ name: "allatom", color:
+ "residueindex",colorScale:["blue","cyan", "green","yellow","orange", "red"]
+ })
+ o.addRepresentation( "line",{ name: "allatomsc", color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ ,sele:"not hydrogen and sidechainAttached"
+ })
+ return o
+ })
+]).then(function (ol) {
+ ol[ 0 ].superpose(ol[ 1 ], false, ".CA")
+ ol[ 0 ].autoView()
+})
+
+var allatom=true;
+var side=true;
+var toggleAll = document.getElementById( "toggleAllatom" );
+toggleAll.addEventListener( "click", function(){
+ allatom=! allatom;
+ stage.getRepresentationsByName(
+ "allatom" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+ if (side) {
+ stage.getRepresentationsByName(
+ "allatomsc" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+ }
+} );
+var toggleSidechains = document.getElementById("toggleSidechains2" );
+toggleSidechains.addEventListener( "click", function(){
+ side=!side;
+ if (allatom) {
+ stage.getRepresentationsByName(
+ "allatomsc" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+
+ }
+ stage.getRepresentationsByName("licorice").list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+
+} );
+</script>
+{% endif %}
+
+{% if task.type == "md" and task.md_start == "pdbstart" %}
+<script>
+window.addEventListener("resize",
+ function (event) {
+ stage.handleResize();
+ },false);
+
+var stage = new NGL.Stage("viewport_putty");
+stage.setParameters( { backgroundColor: "white" } );
+
+var tooltip = document.createElement("div")
+Object.assign(tooltip.style, {
+ display: "none",
+ position: "fixed",
+ zIndex: 10,
+ pointerEvents: "none",
+ backgroundColor: "rgba( 0, 0, 0, 0.6 )",
+ color: "lightgrey",
+ padding: "8px",
+ fontFamily: "sans-serif"
+})
+document.body.appendChild(tooltip)
+
+stage.loadFile("/myfiles/download-file/{{task.jobdirname}}/plik_bf.pdb", {defaultRepresentation: false}).then
+ (function ( o ){
+ o.addRepresentation("tube",{ color: "bfactor" , scale: 0.25,
+ sele: "backbone",
+ radius:"bfactor",
+ colorScale:["blue","cyan", "green", "yellow","orange", "red"] });
+ o.addRepresentation("licorice",{sele:"sidechainAttached and CYS and not hydrogen"});
+ o.autoView();
+})
+
+// remove default hoverPick mouse action
+stage.mouseControls.remove("hoverPick")
+
+stage.signals.hovered.add(function (pickingProxy) {
+ if (pickingProxy && (pickingProxy.atom || pickingProxy.bond)) {
+ var atom = pickingProxy.atom || pickingProxy.closestBondAtom
+ var mp = pickingProxy.mouse.position
+ var bf= atom.bfactor.toFixed(2)
+ tooltip.innerText = atom.qualifiedName()+" Fluctuation="+ bf
+ tooltip.style.bottom = window.innerHeight - mp.y + 3 + "px"
+ tooltip.style.left = mp.x + 3 + "px"
+ tooltip.style.display = "block"
+ } else {
+ tooltip.style.display = "none"
+ }
+})
+</script>
+{% endif %}
+
+{% if task.type == "md" and task.md_mdpdb %}
+<script>
+window.addEventListener("resize",
+ function (event) {
+ stage.handleResize();
+ },false);
+
+ var stage = new NGL.Stage("viewport_traj");
+ stage.setParameters( { backgroundColor: "white" } );
+ stage.setParameters( { cameraType: "orthographic" } );
+ var traj;
+ var player;
+ stage.loadFile( "/myfiles/download-file/{{task.jobdirname}}/file_MD000.pdb", {
+ asTrajectory: true } ) .then( function( o ){
+ o.setName ("unres_md");
+ o.addRepresentation( "backbone",{ color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ });
+ o.addRepresentation( "licorice",{ color:
+ "residueindex",colorScale:["blue","cyan", "green", "yellow","orange", "red"]
+ });
+ o.setPosition([0, 0, 100]);
+ o.autoView();
+ o.addTrajectory();
+ });
+
+ var toggleSidechains = document.getElementById( "toggleSidechains1" );
+ toggleSidechains.addEventListener( "click", function(){
+ stage.getRepresentationsByName( "licorice" ).list.forEach( function( repre ){
+ repre.setVisibility( !repre.visible );
+ } );
+ } );
+
+
+ function numberWithCommas(x) {
+ return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ }
+ var toggleRunMDs = document.getElementById( "toggleRunMDs" );
+ var isRunning = false;
+ toggleRunMDs.addEventListener( "click", function(){
+ var trajComp = stage.getComponentsByName("unres_md").list[0].trajList[0];
+ var player = new NGL.TrajectoryPlayer(trajComp.trajectory, {timeout: 10, mode: "once"});
+ if( !isRunning ){
+ player.play();
+ isRunning = true;
+
+ trajComp.signals.frameChanged.add(function(){
+ var fnum=trajComp.trajectory.currentFrame+1;
+ clipRange.value = fnum;
+ clipRange_val.innerHTML = numberWithCommas(parseInt(clipRange.value*1));
+ });
+
+ }else{
+ player.play();
+ player.pause();
+ isRunning = false;
+ }
+ } );
+ var clipRange = document.getElementById( "clipRange" );
+ var clipRange_val = document.getElementById( "clipRange_val" );
+ clipRange.oninput = function( e ){
+ var trajComp = stage.getComponentsByName("unres_md").list[0].trajList[0];
+ trajComp.setFrame(e.target.value-1)
+ clipRange_val.innerHTML = numberWithCommas(parseInt(e.target.value*1));
+ };
+
+</script>
+{% endif %}
+
+