[Bioperl-l] How to change a row/column name in Bio::Matrix::Generic.pm?

Jason Stajich jason.stajich at duke.edu
Sun May 22 22:30:22 EDT 2005


I assume you mean after you've created the Matrix object?

I didn't put an API method in for this directly - maybe we should  
move the init code in the new() function out to this.

You get the row names or col names from:
column_header or row_header methods and/or column_names and row_names.

You'll see they access the internal arrayrefs '_colnames' and  
'_rownames'.
Look at the initializing code in the new() function where these  
internals are initialized.


This should update the row names for you:
my @rownames = qw(ROW1 ROW2 ROW3);
$matrix->{'_rownames'} = [@rownames];

You'll also need to do this so the reverse lookup also works:
my $count = 0;
%{$self->{'_rownamesmap'}} = map { $_ => $count++ } @rownames;

Similarly for columnnames

-jason
On May 20, 2005, at 3:22 PM, Sally Li wrote:

> Hi,
>
> I would like to change the row/column name of a matrix
> built by using  Bio::Matrix::Generic.pm. Could some
> one help me in this issue? If there is no such
> function, could some one suggest some ideas to add
> this function?
>
> Thanks!
> Sally
>
>
>
> __________________________________
> Yahoo! Mail Mobile
> Take Yahoo! Mail with you! Check email on your mobile phone.
> http://mobile.yahoo.com/learn/mail
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12/




More information about the Bioperl-l mailing list