[Biopython] chanding res id

Bala subramanian bala.biophysics at gmail.com
Wed Apr 29 09:15:50 UTC 2009


Friends,
Following is a script that i wrote to change the resid. This works with
single pdb file but if i use a NMR with multiple models i get an error
message. I hope there shd be a loop or some fancy way to iterate over all
the models in the NMR structure. Kindly help me in doing the same.
#!/usr/bin/env python
from Bio.PDB import PDBParser
from Bio.PDB import PDBIO
from sys import argv
outfile=raw_input('enter outfile name: ')
par=PDBParser()
s=par.get_structure('x',argv[1])
for index, residue in enumerate(s.get_residues()):
     residue.id=(" ", index, " ")
out=PDBIO()
out.set_structure(s)
out.save(outfile)

Bala



More information about the Biopython mailing list