File Coverage

lib/Bio/Roary/External/Prank.pm
Criterion Covered Total %
statement 22 23 95.6
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 29 32 90.6


line stmt bran cond sub pod time code
1             package Bio::Roary::External::Prank;
2             $Bio::Roary::External::Prank::VERSION = '3.10.1';
3             # ABSTRACT: Wrapper to run prank
4              
5              
6 2     2   32104 use Moose;
  2         4  
  2         18  
7 2     2   17592 use File::Spec;
  2         6  
  2         785  
8             with 'Bio::Roary::JobRunner::Role';
9              
10             has 'input_filename' => ( is => 'ro', isa => 'Str', required => 1 );
11             has 'output_filename' => ( is => 'ro', isa => 'Str', default => 'output' );
12             has 'exec' => ( is => 'ro', isa => 'Str', default => 'prank' );
13              
14             # Overload Role
15             has 'memory_in_mb' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build_memory_in_mb' );
16              
17             sub _build_memory_in_mb {
18 1     1   2 my ($self) = @_;
19 1         2 my $memory_required = 2000;
20 1         18 return $memory_required;
21             }
22              
23             sub _command_to_run {
24 3     3   7 my ($self) = @_;
25              
26 3 50       73 if(! -e $self->input_filename)
27             {
28 0         0 $self->logger->error( "Input file to PRANK missing: " . $self->input_filename );
29             }
30              
31 3         60 return join(
32             ' ',
33             (
34             $self->exec,
35             "-d=" . $self->input_filename,
36             "-o=" . $self->output_filename,
37             '-codon', '-F', '-quiet', '-once', '> /dev/null 2>&1',
38             '&&', 'mv', $self->output_filename . '*.fas',
39             $self->output_filename
40             )
41             );
42             }
43              
44             sub run {
45 1     1 0 3 my ($self) = @_;
46 1         27 my @commands_to_run;
47              
48 1         3 push( @commands_to_run, $self->_command_to_run() );
49 1         20 $self->logger->info( "Running command: " . $self->_command_to_run() );
50              
51 1         29 my $job_runner_obj = $self->_job_runner_class->new(
52             commands_to_run => \@commands_to_run,
53             memory_in_mb => $self->memory_in_mb,
54             queue => $self->_queue,
55             cpus => $self->cpus
56             );
57 1         5 $job_runner_obj->run();
58              
59 1         130 1;
60             }
61              
62 2     2   18 no Moose;
  2         6  
  2         14  
63             __PACKAGE__->meta->make_immutable;
64              
65             1;
66              
67             __END__
68              
69             =pod
70              
71             =encoding UTF-8
72              
73             =head1 NAME
74              
75             Bio::Roary::External::Prank - Wrapper to run prank
76              
77             =head1 VERSION
78              
79             version 3.10.1
80              
81             =head1 SYNOPSIS
82              
83             Wrapper to run cd-hit
84             use Bio::Roary::External::Prank;
85              
86             my $prank_obj = Bio::Roary::External::Prank->new(
87             input_filename => $fasta_file,
88             output_filename => $fasta_file.'.aln',
89             job_runner => 'Local'
90             );
91             $prank_obj->run();
92              
93             =head1 AUTHOR
94              
95             Andrew J. Page <ap13@sanger.ac.uk>
96              
97             =head1 COPYRIGHT AND LICENSE
98              
99             This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
100              
101             This is free software, licensed under:
102              
103             The GNU General Public License, Version 3, June 2007
104              
105             =cut