From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Mon Aug 11 2008 - 11:01:48 CDT

On Mon, 11 Aug 2008, bo baker wrote:

BB> Hello, Axel:

hello bo,

BB> Thank you very much! Your script is the one that I need exactly. And
BB> it works perfect.
BB>
BB> Just one more question here. Instead of "atomselect", could I ask VMD
BB> to just select the residues?

no. a "residueselect" command does not exist (yet?).
but you can achieve the same effect through postprocessing
the list returned by atomselect. e.g. with something like:

set resdata [$sel get {residue resname resid}]
set oldres -1
set newdata {}
foreach atom $resdata {
  set res [lindex $atom 0]
  if {$oldres != $res } {
    set oldres $res
    lappend newdata $atom
  }
}

now $newdata should contain a reduced list
with only one entry per residue.

cheers,
   axel.

BB>
BB> Cheers
BB>
BB> Bo
BB>
BB> On 8/11/08, Axel Kohlmeyer <akohlmey_at_cmm.chem.upenn.edu> wrote:
BB> > On Sun, 10 Aug 2008, bo baker wrote:
BB> >
BB> > BB> Hello,
BB> >
BB> > hello bo,
BB> >
BB> > BB> I use VMD to do some analysis works on the residues between the
BB> > BB> interaction site from two protein. From "graph presentation", I select
BB> > BB> the residues "chain B and within 5 of chain A". It returns several
BB> > BB> residues in the main display. In order to know all these residues, I
BB> > BB> use "lable" to click on each.
BB> > BB>
BB> > BB> I need to exam a large amount conformations of the complex later on.
BB> > BB> It is time consuming to write down the residues from each
BB> > BB> conformation, plus easy to make a mistake. I wonder if there is a way
BB> > BB> that I could save my selections, I mean the residue ID in text form,
BB> > BB> and plot them later?
BB> >
BB> > this is what can be done best using the tcl (or python) scripting
BB> > interface in VMD. have a look at the corresponding descriptions and
BB> > examples in the VMD user's guide and the tutorials referred to from
BB> > the VMD home page.
BB> >
BB> > for your specific example you'd do something like
BB> >
BB> > set sel [atomselect top "chain B and within 5.0 of chain A"]
BB> >
BB> > and then you can get the information you want through:
BB> >
BB> > set res [$sel get {index name resname resid}]
BB> >
BB> > which returns a list lists with several pieces of information
BB> > about each atom in the selection, i.e. here a list of the
BB> > atom index, atom name, residue name, residue id.
BB> >
BB> > please note, that resid is the number from the .psf file
BB> > and "residue" is the unique number vmd assigns to each
BB> > residue (similar to index).
BB> >
BB> > cheers,
BB> > axel.
BB> >
BB> >
BB> > BB>
BB> > BB> Thank you for your help.
BB> > BB>
BB> > BB> Bo
BB> > BB>
BB> >
BB> >
BB> > --
BB> > =======================================================================
BB> > Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu
BB> > Center for Molecular Modeling -- University of Pennsylvania
BB> > Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
BB> > tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
BB> > =======================================================================
BB> > If you make something idiot-proof, the universe creates a better idiot.
BB> >
BB>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.