md pdbstart fluctuations
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Sun, 10 Sep 2017 00:15:18 +0000 (02:15 +0200)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Sun, 10 Sep 2017 00:15:18 +0000 (02:15 +0200)
django_simple/todo/templates/details.html
files/fluct.py [new file with mode: 0644]
files/fluct_plot.py [new file with mode: 0755]
files/overlap.pml [new file with mode: 0644]
files/pbs_md.csh
files/pbs_md_new.csh

index 6a7f396..a2d2eb5 100644 (file)
@@ -322,6 +322,30 @@ Created {{ task.created_date  }}
                        </li>
                        
                           {% endif %}
+
+                          {% if task.md_start == "pdbstart" %}
+                       <li class="list-group-item task-item">
+                         <div class="col-xs-10"> fluctuations </div>
+                         <div class="col-xs-10"> <img 
+                         src="/myfiles/download-file/{{task.jobdirname}}/fluct_plot.png"
+                         width="500"> </div>
+                       </li>
+
+                       <li class="list-group-item task-item">
+                         <div class="col-xs-10"> fluctuations putty on
+                         starting structure</div>
+                         <div class="col-xs-10"> 
+                         <a
+                         href="/myfiles/download-file/{{task.jobdirname}}/fluct.pse">
+                         <img 
+                         src="/myfiles/download-file/{{task.jobdirname}}/fluct.png"
+                         width="500"></a> </div>
+                       </li>
+                       
+                          {% endif %}
+
+
+
                        {% endif %}
                        
                        {% if task.type == "remd" %}
diff --git a/files/fluct.py b/files/fluct.py
new file mode 100644 (file)
index 0000000..760edae
--- /dev/null
@@ -0,0 +1,39 @@
+from pymol import cmd, stored, math
+import time
+
+cmd.load('plik.pdb')
+mol='plik'
+obj=cmd.get_object_list(mol)[0]
+inFile = open('fluctuations.txt', 'r')
+
+cmd.iterate("first %s and polymer and n. CA" % mol,"stored.first=resv")
+counter=stored.first
+
+bfacts=[]
+for line in inFile.readlines():        
+   bfact=float(line)
+   bfacts.append(bfact)
+   cmd.alter("%s and resi %s and n. CA"%(mol,counter), "b=%s"%bfact)
+   counter=counter+1 
+
+#cmd.hide("all")
+#cmd.show_as("stick", "name ca")
+
+cmd.show_as("cartoon",mol)
+cmd.cartoon("putty", mol)
+cmd.set("cartoon_putty_scale_min", min(bfacts),obj)
+cmd.set("cartoon_putty_scale_max", max(bfacts),obj)
+cmd.set("cartoon_putty_transform", 7,obj)
+cmd.set("cartoon_putty_radius", 0.3,obj)
+
+cmd.spectrum("b","rainbow", "%s and n. CA " %mol)
+cmd.ramp_new("count", obj, [min(bfacts), max(bfacts)], "rainbow")
+cmd.recolor()
+cmd.bg_color("white")
+#cmd.zoom("all",7)
+#cmd.set("all_states","on")
+cmd.save("fluct.pse")
+cmd.png("fluct.png",500,400,ray=1)
+cmd.quit()
+
+
diff --git a/files/fluct_plot.py b/files/fluct_plot.py
new file mode 100755 (executable)
index 0000000..b05ede1
--- /dev/null
@@ -0,0 +1,56 @@
+#! /usr/bin/env python
+import sys
+import math
+
+import matplotlib
+#matplotlib.use('GTK')
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
+
+
+iatom=0
+nmol=0
+sx={}
+sy={}
+sz={}
+s2x={}
+s2y={}
+s2z={}
+with open(sys.argv[1]) as f:
+   for line in f:
+      if line[0:4]=='ATOM' and line[13:15]=='CA':
+#         print line
+         x=float(line[30:38])         
+         y=float(line[38:46])
+         z=float(line[46:54])
+#         print x,y,z
+         iatom=iatom+1 
+         sx[iatom]=sx.get(iatom,0)+x
+         sy[iatom]=sy.get(iatom,0)+y
+         sz[iatom]=sz.get(iatom,0)+z
+         s2x[iatom]=s2x.get(iatom,0)+x*x
+         s2y[iatom]=s2y.get(iatom,0)+y*y
+         s2z[iatom]=s2z.get(iatom,0)+z*z
+
+         
+      if line[0:6]=='ENDMDL':    
+         natom=iatom
+         iatom=0
+         nmol=nmol+1
+
+x=[]
+y=[]
+for i in range(1,natom+1):
+   fluct=math.sqrt((s2x.get(i)-sx.get(i)*sx.get(i)/nmol\
+                   +s2y.get(i)-sy.get(i)*sy.get(i)/nmol\
+                   +s2z.get(i)-sz.get(i)*sz.get(i)/nmol  )/nmol)
+   print fluct
+   x.append(i)
+   y.append(fluct)
+
+plt.xlabel('residue')
+plt.ylabel('fluctuations')
+plt.xlim(0,natom+1)
+plt.plot(x,y,'-')
+plt.savefig('fluct_plot.png')
+                               
\ No newline at end of file
diff --git a/files/overlap.pml b/files/overlap.pml
new file mode 100644 (file)
index 0000000..ca61ac8
--- /dev/null
@@ -0,0 +1,3 @@
+load file_MD000.pdb
+intra_fit ( name ca )
+save intra_fit.pdb,file_MD000,state=0
index 8acaec5..bdf9161 100755 (executable)
@@ -46,13 +46,25 @@ if ( -f "file_MD000.pdb" ) then
  mkdir tmp
  /users2/local/pymol_1.6/pymol -c ../files/movie.pml
  ffmpeg2theora tmp/aa%4d.png -o md.ogv
