Difference between revisions of "Alter"

From PyMOLWiki
Jump to navigation Jump to search
Line 31: Line 31:
 
<source lang="python">
 
<source lang="python">
 
rebuild
 
rebuild
 +
</source>
 +
 +
* Renumber the amino acids in a protein, so that it starts from 0 instead of its offset as defined in the structure file.
 +
<source lang="python">
 +
# The first residue in the structure file for 1cll is 4.  To change this to 0, maybe to match scripts
 +
# outputted from other programs, just remove the offset of 4 from each atom
 +
alter 1cll, resi=str(int(resi)-4)
 
</source>
 
</source>
  

Revision as of 17:21, 18 February 2007

DESCRIPTION

alter changes one or more atomic properties over a selection using the python evaluator with a separate name space for each atom. The symbols defined in the name space, which are are explained in Iterate are:

name, resn, resi, chain, alt, elem, q, b, segi,
type (ATOM,HETATM), partial_charge, formal_charge,
text_type, numeric_type, ID, vdw

All strings must be explicitly quoted. This operation typically takes several seconds per thousand atoms altered.

WARNING: You should always issue a sort command on an object after modifying any property which might affect canonical atom ordering (names, chains, etc.). Failure to do so will confound subsequent "create" and "byres" operations.

USAGE

alter (selection),expression

EXAMPLES

  • Change chain label and residue index
 alter (chain A),chain='B'
 alter (all),resi=str(int(resi)+100)
 sort
  • Change van der Waals radius of a given atom
alter (name P), vdw=1.90

Not that is if dots, spheres, mesh or surface representation is used. You have to refresh the view with

rebuild
  • Renumber the amino acids in a protein, so that it starts from 0 instead of its offset as defined in the structure file.
# The first residue in the structure file for 1cll is 4.  To change this to 0, maybe to match scripts
# outputted from other programs, just remove the offset of 4 from each atom
alter 1cll, resi=str(int(resi)-4)

SEE ALSO

Cmd alter_state, Cmd iterate, Cmd iterate_state, Cmd sort