From: Josh Vermaas (vermaasj_at_msu.edu)
Date: Mon Jul 29 2024 - 09:42:33 CDT

Hi Brian,

My first inclination is to select all of them, lsort by residue to get a
list of residues, and then take the first from that list. If I were to
do it based on name SZ, the following would be even simpler:

set szsel [atomselect top "name SZ"]
set sel [atomselect top "same residue as index [lindex [$szsel get
index] 0]"]

Or you could first generate a tag and select on beta or something if you
don't always want the first one:

set szsel [atomselect top "same residue as name SZ"]
set szres [$szsel get residue]
set betalist [list ]
set prev -1
set beta 0
foreach res $szres {
   if { $res != $prev } {
         incr beta
         set prev $res
   }
    lappend betalist $beta
}
$szres set beta $beta

 From there you could pick out individual residues with beta == 1, beta
== 2, etc.

-Josh

On 7/27/24 7:10 PM, Bennion, Brian wrote:
> Hello,
> Just curious if anyone has done this type of selection before where
> only first one of several identical ligands in a pdb file are selected?
>
> I have pdb files from which I have extracted the hetatm records and I
> only want to keep the first if two or more instances of a ligand are
> present.
>
> My first pass is to read the pdb record and grep for the first
> instances of HET      1SZ  I1625 and use that as an atomselection.  I
> am just not sure how to do that all within vmd...
>
> any thoughts
> brian
>
> Biosciences and Biotechnology Division|PLS|Lawrence Livermore National
> Laboratory|925-422-5722
>
> _Friendly Email Disclaimer_: I’m writing or responding to this email
> at a time that is convenient for my work schedule. Please do the same,
> and don’t feel obligated to respond outside of your standard work hours.
>

-- 
Josh Vermaas
vermaasj_at_msu.edu
Assistant Professor, Plant Research Laboratory and Biochemistry and Molecular Biology
Michigan State University
vermaaslab.github.io