From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Fri Jul 29 2005 - 02:13:59 CDT

On Thu, 28 Jul 2005, Ioana Cozmuta wrote:

ioana,

IC> Axel,
IC> My pdb file is complete and has no missing residues. Just to clarify,
IC> here's what I understood (may be useful for others as well as I think it's
IC> easy to mistake):
IC> When defining selections, "residue" or "resid" should be used
IC> consistently. For example:

your are correct. you have to be consistent, but let me re-iterate
the subtle differences in the semantics between residue and resid.
in your case, this does not show, but for others it does. thus it is
important to get used to it, even if it does not matter, so you don't
get surprised in cases where it matters.

you should use 'residue' when you want to feed the result of the
selection to another selection, as this is guaranteeing uniqueness.
you should use 'resid' when you want to query the residue numbers
as given in your topology/pdb file. quite a few programs i am dealing
with, start e.g. numbering solvent residues from 1, so 'resid 10' can
match multiple residues and you'd have to combine it with additional
qualifiers like 'chain' or others.

IC> set residues [lsort -unique [[atomselect top "protein and same residue as
IC> within 3 of resname RC5" frame $frame ] get RESID]]
IC> which gives: 325
IC> set rn [atomselect top "protein and RESID $residues"]
IC> set inform [lsort -unique [$rn get "resid resname"]
IC> {325 ASN}
IC> VERSUS
IC> set residues [lsort -unique [[atomselect top "protein and same residue as
IC> within 3 of resname RC5" frame $frame ] get RESIDUE ]]
IC> which gives: 324
IC> set rn [atomselect top "protein and RESIDUE $residues"]
IC> set inform [lsort -unique [$rn get "resid resname"]
IC> {325 ASN}
IC> So my mistake was in setting the "$rn" definition.

IC> Just a minor clarification: You can also retrieve the resid/resname from
IC> the screen by pressing "1" on the keyboard and then clicking the selection.
IC> I assume this is using the internal TCL convention, right (not that it
IC> matters, either way the output should be the same). In general, any

well, i prefer doing this with "0" as it does not add labels.

but please look closely, you'll see, that the VMD outputs the
'resid' and this is using the numbers from your file and _not_
the internal conventions, as explained above.

axel.

IC> operation within VMD is performed using the 0-based convention.
IC> Ioana
IC>
IC>
IC>
IC> On 7/27/05, Axel Kohlmeyer <axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de>
IC> wrote:
IC> >
IC> > On Tue, 26 Jul 2005 ioana_at_pegasus.arc.nasa.gov wrote:
IC> >
IC> > IC> Hi all,
IC> >
IC> > dear ioana,
IC> >
IC> > please re-check your scripts carefully.
IC> >
IC> > residue is the internal residue number in VMD this
IC> > number is guaranteed to be unique and starts from 0.
IC> >
IC> > resid is the residue number from the PBD/PSF file
IC> > and may _not_ be unique (it is taken as is).
IC> > this number will start from 1 in case of a standard
IC> > conformant PDB file. but for quite few PDB files
IC> > there are residues missing (e.g. in sloppy areas),
IC> > where the sequence is known, but the coordinates are not.
IC> >
IC> > you must not feed the result of get resid to a selection
IC> > with residue and vice versa (as done below).
IC> >
IC> > best regards,
IC> > axel.
IC> >
IC> > IC>
IC> > IC> I am trying to output the name/id of a simple selection througout a
IC> > IC> trajectory file.
IC> > IC> I read in the pdb file, set up the selection
IC> > IC> set nb [atomselect top "protein and same residue as within 3 of
IC> > resname
IC> > IC> RC5"]
IC> > IC> ask for the resid/resname
IC> > IC>
IC> > IC> lsort -unique [$nb get resid]
IC> > IC> 325
IC> > IC> lsort -unique [$nb get resname]
IC> > IC> ASN
IC> > IC>
IC> > IC> When I want to get that from a script and write the results in a file
IC> > I
IC> > IC> get a totally different answer:
IC> > IC> set frame 0
IC> > IC> animate goto $frame
IC> > IC>
IC> > IC> set residues [lsort -unique [[atomselect top "protein and same residue
IC> > as
IC> > IC> within 3 of resname RC5" frame $frame ] get residue ]]
IC> > IC> puts $residues
IC> > IC> 324
IC> > IC>
IC> > IC> set rn [atomselect top "protein and resid $residues"]
IC> > IC> set inform [lsort -unique [$rn get "resid resname"]]
IC> > IC> {324 ALA}
IC> > IC>
IC> > IC> The PDB file has indeed the 1-based counter while TCL when it reads
IC> > the
IC> > IC> file in renumbers the residues according to a 0-based counter. However
IC> > as
IC> > IC> long as it's one or the other the results should be the same. There
IC> > should
IC> > IC> be no mixing between the two, or else results that output into the
IC> > result
IC> > IC> file are incorrect.
IC> > IC>
IC> > IC> However if I set up the "residues" selection as set residues [lsort
IC> > IC> -unique [[atomselect top "protein and same residue as within 3 of
IC> > resname
IC> > IC> RC5" frame $frame ] get resid ]]
IC> > IC> It gives the correct number
IC> > IC> puts $residues
IC> > IC> {325 ASN}
IC> > IC>
IC> > IC> What is the difference when setting up the atomselect command and
IC> > asking
IC> > IC> to
IC> > IC> get residue
IC> > IC> versus
IC> > IC> get resid
IC> > IC>
IC> > IC> Why is one 0-based and the other 1-based?
IC> > IC>
IC> > IC> THanks,
IC> > IC> Ioana
IC> > IC>
IC> > IC>
IC> >
IC> > --
IC> >
IC> > =======================================================================
IC> > Dr. Axel Kohlmeyer e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de
IC> > Lehrstuhl fuer Theoretische Chemie Phone: ++49 (0)234/32-26673
IC> > Ruhr-Universitaet Bochum - NC 03/53 Fax: ++49 (0)234/32-14045
IC> > D-44780 Bochum http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
IC> > =======================================================================
IC> > If you make something idiot-proof, the universe creates a better idiot.
IC> >
IC> >
IC>
IC>
IC>

-- 
=======================================================================
Dr. Axel Kohlmeyer   e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum  http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.