[Biojava-l] Iterating over alignment columns

Nathan S. Haigh n.haigh at sheffield.ac.uk
Tue Aug 8 15:18:23 UTC 2006


Richard Holland wrote:
> Hello.
>
> Here's how you can do it:
>
>     Alignment algn = ....; // get an alignment from somewhere
>     for (int col = 1; col <= algn.length(); col++) {
>         List symbols = new ArrayList();
>         for (Iterator labels = algn.labelsAt(col); labels.hasNext(); ) {
>             Object label = labels.next();
>             symbols.add(algn.symbolAt(label,col));
>         }
>         // symbols now contains all symbols at column 'col'
>         // of the alignment.
>     }
>
> cheers,
> Richard
Thanks for this, it looks just like what i need. However, is the method
labelsAt part of the latest CVS version of Biojava - they do not appear
to be in Biojava 1.4 according to eclipse.

Thanks
Nathan



More information about the Biojava-l mailing list