NAME
TRL::Microarray::Microarray_File - Perl objects describing microarray files
SYNOPSIS
use TRL::Microarray::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
TRL::Microarray::Microarray_File provides functions for creating microarray file objects. Two basic types of file are supported - text files and image files. The module includes functions for importing and sorting data for text files. Support for managing image files is currently limited to parsing relevant image header information from microarray scanner images.
METHODS
Generic methods
- file_name
-
Get or set the file name. If the filehandle is being set by Microarray_File.pm, 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 method get_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.
- import_cells
-
Removed this method from the sort_data() rountine called at initialisation - sorts the data into a hash of hashes. Don't think it does anything, but we'll soon see if any other classes are broken now!
- 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
microarray_image_file methods
There are no generic methods for the microarray_image_file - see inheriting classes.
SEE ALSO
TRL::Microarray
AUTHOR
Christopher Jones, Translational Research Laboratories, Institute for Women's Health, University College London.
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.