User:Wayne Decatur/I-Ppo Morph Methods: Difference between revisions
From Proteopedia
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
the program: | the program: | ||
< | <pre> | ||
from Bio.PDB.PDBParser import PDBParser | from Bio.PDB.PDBParser import PDBParser | ||
parser = PDBParser() | parser = PDBParser() | ||
structure = parser.get_structure('test', 'test.pdb') | structure = parser.get_structure('test', 'test.pdb') | ||
header = parser.get_header() | header = parser.get_header() | ||
trailer = parser.get_trailer() | trailer = parser.get_trailer() | ||
for model in structure: | for model in structure: | ||
for chain in model: | for chain in model: | ||
i = 2493 | i = 2493 | ||
for residue in chain: | for residue in chain: | ||
residue.id = (' ', i, ' ') | residue.id = (' ', i, ' ') | ||
i += 1 | i += 1 | ||
from Bio.PDB import PDBIO | from Bio.PDB import PDBIO | ||
w = PDBIO() | w = PDBIO() | ||
w.set_structure(structure) | w.set_structure(structure) | ||
w.save('test-r1.pdb') | w.save('test-r1.pdb') | ||
</pre> | |||
</ | |||
| Line 41: | Line 40: | ||
<pre> | <pre> | ||
pdb = open("test.pdb", "r") | pdb = open("test.pdb", "r") | ||
i = 2493 | i = 2493 | ||
for line in pdb: | for line in pdb: | ||
if line[:4] == 'ATOM': #so only does atoms and not comments or other lines | if line[:4] == 'ATOM': #so only does atoms and not comments or other lines | ||
if line[13:16] != 'H5*': #added this because the unbound DNA I got from Model It seemed to have H5* atoms that 1a73 did not so I didn't want those lines | if line[13:16] != 'H5*': #added this because the unbound DNA I got from Model It seemed to have H5* atoms that 1a73 did not so I didn't want those lines | ||
print line [:7] + str(i) + line [11:-1] | print line [:7] + str(i) + line [11:-1] | ||
i += 1 | i += 1 | ||
</pre> | </pre> | ||