Imported Upstream version 3.6.3+dfsg
Sascha Steinbiss
7 years ago
0 | 0 |
name = Bio-Roary
|
1 | |
version = 3.6.2
|
|
1 |
version = 3.6.3
|
2 | 2 |
author = Andrew J. Page <ap13@sanger.ac.uk>
|
3 | 3 |
license = GPL_3
|
4 | 4 |
copyright_holder = Wellcome Trust Sanger Institute
|
30 | 30 |
has 'dont_delete_files' => ( is => 'rw', isa => 'Bool', default => 0 );
|
31 | 31 |
has 'num_input_files' => ( is => 'ro', isa => 'Int', required => 1);
|
32 | 32 |
|
33 | |
# Overload Role
|
|
33 |
# Overload Role`
|
34 | 34 |
has 'memory_in_mb' => ( is => 'rw', isa => 'Int', lazy => 1, builder => '_build_memory_in_mb' );
|
35 | 35 |
has '_min_memory_in_mb' => ( is => 'ro', isa => 'Int', default => 1500 );
|
36 | 36 |
has '_max_memory_in_mb' => ( is => 'ro', isa => 'Int', default => 60000 );
|
|
42 | 42 |
sub _build__files_per_chunk
|
43 | 43 |
{
|
44 | 44 |
my ($self) = @_;
|
45 | |
if($self->num_input_files > 1000)
|
46 | |
{
|
47 | |
return 5;
|
48 | |
}
|
49 | |
elsif($self->num_input_files > 500)
|
50 | |
{
|
51 | |
return 7;
|
52 | |
}
|
53 | |
return 10;
|
|
45 |
return 1;
|
54 | 46 |
}
|
55 | 47 |
|
56 | 48 |
sub _build_memory_in_mb {
|
17 | 17 |
use Moose;
|
18 | 18 |
use File::Temp qw/ tempfile /;
|
19 | 19 |
use Log::Log4perl qw(:easy);
|
|
20 |
use File::Slurper 'write_text';
|
|
21 |
use File::Temp qw/ tempfile /;
|
20 | 22 |
|
21 | 23 |
has 'commands_to_run' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
|
22 | 24 |
has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 );
|
|
27 | 29 |
sub run {
|
28 | 30 |
my ($self) = @_;
|
29 | 31 |
|
|
32 |
my($fh, $temp_command_filename) = tempfile();
|
|
33 |
write_text($temp_command_filename, join("\n", @{ $self->commands_to_run }) );
|
|
34 |
|
30 | 35 |
for my $command_to_run(@{ $self->commands_to_run })
|
31 | 36 |
{
|
32 | 37 |
$self->logger->info($command_to_run);
|
33 | 38 |
}
|
34 | |
open(my $fh,"|-","parallel --gnu -j ".$self->cpus) || die "GNU Parallel failed";
|
35 | |
print $fh join("\n", @{ $self->commands_to_run });
|
36 | |
close $fh;
|
|
39 |
my $parallel_command = "parallel --gnu -j ".$self->cpus." < ".$temp_command_filename ;
|
|
40 |
$self->logger->info($parallel_command );
|
|
41 |
|
|
42 |
system($parallel_command);
|
37 | 43 |
1;
|
38 | 44 |
}
|
39 | 45 |
|
114 | 114 |
unlink($output_blast_results_filename) unless($self->dont_delete_files == 1);
|
115 | 115 |
|
116 | 116 |
my $post_analysis = Bio::Roary::External::PostAnalysis->new(
|
117 | |
job_runner => $self->job_runner,
|
|
117 |
job_runner => 'Local',
|
118 | 118 |
cpus => $self->cpus,
|
119 | 119 |
fasta_files => $self->fasta_files,
|
120 | 120 |
input_files => $self->input_files,
|