File Coverage

lib/Bio/Roary.pm
Criterion Covered Total %
statement 64 81 79.0
branch 2 12 16.6
condition n/a
subroutine 19 19 100.0
pod 0 1 0.0
total 85 113 75.2


line stmt bran cond sub pod time code
1             package Bio::Roary;
2             $Bio::Roary::VERSION = '3.11.0';
3             # ABSTRACT: Create a pan genome
4              
5              
6 1     1   6 use Moose;
  1         2  
  1         6  
7 1     1   5414 use File::Copy;
  1         2  
  1         48  
8 1     1   336 use Bio::Perl;
  1         80249  
  1         78  
9 1     1   304 use Bio::Roary::ParallelAllAgainstAllBlast;
  1         3  
  1         41  
10 1     1   381 use Bio::Roary::CombinedProteome;
  1         3  
  1         31  
11 1     1   299 use Bio::Roary::External::Cdhit;
  1         3  
  1         38  
12 1     1   388 use Bio::Roary::External::Mcl;
  1         3  
  1         38  
13 1     1   382 use Bio::Roary::InflateClusters;
  1         3  
  1         34  
14 1     1   320 use Bio::Roary::AnalyseGroups;
  1         4  
  1         37  
15 1     1   394 use Bio::Roary::GroupLabels;
  1         3  
  1         39  
16 1     1   410 use Bio::Roary::AnnotateGroups;
  1         2  
  1         38  
17 1     1   380 use Bio::Roary::GroupStatistics;
  1         3  
  1         39  
18 1     1   447 use Bio::Roary::Output::GroupsMultifastasNucleotide;
  1         4  
  1         41  
19 1     1   418 use Bio::Roary::External::PostAnalysis;
  1         4  
  1         43  
20 1     1   408 use Bio::Roary::FilterFullClusters;
  1         3  
  1         41  
21 1     1   370 use Bio::Roary::External::IterativeCdhit;
  1         3  
  1         37  
22 1     1   386 use Bio::Roary::Output::BlastIdentityFrequency;
  1         3  
  1         491  
