-
Notifications
You must be signed in to change notification settings - Fork 3
/
graph_hole.py
44 lines (34 loc) · 997 Bytes
/
graph_hole.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import MDAnalysis as mda
import re
import matplotlib.pyplot as plt
import numpy as np
#data=np.loadtxt('../lastframe.sph',dtype=str)
#rad=np.array(data[:,-1],dtype=float)
#print (rad)
#z=np.array(data[:,8],dtype=float)[rad<12]
#rad=rad[rad<12]
#z=np.array(range(len(rad)))*0.2
file_list=['hole000.sph']
legend=["cryo-em structure"]
y_max=0
for i in range(len(file_list)):
u=mda.Universe(file_list[i],topology_format='PDB')
z=u.atoms.positions[:,2]
rad=u.atoms.tempfactors
z, rad = (list(t) for t in zip(*sorted(zip(z, rad))))
z=np.array(z)
rad=np.array(rad)
rad=rad[z>115]
z=z[z>115]
rad=rad[z<160]
z=z[z<160]
if y_max < np.max(rad):
y_max=np.max(rad)
plt.ylim([0,y_max*1.1])
plt.xlabel('distance into pore (z axis $\AA$)')
plt.ylabel('pore radius $\AA$')
plt.plot(z,rad,label=legend[i])
plt.legend()
#plt.savefig('test.pdf')
plt.title('Comparison Between Flooded Structure and Cryo EM Structure')
plt.show()