This code reads 1qlz.pdb protein file can be downloaded from http://www.rcsb.org/pdb/files/1QLZ.pdb and plots a 3D graph using maplotlib library. For mystery write to me: devashish.das@educept.com
__author__ = Devashish Das
__contact__ = +91-9964218681
__email__ = deavshish.das@educept.com
__website__ = http://www.educept.com
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 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
__author__ = "Devashish Das"
__contact__ = "+91-9964218681"
__email__ = "deavshish.das@educept.com"
#http://www.educept.com
Store_all = []
with open("1qlz.pdb") as protein:
for lines in protein:
if "ATOM " in lines:
lines = lines.split()
#'ATOM', '1', 'N', 'LEU', 'A', '125', '4.329', '-12.012', '2.376', '1.00', '0.00', 'N'
Store_all.append(map(float, lines[6:9]))
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x,y,z = zip(*Store_all)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot(x,y,z, "o")
ax.axis("off")
plt.show()
|
Watch the video: https://youtu.be/GkadFs-igdQ