/usr/share/perl5/Bio/Roary/External/IterativeCdhit.pm is in roary 3.8.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | package Bio::Roary::External::IterativeCdhit;
$Bio::Roary::External::IterativeCdhit::VERSION = '3.8.0';
# ABSTRACT: Iteratively run CDhit
use Moose;
with 'Bio::Roary::JobRunner::Role';
has 'output_cd_hit_filename' => ( is => 'ro', isa => 'Str', required => 1 );
has 'output_combined_filename' => ( is => 'ro', isa => 'Str', required => 1 );
has 'number_of_input_files' => ( is => 'ro', isa => 'Int', required => 1 );
has 'output_filtered_clustered_fasta' => ( is => 'ro', isa => 'Str', required => 1 );
has 'exec' => ( is => 'ro', isa => 'Str', default => 'iterative_cdhit' );
has '_max_cpus' => ( is => 'ro', isa => 'Int', default => 40 );
# Overload Role
has 'memory_in_mb' => ( is => 'ro', isa => 'Int', lazy => 1, builder => '_build_memory_in_mb' );
sub _build_memory_in_mb {
my ($self) = @_;
my $filename = $self->output_combined_filename;
my $memory_required = 2000;
if ( -e $filename ) {
$memory_required = -s $filename;
# Convert to mb
$memory_required = int( $memory_required / 1000000 );
# Pentuple memory for worst case senario
$memory_required *= 5;
$memory_required = 2000 if ( $memory_required < 2000 );
}
return $memory_required;
}
sub _build__max_available_memory_in_mb {
my ($self) = @_;
my $memory_to_cdhit = int( $self->memory_in_mb * 0.9 );
return $memory_to_cdhit;
}
sub _command_to_run {
my ($self) = @_;
my $cpus = ($self->cpus > $self->_max_cpus) ? $self->_max_cpus : $self->cpus;
return join(
' ',
(
$self->exec, '-c', $self->output_cd_hit_filename, '-m',
$self->output_combined_filename, '-n', $self->number_of_input_files, '--cpus', $cpus, '-f',
$self->output_filtered_clustered_fasta
)
);
}
sub run {
my ($self) = @_;
my @commands_to_run;
push( @commands_to_run, $self->_command_to_run );
$self->logger->info( "Running command: " . $self->_command_to_run() );
my $job_runner_obj = $self->_job_runner_class->new(
commands_to_run => \@commands_to_run,
memory_in_mb => $self->memory_in_mb,
queue => $self->_queue,
cpus => $self->cpus
);
$job_runner_obj->run();
1;
}
no Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Bio::Roary::External::IterativeCdhit - Iteratively run CDhit
=head1 VERSION
version 3.8.0
=head1 SYNOPSIS
Iteratively run CDhit
use Bio::Roary::External::IterativeCdhit;
my $seg= Bio::Roary::External::IterativeCdhit->new(
output_cd_hit_filename => '',
output_combined_filename => '',
number_of_input_files => 10,
output_filtered_clustered_fasta => '',
);
$seg->run();
=head1 AUTHOR
Andrew J. Page <ap13@sanger.ac.uk>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
=cut
|