lib/Bio/Roary/CommandLine/ExtractProteomeFromGff.pm

filter: Statementstmt 87.6% 57 / 65 Branchbran 75.0% 18 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 83.0% 83 / 100 CC 15 SCAR 22.8
CC
15
Cov
84%
BUILD
15.3
run
3.2
BEGIN
1.0
CRAP 9.8
« lib/Bio/Roary/External/Fasttree.pm ↑ Summary lib/Bio/Roary/CommandLine/RoaryReorderSpreadsheet.pm »
1 21 undef $VERSION;
2 package Bio::Roary::CommandLine::ExtractProteomeFromGff;
3 21 $Bio::Roary::CommandLine::ExtractProteomeFromGff::VERSION = '3.13.0';
4 # ABSTRACT: Take in GFF files and output the proteome
5  
6  
7 21 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 21 ▶use Getopt::Long qw(GetOptionsFromArray);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 21 ▶use Bio::Roary::ExtractProteomeFromGFF;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 21 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 21 extends 'Bio::Roary::CommandLine::Common';
12  
13 21 has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
14 21 has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
15 21 has 'help' => ( is => 'rw', isa => 'Bool', default => 0 );
16  
17 21 has 'gff_files' => ( is => 'rw', isa => 'ArrayRef' );
18 21 has 'output_suffix' => ( is => 'rw', isa => 'Str', default => 'proteome.faa' );
19 21 has '_error_message' => ( is => 'rw', isa => 'Str' );
20 21 has 'apply_unknowns_filter' => ( is => 'rw', isa => 'Bool', default => 1 );
21 21 has 'translation_table' => ( is => 'rw', isa => 'Int', default => 11 );
22 21 has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
23 21 has 'output_directory' => ( is => 'rw', isa => 'Str', default => '.' );
24  
25 23 ▶sub BUILD {
Subroutine BUILD: called CC=13 SCAR=27.3
Pod undocumented
26 23 my ($self) = @_;
27  
28 23 my ( $gff_files, $output_suffix, $apply_unknowns_filter, $help, $translation_table, $verbose, $cmd_version, $output_directory );
29  
30 23 GetOptionsFromArray(
31 $self->args,
32 'o|output_suffix=s' => \$output_suffix,
33 'f|apply_unknowns_filter=i' => \$apply_unknowns_filter,
34 't|translation_table=i' => \$translation_table,
35 'v|verbose' => \$verbose,
36 'd|output_directory=s' => \$output_directory,
37 'w|version' => \$cmd_version,
38 'h|help' => \$help,
39 );
40
41 23 ▶ if ( defined($verbose) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $verbose) 0 23 23
42 0 $self->verbose($verbose);
43 0 $self->logger->level(10000);
44 }
45
46 23 ▶ $self->help($help) if(defined($help));
Branch: 1 branch
BranchTrueFalseTotal
if defined $help 1 22 23
47 23 ▶ ( !$self->help ) or die $self->usage_text;
Branch: 1 branch
BranchTrueFalseTotal
$self->help and die $self->usage_text 1 22 23
48
49 22 ▶ $self->version($cmd_version) if ( defined($cmd_version) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $cmd_version 0 22 22
50 22 ▶ if ( $self->version ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->version) 0 22 22
51 0 die($self->_version());
52 }
53  
54 22 ▶ if ( @{ $self->args } == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->args;} == 0) 0 22 22
55 0 $self->_error_message("Error: You need to provide a GFF file");
56 }
57  
58 22 ▶ $self->output_suffix($output_suffix) if ( defined($output_suffix) ) ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $output_suffix 20 2 22
59 22 ▶ $self->apply_unknowns_filter($apply_unknowns_filter) if ( defined($apply_unknowns_filter) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $apply_unknowns_filter 20 2 22
60 22 ▶ $self->translation_table($translation_table) if ( defined($translation_table) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $translation_table 21 1 22
61 22 ▶ $self->output_directory($output_directory) if ( defined($output_directory) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $output_directory 20 2 22
62  
63 22 for my $filename ( @{ $self->args } ) {
64 22 ▶ if ( !-e $filename ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $filename) 0 22 22
65 0 $self->_error_message("Error: Cant access file $filename");
66 0 last;
67 }
68 }
69 22 $self->gff_files( $self->args );
70  
71 }
72  
73 22 ▶sub run {
Subroutine run: called CC=3 SCAR=11.6
Pod undocumented
74 22 my ($self) = @_;
75  
76 22 ▶ if ( defined( $self->_error_message ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->_error_message) 0 22 22
77 0 print $self->_error_message . "\n";
78 0 die $self->usage_text;
79 }
80  
81 22 for my $gff_file ( @{ $self->gff_files } ) {
82 22 my ( $filename, $directories, $suffix ) = fileparse($gff_file);
83 22 my $obj = Bio::Roary::ExtractProteomeFromGFF->new(
84 gff_file => $gff_file,
85 output_filename => $filename . '.' . $self->output_suffix,
86 apply_unknowns_filter => $self->apply_unknowns_filter,
87 translation_table => $self->translation_table,
88 output_directory => $self->output_directory,
89 );
90 22 $obj->fasta_file();
91 }
92  
93 }
94  
95 1 ▶sub usage_text {
Subroutine usage_text: called CC=1 SCAR=0.0
Pod undocumented
96 1 my ($self) = @_;
97  
98 1 return <<USAGE;
99 Usage: extract_proteome_from_gff [options] *.gff
100 Take in GFF files and create FASTA files of the protein sequences
101  
102 Options: -o STR output suffix [proteome.faa]
103 -t INT translation table [11]
104 -f filter sequences with missing data
105 -v verbose output to STDOUT
106 -d STR output directory
107 -w print version and exit
108 -h this help message
109  
110 For further info see: http://sanger-pathogens.github.io/Roary/
111 USAGE
112 }
113  
114 21 __PACKAGE__->meta->make_immutable;
115 21 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
116 21 1;
117  
118 __END__
« lib/Bio/Roary/External/Fasttree.pm ↑ Summary lib/Bio/Roary/CommandLine/RoaryReorderSpreadsheet.pm »