reading SSBOND corrected
[django_unres.git] / files / fluct_plot.py
index b05ede1..7719b2f 100755 (executable)
@@ -6,7 +6,7 @@ import matplotlib
 #matplotlib.use('GTK')
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt
-
+import os.path
 
 iatom=0
 nmol=0
@@ -48,9 +48,30 @@ for i in range(1,natom+1):
    x.append(i)
    y.append(fluct)
 
+b=[]
+newchain=True
+if os.path.exists('plik.pdb'):
+ with open('plik.pdb') as f:
+   for line in f:
+      if line[0:4]=='ATOM' and line[13:15]=='CA':
+#         print line
+        if newchain or int(line[22:26])>ires:
+         b.append(math.sqrt(float(line[60:66])*3/8/math.pi/math.pi))
+         ires=int(line[22:26])         
+         newchain=False
+      if line[0:3]=='TER':
+        newchain=True
+      if line[0:3]=='END':
+        break
+                        
+
+
 plt.xlabel('residue')
 plt.ylabel('fluctuations')
 plt.xlim(0,natom+1)
 plt.plot(x,y,'-')
+if len(b)!=0:
+ plt.plot(x,b,'-',c='red')
+ plt.legend(['fluctuations','sqrt(3*bfactor/8*pi^2)'])
 plt.savefig('fluct_plot.png')
                                
\ No newline at end of file