Bio-ToolBox
view release on metacpan or search on metacpan
scripts/manipulate_datasets.pl view on Meta::CPAN
# sort
if ( scalar(@indices) == 1 ) {
# excellent! only one column index to sort by
$Data->sort_data( $indices[0], $direction );
}
else {
# need to sort by the mean of provided column indices
# we will generate a temporary column of the mean
# first need to set the target of mean which is needed by combine function
my $original = $opt_target; # keep a backup just in case
$opt_target = 'mean';
combine_function(@indices);
my $i = $Data->last_column;
$opt_target = $original; # restore backup just in case
$Data->sort_data( $i, $direction );
$Data->delete_column($i); # delete the temporary column
}
# remove any pre-existing sorted metadata since no longer valid
for ( my $i = 0; $i < $Data->number_columns; $i++ ) {
$Data->delete_metadata( $i, 'sorted' );
}
# annotate metadata, but only if there was one index
scripts/manipulate_datasets.pl view on Meta::CPAN
be called in shell scripts.
Note that the datafile is loaded entirely in memory. For extremely large
datafiles, e.g. binned genomic data, it may be best to first split the
file into chunks (use C<split_data_file.pl>), perform the manipulations,
and recombine the file (use C<join_data_file.pl>). This could be done
through a simple shell script.
The program keeps track of the number of manipulations performed, and if
any are performed, will write out to file the changed data. Unless an
output file name is provided, it will overwrite the input file (NO backup is
made!).
=head1 FUNCTIONS
This is a list of the functions available for manipulating columns. These may
be selected interactively from the main menu (note the case sensitivity!),
or specified on the command line using the --func option.
=over 4
( run in 0.503 second using v1.01-cache-2.11-cpan-49f99fa48dc )