From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Feb 10 2005 - 10:57:19 CST

Lubos,
  You can query the resid/resnames in a structure pretty easily by querying
with '$sel get {resid resname}', that'll return a list of resid/resname pairs.
To sort them out and produce a minimal list, you could do something like this:
  set sel [atomselect top "all"]
  $sel get {resid resname}
  set uniqlist [lsort -unique [$sel get {resid resname}]]

  John Stone
  vmd_at_ks.uiuc.edu

On Thu, Feb 10, 2005 at 09:46:53AM +0100, Lubos Vrbka wrote:
> hello!
>
> my last mail seems to get lost in the cyberspace, so i'm posting once
> more the same question...
>
> i am almost done with the script for analysis of prefferential
> adsorption... i think i'll post it here in case it would be of some use
> for others... currently, i'm solving small problem:
> how to "map" residue id to residue name?
> it seems that all atomselect's are based on atom numbers, however in my
> case i've got residue id based data and i want to assign appropriate
> names to it. currently i use following code
> ...
> # make some mappings
> set all [atomselect top all]
> # resid map for every atom
> set allResid [$all get resid]
> # resname map for every atom
> set allResname [$all get resname]
> # position for every atom
> foreach resID $allResid resNAME $allResname {
> set mapResidResname($resID) $resNAME
> }
> ...
> # assign residue name (resnameA) to residue id (residA) and print
> foreach {tmp resnameA} [split [array get mapResidResname $residA] ] break
> ...
> is there easier way to do this? i.e. does somewhere in vmd exist a list
> with [resid resname] elements?
>
> best regards,
> lubos
>
> --
> Lubos
> _@_"

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078