This is a simple package containing utility methods of use to the server scripts.
my @lines = ScriptThing::GetBatch($ih, $size);
Get a batch of work to do. The specified input stream will be read, and a list of IDs pulled out, along with the contents of the input lines on which the IDs were found. The input stream can be an open file handle or a list of singleton values to return.
Open input file handle, or alternatively a reference to a list of values to return. If a list is specified, the items will be removed from the list as they are returned.
Maximum permissible batch size. If omitted, the default is 10.
10
Index (1-based) of the column containing the IDs. The default is the last column.
Returns a list of 2-tuples; each 2-tuple consists of an ID followed by the text of the input line containing the ID (with the trailing new-line removed).
my @list = ScriptThing::GetList($ih, $column);
Extract a list of data items from a tab-delimited file. Unlike "GetBatch", this method reads the entire file, and it only returns the column of interest instead of tuples containing the original data lines.
Open file handle for the input.
Returns a list containing the contents of the desired column for every record in the input stream.
my $id = ScriptThing::GetColumn($line, $column);
Get the specified column from a tab-delimited input line.
A tab-delimited line of text.
The index (1-based) of the column whose value is desired. If undefined or 0, then the last column will be extracted.
Returns the value of the desired column. Note that if it is the last column, no trimming of new-line characters will take place.
my %hash = ScriptThing::CommentHash(\@tuples, $column);
Convert the 2-tuples returned by "GetBatch" to a comment hash for FASTA-based methods. The return hash will map each incoming ID to a string containing the fields from the corresponding line.
Reference to a list of 2-tuples. Each 2-tuple contains an ID followed by a tab-delimited input line (without the new-line character).
Index (1-based) of the column containing the ID value. The default is the last column.
Returns a hash mapping each incoming ID to the text from its input line.
AdjustStdin();
Check the environment for a STDIN variable, and if present, open the named file as STDIN. This is a debugging hack that allows the scripts to be run easily inside a symbolic debugger.
To install Bio::KBase, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::KBase
CPAN shell
perl -MCPAN -e shell install Bio::KBase
For more information on module installation, please visit the detailed CPAN module installation guide.