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()


Jordan

On Jan 21, 2013, at 12:21 PM, Alex Truong <atru...@bu.edu> wrote:

> Hi All,
> 
> I've been having a bit of trouble recently with the renumber script. I have a 
> pdb file that I'm trying to renumber, but unlike the other times I've used 
> it, it is renumbering incorrectly. The numbers are usually spaced out 5 
> residues apart, but I have one number right near the beginning that is 6 
> residues down from the previous one. Needless to say, this is screwing up the 
> rest of the count. Is there any idea why? I've provided a screenshot.
> 
> Thanks,
> Alex
> <renumbererror.png>------------------------------------------------------------------------------
> 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 (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


------------------------------------------------------------------------------
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 (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to