NAME
Microarray::File - Perl objects for handling microarray file formats
SYNOPSIS
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
DESCRIPTION
Microarray::File provides functions for creating microarray file objects. The module includes functions for importing and sorting data for text files.
METHODS
Generic methods
- file_name
-
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.
- get_header_keys, get_header_info
-
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 methodget_header_info()
will return a hash of the header information, or if a key is passed it will return the relevant value. - get_source
-
Returns the file contents, as are.
microarray_text_file
The sub class microarray_text_file
handles any standard text file. As with all text files, line endings are 'normalised'.
- line_num
-
Returns the number of lines read
delimited_file
This is a text file with delimited cells, but not necessarily a straightforward 'spreadsheet' type format.
- delimiter
-
Guesses and returns the delimiter type based on file name suffix. If '.csv', assumes a comma separated format, otherwise assumes a tab-delimited format.
- get_data_fields
-
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;2=>'Name' 'Name'=>2
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.
- get_column_id
-
Returns the column name from its column number, and vice versa
simple_delimited_file
This is a delimited file with a simple columnar 'spreadsheet' format and no header.
- column_num
-
The number of columns
- key_column
-
Get/set the column index of a column to use as a 'primary key'. If a column is not set, returns -1.
log_file methods
- add_text
-
Add text to the log file
SEE ALSO
AUTHOR
Christopher Jones, Translational Research Laboratories, Institute for Women's Health, University College London.
http://www.instituteforwomenshealth.ucl.ac.uk/trl
c.jones@ucl.ac.uk
COPYRIGHT AND LICENSE
Copyright 2006 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.