| 1 | package Bio::Roary; | ||||||||||
| 2 | 1 | $Bio::Roary::VERSION = '3.13.0'; | |||||||||
| 3 | # ABSTRACT: Create a pan genome | ||||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use File::Copy; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Bio::Perl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Bio::Roary::ParallelAllAgainstAllBlast; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Bio::Roary::CombinedProteome; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Bio::Roary::External::Cdhit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use Bio::Roary::External::Mcl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Bio::Roary::InflateClusters; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use Bio::Roary::AnalyseGroups; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | ▶ | use Bio::Roary::GroupLabels; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 1 | ▶ | use Bio::Roary::AnnotateGroups; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use Bio::Roary::GroupStatistics; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use Bio::Roary::Output::GroupsMultifastasNucleotide; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 1 | ▶ | use Bio::Roary::External::PostAnalysis; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 1 | ▶ | use Bio::Roary::FilterFullClusters; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 1 | ▶ | use Bio::Roary::External::IterativeCdhit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | ▶ | use Bio::Roary::Output::BlastIdentityFrequency; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 1 | has 'fasta_files' => ( is => 'rw', isa => 'ArrayRef', required => 1 ); | |||||||||
| 25 | 1 | has 'input_files' => ( is => 'rw', isa => 'ArrayRef', required => 1 ); | |||||||||
| 26 | 1 | has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'clustered_proteins' ); | |||||||||
| 27 | 1 | has 'output_pan_geneome_filename' => ( is => 'rw', isa => 'Str', default => 'pan_genome.fa' ); | |||||||||
| 28 | 1 | has 'output_statistics_filename' => ( is => 'rw', isa => 'Str', default => 'gene_presence_absence.csv' ); | |||||||||
| 29 | 1 | has 'job_runner' => ( is => 'rw', isa => 'Str', default => 'Local' ); | |||||||||
| 30 | 1 | has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 ); | |||||||||
| 31 | 1 | has 'makeblastdb_exec' => ( is => 'rw', isa => 'Str', default => 'makeblastdb' ); | |||||||||
| 32 | 1 | has 'blastp_exec' => ( is => 'rw', isa => 'Str', default => 'blastp' ); | |||||||||
| 33 | 1 | has 'mcxdeblast_exec' => ( is => 'ro', isa => 'Str', default => 'mcxdeblast' ); | |||||||||
| 34 | 1 | has 'mcl_exec' => ( is => 'ro', isa => 'Str', default => 'mcl' ); | |||||||||
| 35 | 1 | has 'perc_identity' => ( is => 'ro', isa => 'Num', default => 98 ); | |||||||||
| 36 | 1 | has 'dont_delete_files' => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||
| 37 | 1 | has 'dont_create_rplots' => ( is => 'rw', isa => 'Bool', default => 0 ); | |||||||||
| 38 | 1 | has 'dont_split_groups' => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||
| 39 | 1 | has 'verbose_stats' => ( is => 'rw', isa => 'Bool', default => 0 ); | |||||||||
| 40 | 1 | has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 ); | |||||||||
| 41 | 1 | has 'group_limit' => ( is => 'rw', isa => 'Num', default => 50000 ); | |||||||||
| 42 | 1 | has 'core_definition' => ( is => 'rw', isa => 'Num', default => 1.0 ); | |||||||||
| 43 | 1 | has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 ); | |||||||||
| 44 | 1 | has 'mafft' => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||
| 45 | 1 | has 'inflation_value' => ( is => 'rw', isa => 'Num', default => 1.5 ); | |||||||||
| 46 | 1 | has 'allow_paralogs' => ( is => 'rw', isa => 'Bool', default => 0 ); | |||||||||
| 47 | |||||||||||
| 48 | 1 | has 'output_multifasta_files' => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||
| 49 | |||||||||||
| 50 | 1 | ▶ | sub run { | ||||||||
|
Subroutine
run: called CC=7 SCAR=31.5
Pod
undocumented
| |||||||||||
| 51 | 1 | my ($self) = @_; | |||||||||
| 52 | |||||||||||
| 53 | 1 | my $output_combined_filename = '_combined_files'; | |||||||||
| 54 | 1 | my $output_cd_hit_filename = '_clustered'; | |||||||||
| 55 | 1 | my $output_blast_results_filename = '_blast_results'; | |||||||||
| 56 | 1 | my $output_mcl_filename = '_uninflated_mcl_groups'; | |||||||||
| 57 | 1 | my $output_filtered_clustered_fasta = '_clustered_filtered.fa'; | |||||||||
| 58 | 1 | my $cdhit_groups = $output_combined_filename.'.groups'; | |||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | 1 | ▶ | unlink($cdhit_groups) unless($self->dont_delete_files == 1); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | |||||||||||
| 63 | 1 | ▶ | print "Combine proteins into a single file\n" if($self->verbose); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 1 | 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}; | |||||||||
| 71 | |||||||||||
| 72 | 0 | ▶ | print "Iteratively run cd-hit\n" if($self->verbose); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | print "Parallel all against all blast\n" if($self->verbose); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | print "Cluster with MCL\n" if($self->verbose); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | unlink($output_blast_results_filename) unless($self->dont_delete_files == 1); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 143 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 144 | |||||||||||
| 145 | 1 | 1; | |||||||||
| 146 | |||||||||||
| 147 | __END__ | ||||||||||