Hi Jordan,
nice script, but it does not do the same like the renumber script from
the PyMOLWiki (http://pymolwiki.org/index.php/Renumber). Try this: set
all residue numbers to 1, the renumber script will not care because it
walks along the bonds and increases the count whenever it passes a
peptide bond. The Biopython parser however will read just one residue.
Cheers,
Thomas
Jordan Willis wrote, On 01/21/13 19:53:
> Does it have to be a pymol script. Renumbering pdbs is the bread and butter
> of biopython pdb module:
>
> #!/blue/meilerlab/apps/Linux2/x86_64/bin/python2.5
> import sys
> from Bio.PDB import *
> from optparse import OptionParser
> import warnings
> def main():
> usage = "%prog input.pdb output.pdb"
> parser= OptionParser(usage)
> parser.add_option("-n",dest="start",help="residue number to start with,
> default is 1",default=1)
> parser.add_option("--preserve",dest="preserve",help="preserve insertion
> code and heteroflags",default=False, action="store_true")
> parser.add_option("--norestart",dest="norestart",help="don't start
> renumbering at each chain, default=False",default=False, action="store_true")
> (options, args) = parser.parse_args()
>
> warnings.simplefilter('ignore',PDBExceptions.PDBConstructionWarning)
> PDBparse = PDBParser(PERMISSIVE=1)
> struct = PDBparse.get_structure(args[0][0:3],args[0])
> residue_id = int(options.start)
> chain_id = ""
> for residue in struct.get_residues():
> chain = residue.get_parent()
> if(chain_id != chain.get_id() and not options.norestart):
> chain_id = chain.get_id()
> residue_id=int(options.start)
> if(options.preserve):
> hetero = residue.id[0]
> insert = residue.id[2]
> residue.id=(hetero,residue_id,insert)
> else:
> residue.id=(' ',residue_id,' ')
> residue_id +=1
>
>
> io=PDBIO()
> io.set_structure(struct)
> io.save(args[1])
>
> if __name__ == "__main__":
> main()
--
Thomas Holder
PyMOL Developer
Schrödinger Contractor
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
PyMOL-users mailing list ([email protected])
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/[email protected]