Bio::M...eneric(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

Bio::Matrix::Generic β€” bestie, it's a generic matrix implementation, and it literally ate πŸ’…


✨ SYNOPSIS ✨

okay so a matrix has columns AND rows, that's the whole vibe:

# A matrix has columns and rows
my $matrix = Bio::Matrix::Generic->new;
$matrix->add_column(1,$column1);
$matrix->add_column(2,$column2);

my $element = $matrix->entry_by_num(1,2);
$matrix->entry_by_num(1,2,$newval);

my $entry = $matrix->entry('human', 'mouse');

$matrix->entry('human','mouse', $newval);

πŸ¦‹ DESCRIPTION πŸ¦‹

so this is a general purpose matrix object for dealing with row+column data, which is exactly the situation you end up in when you're enumerating all the pairwise combinations and you want to get slices of the data 🍰

you can access data by column and row names or by indexes. and listen β€” matrix indexes start at 0. zero. not one. zero. no cap πŸ’€


πŸ“¬ FEEDBACK πŸ“¬

Mailing Lists πŸ’Œ

user feedback is an integral part of the evolution of this and other Bioperl modules, bestie, it's giving community 🫢 send your comments and suggestions preferably to the Bioperl mailing list. your participation is much appreciated, fr fr ✨

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support πŸ›Ÿ

please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. many experienced and reponsive experts will be able look at the problem and quickly address it. please include a thorough description of the problem with code and data examples if at all possible. the more detail the better, queen πŸ‘‘

Reporting Bugs πŸ›

report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues

not me submitting a bug report β€” slay, they'll actually fix it 🌈


πŸ‘‘ AUTHOR - Jason Stajich πŸ‘‘

Email jason-at-bioperl-dot-org


πŸŽ€ APPENDIX πŸŽ€

the rest of the documentation details each of the object methods. internal methods are usually preceded with a _ (iykyk β€” underscore means private, don't touch her unless you know what you're doing πŸ’…)

new ✨

Title   : new
Usage   : my $obj = Bio::Matrix::Generic->new();
Function: Builds a new Bio::Matrix::Generic object
Returns : an instance of Bio::Matrix::Generic
Args    : -values     => arrayref of arrayrefs of data initialization
          -rownames   => arrayref of row names
          -colnames   => arrayref of col names
          -matrix_id  => id of the matrix
          -matrix_name=> name of the matrix
          -matrix_init_value => default value to initialize empty cells

matrix_id πŸ†”

Title   : matrix_id
Usage   : my $id = $matrix->matrix_id
Function: Get/Set the matrix ID
Returns : scalar value
Args    : [optional] new id value to store

matrix_name πŸ“›

Title   : matrix_name
Usage   : my $name = $matrix->matrix_name();
Function: Get/Set the matrix name
Returns : scalar value
Args    : [optional] new matrix name value

entry 🎯

Title   : entry
Usage   : my $entry = $matrix->entry($row,$col,$value)
Function: Get the value for a specific cell as specified
          by the row and column names
Returns : scalar value or undef if row or col does not
          exist
Args    : $rowname - name of the row
          $colname - column name
          $value   - [optional] New value for the entry
heads up bestie: if the row or col doesn't exist you get undef back, not an error. vibe check passed but the cell is empty πŸ’€

get_entry πŸ”

Title   : get_entry
Usage   : my $entry = $matrix->get_entry($rowname,$columname,$value)
Function: Get the entry for a given row,column pair
Returns : scalar
Args    : $row name
          $column name
          $value

entry_by_num πŸ”’

Title   : entry_by_num
Usage   : my $entry = $matrix->entry_by_num($rownum,$colnum)
Function: Get an entry by row and column numbers instead of by name
          (rows and columns start at 0)
Returns : scalar value or undef if row or column name does not
          exist
Args    : $row - row number
          $col - column number
          [optional] $newvalue to store at this cell

column πŸ“Š

Title   : column
Usage   : my @col = $matrix->column('ALPHA');
          OR
          $matrix->column('ALPHA', \@col);
Function: Get/Set a particular column
Returns : Array (in array context) or arrayref (in scalar context)
          of values.
          For setting will warn if the new column is of a different
          length from the rest of the columns.
Args    : name of the column
          [optional] new column to store here
okay so if you set a column and it's a different length from all the other columns, she will warn at you. just a heads up 🫣

get_column πŸ“₯

Title   : get_column
Usage   : my @row = $matrix->get_column('ALPHA');
Function: Get a particular column
Returns : Array (in array context) or arrayref (in scalar context)
          of values
Args    : name of the column

column_by_num #️⃣

Title   : column_by_num
Usage   : my @col = $matrix->column_by_num(1);
          OR
          $matrix->column_by_num(1,\@newcol);
Function: Get/Set a column by its number instead of name
          (cols/rows start at 0)
Returns : Array (in array context) or arrayref (in scalar context)
          of values
Args    : name of the column
          [optional] new value to store for a particular column

row πŸ“

Title   : row
Usage   : my @row = $matrix->row($rowname);
            OR
          $matrix->row($rowname,\@rowvalues);
Function: Get/Set the row of the matrix
Returns : Array (in array context) or arrayref (in scalar context)
Args    : rowname
          [optional] new value of row to store

get_row πŸ“€

Title   : get_row
Usage   : my @row = $matrix->get_row('ALPHA');
Function: Get a particular row
Returns : Array (in array context) or arrayref (in scalar context)
          of values
Args    : name of the row

row_by_num πŸ”Ÿ

Title   : row_by_num
Usage   : my @row = $matrix->row_by_num($rownum);
            OR
          $matrix->row($rownum,\@rowvalues);
Function: Get/Set the row of the matrix
Returns : Array (in array context) or arrayref (in scalar context)
Args    : rowname
          [optional] new value of row to store

diagonal πŸ“

Title   : diagonal
Usage   : my @diagonal = $matrix->get_diagonal()
Function: Get the diagonal of a matrix
Returns : Array (in array context) or arrayref (in scalar context)
          of values which lie along the diagonal
Args    : none

the way she just hands you the diagonal, no args needed, main character energy πŸ’…

add_row βž•

Title   : add_row
Usage   : $matrix->add_row($index,\@newrow);
Function: Adds a row at particular location in the matrix.
          If $index < the rowcount will shift all the rows down
          by the number of new rows.
          To add a single empty row, simply call
          $matrix->add_row($index,undef);
Returns : the updated number of total rows in the matrix
Args    : index to store
          name of the row (header)
          newrow to add, if this is undef will add a single
                    row with all values set to undef

remove_row βž–

Title   : remove_row
Usage   : $matrix->remove_row($colnum)
Function: remove a row from the matrix shifting all the rows
          up by one
Returns : Updated number of rows in the matrix
Args    : row index

add_column 🧱

Title   : add_column
Usage   : $matrix->add_column($index,$colname,\@newcol);
Function: Adds a column at particular location in the matrix.
          If $index < the colcount will shift all the columns right
          by the number of new columns.
          To add a single empty column, simply call
          $matrix->add_column($index,undef);
Returns : the updated number of total columns in the matrix
Args    : index to store
          name of the column (header)
          newcolumn to add, if this is undef will add a single
                column with all values set to undef

remove_column πŸ—‘οΈ

Title   : remove_column
Usage   : $matrix->remove_column($colnum)
Function: remove a column from the matrix shifting all the columns
          to the left by one
Returns : Updated number of columns in the matrix
Args    : column index

column_num_for_name 🏷️

Title   : column_num_for_name
Usage   : my $num = $matrix->column_num_for_name($name)
Function: Gets the column number for a particular column name
Returns : integer
Args    : string

row_num_for_name 🏷️

Title   : row_num_for_name
Usage   : my $num = $matrix->row_num_for_name
Function: Gets the row number for a particular row name
Returns : integer
Args    : string

column_header πŸŽ—οΈ

Title   : column_header
Usage   : my $name = $matrix->column_header(0)
Function: Gets the column header for a particular column number
Returns : string
Args    : integer

row_header πŸŽ—οΈ

Title   : row_header
Usage   : my $name = $matrix->row_header(0)
Function: Gets the row header for a particular row number
Returns : string
Args    : integer

num_rows πŸ”’

Title   : num_rows
Usage   : my $rowcount = $matrix->num_rows;
Function: Get the number of rows
Returns : integer
Args    : none

num_columns πŸ”’

Title   : num_columns
Usage   : my $colcount = $matrix->num_columns
Function: Get the number of columns
Returns : integer
Args    : none

row_names πŸ“‹

Title   : row_names
Usage   : my @rows = $matrix->row_names
Function: The names of all the rows
Returns : array in array context, arrayref in scalar context
Args    : none

column_names πŸ“‹

Title   : column_names
Usage   : my @columns = $matrix->column_names
Function: The names of all the columns
Returns : array in array context, arrayref in scalar context
Args    : none

private methods πŸ™ˆ

private methods for a Generic Matrix β€” bestie, these are the behind the scenes girls, don't call them from outside 🫣

_values 🧬

Title   : _values
Usage   : $matrix->_values();
Function: get/set for array ref of the matrix containing
          distance values
Returns : an array reference
Args    : an array reference

and that's the whole page, bestie ✨ this one's from perl v5.32.1, dated 2021-08-15, and it's part of the User Contributed Perl Documentation. go forth and matrix, queen πŸ‘‘πŸ’–

πŸ“¦ where this page comes from