[Bioperl-l] sorting and indexing matricies

PD Schloss pds at plantpath.wisc.edu
Tue Jun 24 21:17:19 EDT 2003


Hello,

I have a distance matrix that I am working with and I would like to sort
it so that the columns and rows containing the smallest distance are in
the first and second rows and columns.  I understand how to sort a
simple array, however, I am confused as to how I do it with an array of
arrays.  I'm a beginner so I realize that constructing a matrix this way
may not be the most efficient, but at this point I think I would prefer
to do it this way.  If you have any thoughts on how to do this type of
sort, I'd appreciate it.

Also, the only way I can figure out how to write out the contents of my
matrix is by nesting for loops.  Is there a way to write out individual
columns and rows without doing these for loops?  I guess I'm thinking of
MatLab that let's you do something like @matrix[0][:] (for the first
row/column of the matrix).

Thanks for your help,
Pat Schloss



More information about the Bioperl-l mailing list