From: Nicolas Sapay (nsapay_at_ucalgary.ca)
Date: Fri Sep 21 2007 - 13:22:45 CDT

Hello,

I have written a procedure to renumber the resids of a selection. To do
that, I select the residues with the 'residue' keyword and then assign a
new 'resid' to the selection.
#======================================
1 proc renumber_resid { molid seltext {start 1} } {
2 # Number residue Ids of a selection from <start>
3 # USAGE :renumber_resid 0 "protein" 123
4
5 set sel [ atomselect $molid "$seltext" ]
6 # Retrieve the 'residue' number of the selection
7 set reslist [ lsort -integer -unique [ $sel get residue ] ]
8
9 # Assign a new 'resid' to each residue of the selection
10 foreach res $reslist {
11 # Do a temporary selection
12 set tmpsel [ atomselect $molid "$seltext and residue
$res" ]
13 $tmpsel set resid $start
14 $tmpsel delete
15 # Increment the new resid
16 incr start
17 }
18 $sel delete
19 return
20}
#======================================
However, the proc doesn't work with a simple system of 214 identical
residues (it's a membrane bilayer). When I use the 'residue' keyword at
line 7, I obtain a list of 218 'residue' which is wrong. But when I do
the same thing using the 'resid' keyworkd, I obtain a correct list of
214 'resid'. Why do the 'residue' keyword give me 4 more residues? (When
I do the renumbering, the resids start to be wrong at 200)

Thanks for your help. I hope I'm not too confusing with all this
'residue' and 'resid'

Nicolas