| 1 | package Bio::MUST::Apps::Debrief42; | ||
| 2 | # ABSTRACT: Main class for debrief-42 tool | ||
| 3 | # CONTRIBUTOR: Mick VAN VLIERBERGHE <mvanvlierberghe@doct.uliege.be> | ||
| 4 | $Bio::MUST::Apps::Debrief42::VERSION = '0.213470'; | ||
| 5 | use Moose; | ||
| 6 | use namespace::autoclean; | ||
| 7 | |||
| 8 | use autodie; | ||
| 9 | use feature qw(say); | ||
| 10 | |||
| 11 | use Smart::Comments; | ||
| 12 | |||
| 13 | use Carp; | ||
| 14 | |||
| 15 | use Bio::MUST::Core; | ||
| 16 | use aliased 'Bio::MUST::Apps::Debrief42::RunReport'; | ||
| 17 | |||
| 18 | |||
| 19 | has 'report_dir' => ( | ||
| 20 | is => 'ro', | ||
| 21 | isa => 'Str', | ||
| 22 | required => 1, | ||
| 23 | ); | ||
| 24 | |||
| 25 | |||
| 26 | has 'config' => ( | ||
| 27 | traits => ['Hash'], | ||
| 28 | is => 'ro', | ||
| 29 | isa => 'HashRef', | ||
| 30 | required => 1, | ||
| 31 | handles => { | ||
| 32 | args_for => 'get', | ||
| 33 | }, | ||
| 34 | ); | ||
| 35 | |||
| 36 | |||
| 37 | sub run_report { | ||
| 38 | my $self = shift; | ||
| 39 | my $args = shift // {}; # HashRef (should not be empty...) | ||
| 40 | |||
| 41 | # load config file (42's YAML) | ||
| 42 | my @orgs = map { $_->{'org'} } @{ $self->args_for('orgs') }; | ||
| 43 | |||
| 44 | my @tax_report_files = File::Find::Rule | ||
| 45 | ->file() | ||
| 46 | ->name( qr{ \.tax-report\z }xmsi ) | ||
| 47 | ->maxdepth(1) | ||
| 48 | ->in( $self->report_dir ) | ||
| 49 | ; | ||
| 50 | |||
| 51 | return RunReport->new( orgs => \@orgs, tax_reports => \@tax_report_files ); | ||
| 52 | } | ||
| 53 | |||
| 54 | |||
| 55 | __PACKAGE__->meta->make_immutable; | ||
| 56 | 1; | ||
| 57 | |||
| 58 | __END__ | ||
| 59 | |||
| 60 | =pod | ||
| 61 | |||
| 62 | =head1 NAME | ||
| 63 | |||
| 64 | Bio::MUST::Apps::Debrief42 - Main class for debrief-42 tool | ||
| 65 | |||
| 66 | =head1 VERSION | ||
| 67 | |||
| 68 | version 0.213470 | ||
| 69 | |||
| 70 | =head1 SYNOPSIS | ||
| 71 | |||
| 72 | # TODO | ||
| 73 | |||
| 74 | =head1 DESCRIPTION | ||
| 75 | |||
| 76 | # TODO | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Denis BAURAIN <denis.baurain@uliege.be> | ||
| 81 | |||
| 82 | =head1 CONTRIBUTOR | ||
| 83 | |||
| 84 | =for stopwords Mick VAN VLIERBERGHE | ||
| 85 | |||
| 86 | Mick VAN VLIERBERGHE <mvanvlierberghe@doct.uliege.be> | ||
| 87 | |||
| 88 | =head1 COPYRIGHT AND LICENSE | ||
| 89 | |||
| 90 | This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. | ||
| 91 | |||
| 92 | This is free software; you can redistribute it and/or modify it under | ||
| 93 | the same terms as the Perl 5 programming language system itself. | ||
| 94 | |||
| 95 | =cut |