23              
24             has 'fasta_files' => ( is => 'rw', isa => 'ArrayRef', required => 1 );
25             has 'input_files' => ( is => 'rw', isa => 'ArrayRef', required => 1 );
26             has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'clustered_proteins' );
27             has 'output_pan_geneome_filename' => ( is => 'rw', isa => 'Str', default => 'pan_genome.fa' );
28             has 'output_statistics_filename' => ( is => 'rw', isa => 'Str', default => 'gene_presence_absence.csv' );
29             has 'job_runner' => ( is => 'rw', isa => 'Str', default => 'Local' );
30             has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 );
31             has 'makeblastdb_exec' => ( is => 'rw', isa => 'Str', default => 'makeblastdb' );
32             has 'blastp_exec' => ( is => 'rw', isa => 'Str', default => 'blastp' );
33             has 'mcxdeblast_exec' => ( is => 'ro', isa => 'Str', default => 'mcxdeblast' );
34             has 'mcl_exec' => ( is => 'ro', isa => 'Str', default => 'mcl' );
35             has 'perc_identity' => ( is => 'ro', isa => 'Num', default => 98 );
36             has 'dont_delete_files' => ( is => 'ro', isa => 'Bool', default => 0 );
37             has 'dont_create_rplots' => ( is => 'rw', isa => 'Bool', default => 0 );
38             has 'dont_split_groups' => ( is => 'ro', isa => 'Bool', default => 0 );
39             has 'verbose_stats' => ( is => 'rw', isa => 'Bool', default => 0 );
40             has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 );
41             has 'group_limit' => ( is => 'rw', isa => 'Num', default => 50000 );
42             has 'core_definition' => ( is => 'rw', isa => 'Num', default => 1.0 );
43             has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
44             has 'mafft' => ( is => 'ro', isa => 'Bool', default => 0 );
45             has 'inflation_value' => ( is => 'rw', isa => 'Num', default => 1.5 );
46             has 'allow_paralogs' => ( is => 'rw', isa => 'Bool', default => 0 );
47              
48             has 'output_multifasta_files' => ( is => 'ro', isa => 'Bool', default => 0 );
49              
50             sub run {
51 1     1 0 3 my ($self) = @_;
52              
53 1         3 my $output_combined_filename = '_combined_files';
54 1         2 my $output_cd_hit_filename = '_clustered';
55 1         4 my $output_blast_results_filename = '_blast_results';
56 1         2 my $output_mcl_filename = '_uninflated_mcl_groups';
57 1         3 my $output_filtered_clustered_fasta = '_clustered_filtered.fa';
58 1         3 my $cdhit_groups = $output_combined_filename.'.groups';
59            
60            
61 1 50       29 unlink($cdhit_groups) unless($self->dont_delete_files == 1);
62              
63 1 50       26 print "Combine proteins into a single file\n" if($self->verbose);
64 1         23 my $combine_fasta_files = Bio::Roary::CombinedProteome->new(
65             proteome_files => $self->fasta_files,
66             output_filename => $output_combined_filename,
67             );
68 0           $combine_fasta_files->create_combined_proteome_file;
69              
70 0           my $number_of_input_files = @{$self->input_files};
  0            
71              
72 0 0         print "Iteratively run cd-hit\n" if($self->verbose);
73 0           my $iterative_cdhit= Bio::Roary::External::IterativeCdhit->new(
74             output_cd_hit_filename => $output_cd_hit_filename,
75             output_combined_filename => $output_combined_filename,
76             number_of_input_files => $number_of_input_files,
77             output_filtered_clustered_fasta => $output_filtered_clustered_fasta,
78             job_runner => $self->job_runner,
79             cpus => $self->cpus
80             );
81            
82 0           $iterative_cdhit->run();
83              
84 0 0         print "Parallel all against all blast\n" if($self->verbose);
85 0           my $blast_obj = Bio::Roary::ParallelAllAgainstAllBlast->new(
86             fasta_file => $output_cd_hit_filename,
87             blast_results_file_name => $output_blast_results_filename,
88             job_runner => $self->job_runner,
89             cpus => $self->cpus,
90             makeblastdb_exec => $self->makeblastdb_exec,
91             blastp_exec => $self->blastp_exec,
92             perc_identity => $self->perc_identity
93             );
94 0           $blast_obj->run();
95            
96 0           my $blast_identity_frequency_obj = Bio::Roary::Output::BlastIdentityFrequency->new(
97             input_filename => $output_blast_results_filename,
98             );
99 0           $blast_identity_frequency_obj->create_file();
100              
101 0 0         print "Cluster with MCL\n" if($self->verbose);
102 0           my $mcl = Bio::Roary::External::Mcl->new(
103             blast_results => $output_blast_results_filename,
104             mcxdeblast_exec => $self->mcxdeblast_exec,
105             mcl_exec => $self->mcl_exec,
106             job_runner => $self->job_runner,
107             cpus => $self->cpus,
108             inflation_value => $self->inflation_value,
109             output_file => $output_mcl_filename
110             );
111 0           $mcl->run();
112              
113 0 0         unlink($output_blast_results_filename) unless($self->dont_delete_files == 1);
114            
115 0           my $post_analysis = Bio::Roary::External::PostAnalysis->new(
116             job_runner => 'Local',
117             cpus => $self->cpus,
118             fasta_files => $self->fasta_files,
119             input_files => $self->input_files,
120             output_filename => $self->output_filename,
121             output_pan_geneome_filename => $self->output_pan_geneome_filename,
122             output_statistics_filename => $self->output_statistics_filename,
123             clusters_filename => $output_cd_hit_filename.'.clstr',
124             dont_wait => 1,
125             output_multifasta_files => $self->output_multifasta_files,
126             dont_delete_files => $self->dont_delete_files,
127             dont_create_rplots => $self->dont_create_rplots,
128             dont_split_groups => $self->dont_split_groups,
129             verbose_stats => $self->verbose_stats,
130             translation_table => $self->translation_table,
131             group_limit => $self->group_limit,
132             core_definition => $self->core_definition,
133             verbose => $self->verbose,
134             mafft => $self->mafft,
135             allow_paralogs => $self->allow_paralogs,
136             );
137 0           $post_analysis->run();
138              
139             }
140              
141              
142 1     1   7 no Moose;
  1         2  
  1         4  
143             __PACKAGE__->meta->make_immutable;
144              
145             1;
146              
147             __END__
148              
149             =pod
150              
151             =encoding UTF-8
152              
153             =head1 NAME
154              
155             Bio::Roary - Create a pan genome
156              
157             =head1 VERSION
158              
159             version 3.11.0
160              
161             =head1 SYNOPSIS
162              
163             Create a pan genome
164              
165             =head1 AUTHOR
166              
167             Andrew J. Page <ap13@sanger.ac.uk>
168              
169             =head1 COPYRIGHT AND LICENSE
170              
171             This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
172              
173             This is free software, licensed under:
174              
175             The GNU General Public License, Version 3, June 2007
176              
177             =cut