User:Wayne Decatur/I-Ppo Morph Methods: Difference between revisions

From Proteopedia
Jump to navigationJump to search
Wayne Decatur (talk | contribs)
No edit summary
Wayne Decatur (talk | contribs)
No edit summary
Line 9: Line 9:
the program:
the program:


<code>
<pre>
from Bio.PDB.PDBParser import PDBParser <br>
from Bio.PDB.PDBParser import PDBParser  


parser = PDBParser()<br>
parser = PDBParser()


structure = parser.get_structure('test', 'test.pdb')<br>
structure = parser.get_structure('test', 'test.pdb')
header = parser.get_header()<br>
header = parser.get_header()
trailer = parser.get_trailer()<br>
trailer = parser.get_trailer()


for model in structure:<br>
for model in structure:
     for chain in model:<br>
     for chain in model:
         i = 2493<br>
         i = 2493
         for residue in chain:<br>
         for residue in chain:
             residue.id = (' ', i, ' ')<br>
             residue.id = (' ', i, ' ')
             i += 1<br>
             i += 1


from Bio.PDB import PDBIO<br>
from Bio.PDB import PDBIO


w = PDBIO()<br>
w = PDBIO()
w.set_structure(structure)<br>
w.set_structure(structure)
w.save('test-r1.pdb')
w.save('test-r1.pdb')
<br>
</pre>
</code>




Line 41: Line 40:


<pre>
<pre>
pdb = open("test.pdb", "r") <br>
pdb = open("test.pdb", "r")  


i = 2493 <br>
i = 2493
for line in pdb: <br>
for line in pdb:
     if line[:4] == 'ATOM':    #so only does atoms and not comments or other lines <br>
     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 <br>
         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]<br>
             print line [:7] + str(i) + line [11:-1]
             i += 1<br>
             i += 1
</pre>
</pre>