blib/lib/Bio/Roary/CommandLine/IterativeCdhit.pm untested

filter: Statementstmt 0.0% 0 / 54 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 89 CC 12 SCAR 44.1
CC
12
Cov
0%
BUILD
132.0
run
6.0
usage_text
2.0
CRAP 81.9
1 undef $VERSION;
2 package Bio::Roary::CommandLine::IterativeCdhit;
3 $Bio::Roary::CommandLine::IterativeCdhit::VERSION = '3.13.0';
4 # ABSTRACT: Iteratively run cdhit
5  
6  
7 use Moose;
8 use Getopt::Long qw(GetOptionsFromArray);
9 use Bio::Roary::IterativeCdhit;
10 extends 'Bio::Roary::CommandLine::Common';
11  
12 has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
13 has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
14 has 'help' => ( is => 'rw', isa => 'Bool', default => 0 );
15 has '_error_message' => ( is => 'rw', isa => 'Str' );
16  
17 has 'output_cd_hit_filename' => ( is => 'rw', isa => 'Str', default => '_clustered' );
18 has 'output_combined_filename' => ( is => 'rw', isa => 'Str', default => '_combined_files' );
19 has 'number_of_input_files' => ( is => 'rw', isa => 'Int', default => 1 );
20 has 'output_filtered_clustered_fasta' => ( is => 'rw', isa => 'Str', default => '_clustered_filtered.fa' );
21  
22 has 'lower_bound_percentage' => ( is => 'rw', isa => 'Num', default => 0.98 );
23 has 'upper_bound_percentage' => ( is => 'rw', isa => 'Num', default => 0.99 );
24 has 'step_size_percentage' => ( is => 'rw', isa => 'Num', default => 0.005 );
25 has 'cpus' => ( is => 'rw', isa => 'Int', default => 1 );
26 has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
27  
28  
29 sub BUILD {
30 my ($self) = @_;
31  
32 my ( $output_cd_hit_filename,$cpus,$lower_bound_percentage,$upper_bound_percentage,$step_size_percentage, $output_combined_filename, $number_of_input_files, $output_filtered_clustered_fasta,$verbose,
33 $help );
34  
35 GetOptionsFromArray(
36 $self->args,
37 'c|output_cd_hit_filename=s' => \$output_cd_hit_filename,
38 'm|output_combined_filename=s' => \$output_combined_filename,
39 'n|number_of_input_files=i' => \$number_of_input_files,
40 'f|output_filtered_clustered_fasta=s' => \$output_filtered_clustered_fasta,
41 'l|lower_bound_percentage=s' => \$lower_bound_percentage,
42 'u|upper_bound_percentage=s' => \$upper_bound_percentage,
43 's|step_size_percentage=s' => \$step_size_percentage,
44 'p|cpus=i' => \$cpus,
45 'v|verbose' => \$verbose,
46 'h|help' => \$help,
47 );
48  
49 if ( defined($verbose) ) {
50 $self->verbose($verbose);
51 $self->logger->level(10000);
52 }
53 $self->help($help) if(defined($help));
54 $self->lower_bound_percentage($lower_bound_percentage/100) if ( defined($lower_bound_percentage) );
55 $self->upper_bound_percentage($upper_bound_percentage/100) if ( defined($upper_bound_percentage) );
56 $self->step_size_percentage($step_size_percentage/100) if ( defined($step_size_percentage) );
57 $self->output_cd_hit_filename($output_cd_hit_filename) if ( defined($output_cd_hit_filename) );
58 $self->output_combined_filename($output_combined_filename) if ( defined($output_combined_filename) );
59 $self->number_of_input_files($number_of_input_files) if ( defined($number_of_input_files) );
60 $self->cpus($cpus) if ( defined($cpus) );
61 $self->output_filtered_clustered_fasta($output_filtered_clustered_fasta)
62 if ( defined($output_filtered_clustered_fasta) );
63  
64 }
65  
66 sub run {
67 my ($self) = @_;
68  
69 ( !$self->help ) or die $self->usage_text;
70 if ( defined( $self->_error_message ) ) {
71 print $self->_error_message . "\n";
72 die $self->usage_text;
73 }
74  
75 my $obj = Bio::Roary::IterativeCdhit->new(
76 output_cd_hit_filename => $self->output_cd_hit_filename,
77 output_combined_filename => $self->output_combined_filename,
78 number_of_input_files => $self->number_of_input_files,
79 output_filtered_clustered_fasta => $self->output_filtered_clustered_fasta,
80 lower_bound_percentage => $self->lower_bound_percentage,
81 upper_bound_percentage => $self->upper_bound_percentage,
82 step_size_percentage => $self->step_size_percentage,
83 cpus => $self->cpus,
84 logger => $self->logger
85
86 );
87 $obj->run;
88 }
89  
90 sub usage_text {
91 my ($self) = @_;
92  
93 return <<USAGE;
94 Usage: iterative_cdhit [options]
95 Iteratively cluster a FASTA file of proteins with CD-hit, lower the threshold each time and extracting core genes (1 per isolate) to another file, and remove them from the input proteins file.
96  
97 Required arguments:
98 -m STR input FASTA file of protein sequences [_combined_files]
99  
100 Options: -p INT number of threads [1]
101 -n INT number of isolates [1]
102 -c STR cd-hit output filename [_clustered]
103 -f STR output filename for filtered sequences [_clustered_filtered.fa]
104 -l FLOAT lower bound percentage identity [98.0]
105 -u FLOAT upper bound percentage identity [99.0]
106 -s FLOAT step size for percentage identity [0.5]
107 -v verbose output to STDOUT
108 -h this help message
109  
110 For further info see: http://sanger-pathogens.github.io/Roary/
111 USAGE
112 }
113  
114 __PACKAGE__->meta->make_immutable;
115 no Moose;
116 1;
117  
118 __END__