NAME
Bio::Grid::Run::SGE::Util - Utility functions for Bio::Grid::Run::SGE
SYNOPSIS
use Bio::Grid::Run::SGE::Util qw(
my_glob
delete_by_regex
expand_path
my_mkdir
concat_files
my_glob_non_fatal
timer
expand_path_rel
);
DESCRIPTION
Provides utility functions for the Bio::Grid::Run::SGE module.
SUBROUTINES
- $first_file = my_glob($pattern)
- @all_files = my_glob($pattern)
-
See File::Glob::bsd_glob for an explanation of the
$pattern
. This function is for convenience only and takes care of some quirks of bsd_glob. - $first_file = my_glob_non_fatal($pattern)
- @all_files = my_glob_non_fatal($pattern)
-
Same as
my_glob
, but does not die if glob result is empty. - $first_file = expand_path(\@files)
- @files = expand_path(\@files)
-
Expands a path to its absoulte equivalent. Taks also care of paths beginning with '~'.
- $first_file = expand_path_rel(\@files)
- @files = expand_path_rel(\@files)
-
Expands the '~' at the beginning of a path to the home directory.
- my_mkdir($path)
-
Creates
$path
and dies if something goes wrong. See also "mkpath" in File::Path. - delete_by_regex($dir, $file_regex, $simulate)
-
Opens
$dir
and deletes all files that match$file_regex
. If simulate is true, then just print the files that would be deleted. - concat_files($config)
-
Concatenates all result files in one file $c-{result_dir}/$c->{job_name}.j${job_id}.result.concat and deletes the single result files. Result files are determined by following regex:
qr/\Q$c->{job_name}\E #job name \.j$c->{job_id} #the job id \.[0-9]+ #the sge task id \.c[\-0-9]+(?:\.[\w\-.#]+)? #combination idx (?:\..*)? #suffix $/x;
If your toolwrapper makes use of it, you can also invoke it by hand. In the working dir of your job run:
~/script/<toolwrapper>.pl -p <job_id> <tmp>/<job_name>.config
TAKE CARE, IT DELETES THE RESULT FILES AND OVERWRITES THE LAST RESULT.CONCAT FILE
- $timer = timer()
-
Time something. Usage:
# get a timer my $timer = timer(); # start my $start_time = $timer->(); # stop my $stop_time = $timer->(); my ($stop_time, $elapsed_time_as_string) = $timer->();
SEE ALSO
AUTHOR
jw bargsten, <joachim.bargsten at wur.nl>