NAME
Bio::ToolBox::utility -
DESCRIPTION
These are general subroutines that don't fit in either Bio::ToolBox::file_helper or Bio::ToolBox::db_helper.
SUBROUTINES
The following subroutines are automatically exported when you use this module.
- parse_list()
-
This subroutine parses a scalar value into a list of values. The scalar is a text string of numbers (usually column or dataset indices) delimited by commas and/or including a range. For example, a string "1,2,5-7" would become an array of [1,2,5,6,7].
Pass the module the scalar string.
It will return the array of numbers.
Example
my $index_request = '1,2,5-7'; my @indices = parse_list($index_request); # returns [1,2,5,6,7]
- format_with_commas()
-
This subroutine process a large number (e.g. 4327908475) into a human-friendly version with commas delimiting the thousands (4,327,908,475).
Pass the module a scalar string with a number value.
It will return a scalar value containing the formatted number.
Example
my $count = '4327908475'; print " The final count was " . format_with_commas($count) . "\n";
- ask_user_for_index($Data, $prompt)
-
This subroutine will present the list of column names from a Bio::ToolBox::Data structure along with their numeric indexes to the user and prompt for one or more to be selected and entered. A text prompt should be provided, or a generic one is used. The list of indices are validated, and a warning printed for invalid responses. The responses are then returned as a single value or array, depending on context.
Example
my @answers = ask_user_for_index($Data, 'Please enter 2 or more columns ');
AUTHOR
Timothy J. Parnell, PhD
Dept of Oncological Sciences
Huntsman Cancer Institute
University of Utah
Salt Lake City, UT, 84112
This package is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.