lib/Bio/Roary/CommandLine/TransferAnnotationToGroups.pm

filter: Statementstmt 85.1% 46 / 54 Branchbran 62.5% 10 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 75.2% 64 / 85 CC 11 SCAR 21.7
CC
11
Cov
78%
BUILD
14.0
run
2.2
BEGIN
1.0
CRAP 8.8
« lib/Bio/Roary/CommandLine/RoaryCoreAlignment.pm ↑ Summary lib/Bio/Roary/OrderGenes.pm »
1 1 undef $VERSION;
2 package Bio::Roary::CommandLine::TransferAnnotationToGroups;
3 1 $Bio::Roary::CommandLine::TransferAnnotationToGroups::VERSION = '3.13.0';
4 # ABSTRACT: Take in a groups file and a set of GFF files and transfer the consensus annotation
5  
6  
7 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Getopt::Long qw(GetOptionsFromArray);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Bio::Roary::AnnotateGroups;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 extends 'Bio::Roary::CommandLine::Common';
11  
12  
13 1 has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
14 1 has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
15 1 has 'help' => ( is => 'rw', isa => 'Bool', default => 0 );
16  
17 1 has 'gff_files' => ( is => 'rw', isa => 'ArrayRef' );
18 1 has 'groups_filename' => ( is => 'rw', isa => 'Str' );
19 1 has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'reannotated_groups' );
20 1 has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
21 1 has '_error_message' => ( is => 'rw', isa => 'Str' );
22  
23 2 ▶sub BUILD {
Subroutine BUILD: called CC=10 SCAR=26.4
Pod undocumented
24 2 my ($self) = @_;
25  
26 2 my ( $gff_files, $output_filename, $groups_filename, @group_names, $action,$verbose, $help );
27  
28 2 GetOptionsFromArray(
29 $self->args,
30 'o|output=s' => \$output_filename,
31 'g|groups_filename=s' => \$groups_filename,
32 'v|verbose' => \$verbose,
33 'h|help' => \$help,
34 );
35
36 2 ▶ if ( defined($verbose) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $verbose) 0 2 2
37 0 $self->verbose($verbose);
38 0 $self->logger->level(10000);
39 }
40
41 2 ▶ $self->help($help) if(defined($help));
Branch: 1 branch
BranchTrueFalseTotal
if defined $help 1 1 2
42 2 ▶ ( !$self->help ) or die $self->usage_text;
Branch: 1 branch
BranchTrueFalseTotal
$self->help and die $self->usage_text 1 1 2
43
44 1 ▶ if ( @{ $self->args } == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->args;} == 0) 0 1 1
45 0 $self->_error_message("Error: You need to provide a FASTA file");
46 }
47  
48 1 ▶ $self->output_filename($output_filename) if ( defined($output_filename) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $output_filename 0 1 1
49 1 ▶ if ( defined($groups_filename) && ( -e $groups_filename ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $groups_filename and -e $groups_filename) { } 1 0 1
Condition33%1/3
defined $groups_filename and -e $groups_filename
!ll&&!rl&&r
001
MC/DC0%0/2
defined $groups_filename and -e $groups_filename
defined $groups_filename -e $groups_filename
Truth table33%1/3
A and B
A= defined $groups_filenameB= -e $groups_filename
ABresult
0X0
100
111
50 1 $self->groups_filename($groups_filename);
51 }
52 else {
53 0 $self->_error_message("Error: Cant access the groups file");
54 }
55  
56 1 for my $filename ( @{ $self->args } ) {
57 3 ▶ if ( !-e $filename ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $filename) 0 3 3
58 0 $self->_error_message("Error: Cant access file $filename");
59 0 last;
60 }
61 }
62 1 $self->gff_files( $self->args );
63  
64 }
65  
66 1 ▶sub run {
Subroutine run: called CC=2 SCAR=7.9
Pod undocumented
67 1 my ($self) = @_;
68  
69
70 1 ▶ if ( defined( $self->_error_message ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->_error_message) 0 1 1
71 0 print $self->_error_message . "\n";
72 0 die $self->usage_text;
73 }
74  
75
76 1 my $obj = Bio::Roary::AnnotateGroups->new(
77 gff_files => $self->gff_files,
78 output_filename => $self->output_filename,
79 groups_filename => $self->groups_filename,
80 );
81 1 $obj->reannotate;
82  
83 }
84  
85 1 ▶sub usage_text {
Subroutine usage_text: called CC=1 SCAR=0.0
Pod undocumented
86 1 my ($self) = @_;
87  
88 1 return <<USAGE;
89 Usage: transfer_annotation_to_groups [options] *.gff
90 Take in a groups file and the protein fasta files and output selected data
91  
92 Options: -o STR output filename [reannotated_groups]
93 -g STR clusters filename [clustered_proteins]
94 -v verbose output to STDOUT
95 -h this help message
96  
97 For further info see: http://sanger-pathogens.github.io/Roary/
98 USAGE
99 }
100  
101 1 __PACKAGE__->meta->make_immutable;
102 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
103 1 1;
104  
105 __END__
« lib/Bio/Roary/CommandLine/RoaryCoreAlignment.pm ↑ Summary lib/Bio/Roary/OrderGenes.pm »