From: Cezary Czaplewski Date: Tue, 12 Sep 2017 21:27:58 +0000 (+0200) Subject: pdb without CHAIN working again and plot fluct+bfactor X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=2bf36f0ee6cb5e4e8e3267faa27fc84ef9f1ab38;hp=d1f5863de9771a95b9fd56e5a87add4e0f3ca0e4;p=django_unres.git pdb without CHAIN working again and plot fluct+bfactor --- diff --git a/django_simple/todo/views.py b/django_simple/todo/views.py index 4ffb0e7..4f3b4e5 100644 --- a/django_simple/todo/views.py +++ b/django_simple/todo/views.py @@ -58,11 +58,13 @@ def from_pdb(file): sequence.append(aa) ires.append(i) if newchain: - chain_start[chain[ichain]]=i + if len(chain)>0: + chain_start[chain[ichain]]=i newchain = False if line[0:3] == 'TER': sequence.append('XX') - chain_end[chain[ichain]]=i + if len(chain)>0: + chain_end[chain[ichain]]=i ichain=ichain+1 newchain = True if line[0:6] == 'SSBOND': diff --git a/files/fluct_plot.py b/files/fluct_plot.py index b05ede1..8d6e214 100755 --- a/files/fluct_plot.py +++ b/files/fluct_plot.py @@ -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,22 @@ for i in range(1,natom+1): x.append(i) y.append(fluct) +b=[] +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 + b.append(math.sqrt(float(line[60:66])*3/8/math.pi/math.pi)) + + + 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