- rm -rf tmp
+ if ( `grep -c pdbstart file.inp` ) then
+  /users2/local/pymol_1.6/pymol -c ../files/overlap.pml
+  ../files/fluct_plot.py intra_fit.pdb > fluctuations.txt
+  /users2/local/pymol_1.6/pymol -c -r ../files/fluct.py
+  rm -f intra_fit.pdb
+ endif
+ rm -rf tmp 
 else
  /users2/czarek/UNRES/git3_tmp/build/bin/xdrf2pdb-mult one file.seq file_MD000.cx
  mkdir tmp
  /users2/local/pymol_1.6/pymol -c ../files/movie.pml
  ffmpeg2theora tmp/aa%4d.png -o md.ogv
- rm -rf tmp file_MD000.pdb
+ if ( `grep -c pdbstart file.inp` ) then 
+  /users2/local/pymol_1.6/pymol -c ../files/overlap.pml
+  ../files/fluct_plot.py intra_fit.pdb > fluctuations.txt
+  /users2/local/pymol_1.6/pymol -c -r ../files/fluct.py
+  rm -f intra_fit.pdb
+ endif
+ rm -rf tmp file_MD000.pdb 
 endif
 
 touch finished
index 177085f..57900e0 100755 (executable)
@@ -46,13 +46,25 @@ if ( -f "file_MD000.pdb" ) then
  mkdir tmp
  /users2/local/pymol_1.6/pymol -c ../files/movie.pml
  ffmpeg2theora tmp/aa%4d.png -o md.ogv
- rm -rf tmp
+ if ( `grep -c pdbstart file.inp` ) then
+  /users2/local/pymol_1.6/pymol -c ../files/overlap.pml
+  ../files/fluct_plot.py intra_fit.pdb > fluctuations.txt
+  /users2/local/pymol_1.6/pymol -c -r ../files/fluct.py
+  rm -f intra_fit.pdb
+ endif
+ rm -rf tmp 
 else
  /users2/czarek/UNRES/git3_tmp/build/bin/xdrf2pdb-mult one file.seq file_MD000.cx
  mkdir tmp
  /users2/local/pymol_1.6/pymol -c ../files/movie.pml
  ffmpeg2theora tmp/aa%4d.png -o md.ogv
- rm -rf tmp file_MD000.pdb
+ if ( `grep -c pdbstart file.inp` ) then 
+  /users2/local/pymol_1.6/pymol -c ../files/overlap.pml
+  ../files/fluct_plot.py intra_fit.pdb > fluctuations.txt
+  /users2/local/pymol_1.6/pymol -c -r ../files/fluct.py
+  rm -f intra_fit.pdb
+ endif
+ rm -rf tmp file_MD000.pdb 
 endif
 
 touch finished