lib/Bio/AutomatedAnnotation/CommandLine/GeneNameOccurances.pm

filter: Statementstmt 85.7% 42 / 49 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 3 totaltotal 79.1% 57 / 72 CC 8 SCAR 12.3
CC
8
Cov
82%
BUILD
5.5
run
4.2
usage_text
2.0
CRAP 3.4
« lib/Bio/AutomatedAnnotation.pm ↑ Summary lib/Bio/AutomatedAnnotation/GeneNamesFromGFF.pm »
1 package Bio::AutomatedAnnotation::CommandLine::GeneNameOccurances;
2  
3 # ABSTRACT: Create a spreadsheet with gene name occurances
4  
5  
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Getopt::Long qw(GetOptionsFromArray);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Bio::AutomatedAnnotation::SpreadsheetOfGeneOccurances;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Bio::AutomatedAnnotation::GeneNameOccurances;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
12 1 has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
13 1 has 'help' => ( is => 'rw', isa => 'Bool', default => 0 );
14  
15 1 has 'gff_files' => ( is => 'rw', isa => 'ArrayRef' );
16 1 has 'output_filename' => ( is => 'rw', isa => 'Str' );
17  
18 1 has '_error_message' => ( is => 'rw', isa => 'Str' );
19  
20 sub BUILD {
21 4 ▶ my ($self) = @_;
Subroutine BUILD: called CC=5 SCAR=17.0
Pod undocumented
22  
23 4 my ( $gff_files, $output_filename, $help );
24  
25 4 GetOptionsFromArray(
26 $self->args,
27 'o|output=s' => \$output_filename,
28 'h|help' => \$help,
29 );
30  
31 4 ▶ $self->output_filename($output_filename) if ( defined($output_filename) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $output_filename 1 3 4
32  
33 4 ▶ if ( @{ $self->args } == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->args;} == 0) 0 4 4
34 0 $self->_error_message("Error: You need to provide at least 1 GFF file");
35 }
36  
37 4 for my $filename ( @{ $self->args } ) {
38 8 ▶ if ( !-e $filename ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $filename) 0 8 8
39 0 $self->_error_message("Error: Cant access file $filename");
40 0 last;
41 }
42 }
43 4 $self->gff_files( $self->args );
44  
45 }
46  
47 sub run {
48 4 ▶ my ($self) = @_;
Subroutine run: called CC=4 SCAR=14.4
Pod undocumented
49  
50 4 ▶ ( !$self->help ) or die $self->usage_text;
Branch: 1 branch
BranchTrueFalseTotal
$self->help and die $self->usage_text 0 4 4
51 4 ▶ if ( defined( $self->_error_message ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->_error_message) 0 4 4
52 0 print $self->_error_message . "\n";
53 0 die $self->usage_text;
54 }
55  
56 4 my $gene_name_occurances_obj = Bio::AutomatedAnnotation::GeneNameOccurances->new(gff_files => $self->gff_files);
57
58 4 my %input_params = (
59 gene_occurances => $gene_name_occurances_obj
60 );
61  
62 4 ▶ if ( defined( $self->output_filename ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->output_filename) 1 3 4
63 1 $input_params{output_filename} = $self->output_filename;
64 }
65  
66 4 my $spreadsheet_obj = Bio::AutomatedAnnotation::SpreadsheetOfGeneOccurances->new(\%input_params);
67 4 $spreadsheet_obj->create_spreadsheet;
68
69 }
70  
71 sub usage_text {
72 0 ▶ my ($self) = @_;
Subroutine usage_text: not called CC=1 SCAR=6.9
Pod undocumented
73  
74 0 return <<USAGE;
75 Usage: gene_name_occurances [options]
76 Create a spreadsheet with gene name occurances
77  
78 # Create a spreadsheet with gene name occurances
79 gene_name_occurances *.gff
80
81 # Provide an output filename
82 gene_name_occurances -o outputfile.fa *.gff
83  
84 # This help message
85 gene_name_occurances -h
86  
87 USAGE
88 }
89  
90 1 __PACKAGE__->meta->make_immutable;
91 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
92 1 1;
93  
94 __END__
95  
96 =pod
97  
98 =encoding UTF-8
99  
100 =head1 NAME
101  
102 Bio::AutomatedAnnotation::CommandLine::GeneNameOccurances - Create a spreadsheet with gene name occurances
103  
104 =head1 VERSION
105  
106 version 1.182685
107  
108 =head1 SYNOPSIS
109  
110 Create a spreadsheet with gene name occurances
111  
112 =head1 AUTHOR
113  
114 Andrew J. Page <ap13@sanger.ac.uk>
115  
116 =head1 COPYRIGHT AND LICENSE
117  
118 This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
119  
120 This is free software, licensed under:
121  
122 The GNU General Public License, Version 3, June 2007
123  
124 =cut
« lib/Bio/AutomatedAnnotation.pm ↑ Summary lib/Bio/AutomatedAnnotation/GeneNamesFromGFF.pm »