Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Zero residues
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== CODE == <source lang="python"> from pymol import cmd, stored def zero_residues(sel1,offset=0,chains=0): """ DESCRIPTION Renumbers the residues so that the first one is zero, or offset USAGE zero_residues selection [, offset [, chains ]] EXAMPLES zero_residues protName # first residue is 0 zero_residues protName, 5 # first residue is 5 zero_residues protName, chains=1 # each chain starts at 0 zero_residues * """ offset = int(offset) # variable to store the offset stored.first = None # get the names of the proteins in the selection names = ['(model %s and (%s))' % (p, sel1) for p in cmd.get_object_list('(' + sel1 + ')')] if int (chains): names = ['(%s and chain %s)' % (p, chain) for p in names for chain in cmd.get_chains(p)] # for each name shown for p in names: # get this offset ok = cmd.iterate("first %s and polymer and n. CA" % p,"stored.first=resv") # don't waste time if we don't have to if not ok or stored.first == offset: continue; # reassign the residue numbers cmd.alter("%s" % p, "resi=str(int(resi)-%s)" % str(int(stored.first)-offset)) # update pymol cmd.rebuild() # let pymol know about the function cmd.extend("zero_residues", zero_residues) </source> [[Category:Script_Library|Zero Residues]] [[Category:ObjSel_Scripts]]
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Zero residues
(section)
Add topic