min UNRES model NGL Viewer details1 Damino
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Thu, 1 Feb 2018 20:46:25 +0000 (21:46 +0100)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Thu, 1 Feb 2018 20:46:25 +0000 (21:46 +0100)
django_simple/todo/templates/details.html
django_simple/todo/templates/details1.html

index 7b81103..c83f70e 100644 (file)
@@ -350,7 +350,7 @@ Created {{ task.created_date  }}
                            <div class="col-md-2"> Etot </div>
                            <div class="col-md-10">{{ task.etot }}</div>
                        </li>           
-                       
+<!--                   
                        <li class="list-group-item task-item">
                          <div class="col-md-2"> UNRES model </div>
                          <div class="col-md-10"> 
@@ -360,6 +360,14 @@ Created {{ task.created_date  }}
                          src="/myfiles/download-file/{{task.jobdirname}}/unres.png"
                          width="500"></a> </div>
                        </li>
+-->
+                       <li class="list-group-item task-item">
+                         <div class="col-md-2"> UNRES model NGL viewer</div>
+                         <div class="col-md-10" id="viewport_unres"
+                         style="width:500px;height:500px;"> 
+                         </div>
+                       </li>
+
 
 <!--
                        <li class="list-group-item task-item">
@@ -956,6 +964,74 @@ window.addEventListener("resize",
      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([
index 855db12..f2d9c48 100644 (file)
@@ -350,7 +350,7 @@ Created {{ task.created_date  }}
                            <div class="col-md-2"> Etot </div>
                            <div class="col-md-10">{{ task.etot }}</div>
                        </li>           
-                       
+<!--                   
                        <li class="list-group-item task-item">
                          <div class="col-md-2"> UNRES model </div>
                          <div class="col-md-10"> 
@@ -360,6 +360,14 @@ Created {{ task.created_date  }}
                          src="/myfiles/download-file/{{task.jobdirname}}/unres.png"
                          width="500"></a> </div>
                        </li>
+-->
+                       <li class="list-group-item task-item">
+                         <div class="col-md-2"> UNRES model NGL viewer</div>
+                         <div class="col-md-10" id="viewport_unres"
+                         style="width:500px;height:500px;"> 
+                         </div>
+                       </li>
+
 
 <!--
                        <li class="list-group-item task-item">
@@ -786,6 +794,15 @@ function display_model(numstr){
       }),
       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"]
@@ -793,6 +810,7 @@ function display_model(numstr){
         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) {
@@ -834,6 +852,15 @@ function display_model(numstr){
   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"]
@@ -841,6 +868,7 @@ function display_model(numstr){
         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 );
@@ -941,6 +969,74 @@ window.addEventListener("resize",
      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([