« lib/Bio/MUST/Apps/Debrief42/RunReport.pm
↑ Summary
lib/Bio/MUST/Apps/Debrief42/TaxReport/NewSeq.pm »
| 1 | package Bio::MUST::Apps::Leel::RunProcessor; | ||
| 2 | # ABSTRACT: Internal class for leel tool | ||
| 3 | $Bio::MUST::Apps::Leel::RunProcessor::VERSION = '0.262780'; | ||
| 4 | use Moose; | ||
| 5 | use namespace::autoclean; | ||
| 6 | |||
| 7 | use autodie; | ||
| 8 | use feature qw(say); | ||
| 9 | |||
| 10 | use Smart::Comments; # logging always enabled here | ||
| 11 | |||
| 12 | use Path::Class qw(dir); | ||
| 13 | |||
| 14 | use Parallel::Batch; | ||
| 15 | |||
| 16 | use aliased 'Bio::MUST::Apps::Leel::AliProcessor'; | ||
| 17 | |||
| 18 | with 'Bio::MUST::Apps::Roles::RunProcable'; | ||
| 19 | |||
| 20 | |||
| 21 | has '+out_suffix' => ( | ||
| 22 | default => '-1331', | ||
| 23 | ); | ||
| 24 | |||
| 25 | |||
| 26 | # blast_args | ||
| 27 | |||
| 28 | |||
| 29 | # trim_homologues | ||
| 30 | |||
| 31 | # trim_max_shift | ||
| 32 | |||
| 33 | # trim_extra_margin | ||
| 34 | |||
| 35 | |||
| 36 | has 'aligner_mode' => ( | ||
| 37 | is => 'ro', | ||
| 38 | isa => 'Str', | ||
| 39 | default => 'exonerate', | ||
| 40 | ); | ||
| 41 | |||
| 42 | |||
| 43 | has 'id_match_mode' => ( | ||
| 44 | is => 'ro', | ||
| 45 | isa => 'Str', | ||
| 46 | default => 'enforce', | ||
| 47 | ); | ||
| 48 | |||
| 49 | |||
| 50 | has 'round_trip_mode' => ( | ||
| 51 | is => 'ro', | ||
| 52 | isa => 'Str', | ||
| 53 | default => 'off', | ||
| 54 | ); | ||
| 55 | |||
| 56 | |||
| 57 | # bank_dir | ||
| 58 | |||
| 59 | # orgs | ||
| 60 | |||
| 61 | # infiles | ||
| 62 | |||
| 63 | # out_dir | ||
| 64 | |||
| 65 | # debug_mode | ||
| 66 | |||
| 67 | # threads? | ||
| 68 | |||
| 69 | |||
| 70 | sub BUILD { | ||
| 71 | my $self = shift; | ||
| 72 | |||
| 73 | # TODO: avoid duplicate code wrt Forty-Two::RunProcessor | ||
| 74 | |||
| 75 | # build optional output dir | ||
| 76 | if ($self->out_dir) { | ||
| 77 | my $dir = dir($self->out_dir)->relative; | ||
| 78 | $dir->mkpath(); | ||
| 79 | } | ||
| 80 | |||
| 81 | if ($self->threads > 1) { | ||
| 82 | ### [RUN] Multithreading is on: $self->threads | ||
| 83 | ### [RUN] Logging data will be mixed-up! | ||
| 84 | } | ||
| 85 | |||
| 86 | # create job queue | ||
| 87 | my $batch = Parallel::Batch->new( { | ||
| 88 | maxprocs => $self->threads, | ||
| 89 | jobs => [ $self->all_infiles ], | ||
| 90 | code => sub { # closure (providing $self) | ||
| 91 | my $infile = shift; | ||
| 92 | ### [RUN] Processing ALI: $infile | ||
| 93 | return AliProcessor->new( | ||
| 94 | run_proc => $self, | ||
| 95 | ali => $infile, | ||
| 96 | ); | ||
| 97 | }, | ||
| 98 | } ); | ||
| 99 | |||
| 100 | # launch jobs | ||
| 101 | $batch->run(); | ||
| 102 | |||
| 103 | return; | ||
| 104 | } | ||
| 105 | |||
| 106 | |||
| 107 | __PACKAGE__->meta->make_immutable; | ||
| 108 | 1; | ||
| 109 | |||
| 110 | __END__ |