In [ ]:
from IPython.display import HTML
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/zV949buXdSg?autoplay=1&loop=1" frameborder="0" allowfullscreen></iframe>')
Entries are determined by columns in the file, not by spaces between the columns
In [ ]:
#record atom_name chain x y z occupancy atom_type
# | | | | | | | |
#ATOM 1086 CG LYS A 141 -4.812 9.683 2.584 1.00 26.78 N0
# | | | |
# atom_num amino_acid resid_num bfactor
In [ ]:
line_frompdb = "ATOM 1086 N SER A 141 -4.812 9.683 2.584 1.00 26.78 N0"
print(line_frompdb[2:4])
Write a program that:
In [ ]:
#record atom_name chain x y z occupancy atom_type
# | | | | | | | |
#ATOM 1086 CG LYS A 141 -4.812 9.683 2.584 1.00 26.78 N0
# | | | |
# atom_num amino_acid resid_num bfactor
In [ ]:
f = open("data/1stn.pdb")
g = open("1stn_shifted.pdb","w")
for line in f.readlines():
if line[0:4] == "ATOM" and line[13:16] == "CA ":
first_chunk = line[:30]
x = line[30:38]
last_chunk = line[38:]
new_x = float(x) + 10
g.write("{:}{:8.3f}{:}".format(first_chunk,new_x,last_chunk))
f.close()
g.close()