+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")
+
+