From c297d71bf7b0960c3b3294786418e796220696eb Mon Sep 17 00:00:00 2001 From: Cezary Czaplewski Date: Sun, 10 Sep 2017 02:15:18 +0200 Subject: [PATCH] md pdbstart fluctuations --- django_simple/todo/templates/details.html | 24 +++++++++++++ files/fluct.py | 39 ++++++++++++++++++++ files/fluct_plot.py | 56 +++++++++++++++++++++++++++++ files/overlap.pml | 3 ++ files/pbs_md.csh | 16 +++++++-- files/pbs_md_new.csh | 16 +++++++-- 6 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 files/fluct.py create mode 100755 files/fluct_plot.py create mode 100644 files/overlap.pml diff --git a/django_simple/todo/templates/details.html b/django_simple/todo/templates/details.html index 6a7f396..a2d2eb5 100644 --- a/django_simple/todo/templates/details.html +++ b/django_simple/todo/templates/details.html @@ -322,6 +322,30 @@ Created {{ task.created_date }} {% endif %} + + {% if task.md_start == "pdbstart" %} +
  • +
    fluctuations
    +
    +
  • + +
  • +
    fluctuations putty on + starting structure
    +
    + +
    +
  • + + {% endif %} + + + {% endif %} {% if task.type == "remd" %} diff --git a/files/fluct.py b/files/fluct.py new file mode 100644 index 0000000..760edae --- /dev/null +++ b/files/fluct.py @@ -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 index 0000000..b05ede1 --- /dev/null +++ b/files/fluct_plot.py @@ -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 index 0000000..ca61ac8 --- /dev/null +++ b/files/overlap.pml @@ -0,0 +1,3 @@ +load file_MD000.pdb +intra_fit ( name ca ) +save intra_fit.pdb,file_MD000,state=0 diff --git a/files/pbs_md.csh b/files/pbs_md.csh index 8acaec5..bdf9161 100755 --- a/files/pbs_md.csh +++ b/files/pbs_md.csh @@ -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 diff --git a/files/pbs_md_new.csh b/files/pbs_md_new.csh index 177085f..57900e0 100755 --- a/files/pbs_md_new.csh +++ b/files/pbs_md_new.csh @@ -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 -- 1.7.9.5