From: Chitrak Gupta (chgupta_at_mix.wvu.edu)
Date: Thu Aug 04 2016 - 18:15:02 CDT

Hi Jose,

I am guessing you could do something like this

set allWater [atomselect top "water"]
set allSegId [$allWater get segid]
set uniqSegId [lsort -u $allSegId]

foreach segment $uniqSegId {
   ......
    do your stuff
   ......
}

Hope this helps,
Chitrak.

On Thu, Aug 4, 2016 at 5:50 PM, José Gómez <jgomez_at_dlab.cl> wrote:

> Hi everyone,
> I need to get all the water's segid of a pdb file and write them in
> different pdb file.
> For example:
>
> set water [atomselect top "segid W8"]
> $water writepdb waterW8.pdb
>
> In this case, my pdb file contains 8 different segid, so I could do it
> with a tcl for bucle from 1 to 8, but the problem is what if I have more
> than 8 segid? How can I count them in the same tcl script??? do I need to
> get the position of "WX" (X= segid number) of the line (as a string line)?
>
> Hope you can help me!
> Regards from Chile!
>
> --
> *José Fernando Gómez Ponce*
> *Ingeniero en Bioinformática.*
>
> *Computational Biology Lab (DLab)Fundación Ciencia para la Vida, *
> *Santiago.*
> *+569 66622520 <%2B569%2066622520>*
>