NAME
Bio::Grid::Run::SGE::Iterator::Consecutive - iterate consecutively through an index
|
SYNOPSIS
my $index = Bio::Grid::Run::SGE::Index->new( format => 'Dummy' , idx_file => undef , idx => [ 'a' .. 'c' ] )->create;
my $it = Bio::Grid::Run::SGE::Iterator::Consecutive->new( indices => [ $index ] );
my ( $from , $to ) = (0, $it ->num_comb - 1);
$it ->range( [ $from , $to ] );
my @result ;
my $i = $from ;
while ( my $comb = $it ->next_comb ) {
print "job " . $i ++ . " -> " . $comb ->[0] . "\n" ;
}
|
DESCRIPTION
This is the simplest iterator, it runs through a range of elements in an index. It takes exactly one index. Results in N
opeations with N as number of elements in the index.
ITERATION SCHEME
An index with elements (a..c) combines to 3 jobs:
job 1 -> a
job 2 -> b
job 3 -> c
|
CONFIGURATION
---
...
mode: Consecutive
...
|
COMPLETE EXAMPLE
CONFIG FILE
---
input:
- format : List
elements: [ "a" , "b" , "c" ]
job_name: Consecutive_test
mode: Consecutive
|
CLUSTER SCRIPT
#!/usr/bin/env perl
use 5.010;
run_job(
task => \ &do_worker_stuff
);
sub do_worker_stuff {
my ( $c , $result_prefix , $elems_a ) = @_ ;
open my $fh , '>' , $result_prefix or die "Can't open filehandle: $!" ;
my $num_elems = @$elems_a ;
for ( my $i = 0; $i < @$elems_a ; $i ++ ) {
say $fh $elems_a ->[ $i ];
}
$fh -> close ;
return 1;
}
1;
|
SEE ALSO
Bio::Grid::Run::SGE::Role::Iterable, Bio::Grid::Run::SGE::Iterator
AUTHOR
jw bargsten, <jwb at cpan dot org>