Microarray::File - Perl objects for handling microarray file formats
use Microarray::File; my $array_file = microarray_text_file->new('/file'); # can pass just a filename... my $filehandle = $array_file->filehandle; # ...and retrieve the filehandle my $array_file = microarray_text_file->new('/file',$Fh); # or create the filehandle yourself
Microarray::File provides functions for creating microarray file objects. The module includes functions for importing and sorting data for text files.
Get or set the file name. If the filehandle is being set by Microarray::File, this needs to be the full path, otherwise can be any name.
If the file type has a header of some kind, the method
get_header_keys() will return a list of the keys parsed from the header. The method
get_header_info() will return a hash of the header information, or if a key is passed it will return the relevant value.
Returns the file contents, as are.
The sub class
microarray_text_file handles any standard text file. As with all text files, line endings are 'normalised'.
Returns the number of lines read
This is a text file with delimited cells, but not necessarily a straightforward 'spreadsheet' type format.
Guesses and returns the delimiter type based on file name suffix. If '.csv', assumes a comma separated format, otherwise assumes a tab-delimited format.
Returns the column headers as a hash. Both the column names and column numbers have keys, returning the corresponding value. i.e. if column 2 is called 'Name', then the
data_fields hash has the following keys;
Clearly this falls down if any of the columns have a numerical name in the same range as the number of columns, but different values (i.e. column 2 is named '3'). Oh well.
Returns the column name from its column number, and vice versa
This is a delimited file with a simple columnar 'spreadsheet' format and no header.
The number of columns
Get/set the column index of a column to use as a 'primary key'. If a column is not set, returns -1.
Add text to the log file
Christopher Jones, Gynaecological Cancer Research Laboratories, Institute for Women's Health, University College London.
Copyright 2008 by Christopher Jones, University College London
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.