lib/Bio/AutomatedAnnotation/ParseGenesFromGFFs.pm

filter: Statementstmt 100% 50 / 50 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 94.2% 65 / 69 CC 8 SCAR 14.2
CC
8
Cov
97%
create_fasta_file
7.0
_build__parser_objects
2.0
BEGIN
1.0
CRAP 4.2
« blib/lib/Bio/AutomatedAnnotation.pm ↑ Summary lib/Bio/AutomatedAnnotation/External/Cmscan.pm »
1 package Bio::AutomatedAnnotation::ParseGenesFromGFFs;
2  
3 # ABSTRACT: Parse GFF files and efficiency extract the gene sequence.
4  
5  
6 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Bio::AutomatedAnnotation::ParseGenesFromGFF;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 has 'gff_files' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
11 2 has 'search_query' => ( is => 'ro', isa => 'Str', required => 1 );
12 2 has 'search_qualifiers' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
13 2 has 'codontable_id' => ( is => 'ro', isa => 'Int', default => 11 );
14 2 has 'amino_acids' => ( is => 'ro', isa => 'Bool', default => 0 );
15 2 has 'output_file' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build_output_file' );
16 2 has 'output_base' => ( is => 'rw', isa => 'Str', default => 'output' );
17 2 has '_parser_objects' => ( is => 'ro', isa => 'ArrayRef', lazy => 1, builder => '_build__parser_objects' );
18  
19 2 has 'files_with_hits' => ( is => 'rw', isa => 'Int', default => 0 );
20 2 has 'files_without_hits' => ( is => 'rw', isa => 'Int', default => 0 );
21  
22 sub _build_output_file {
23 10 ▶ my ($self) = @_;
Subroutine _build_output_file: called CC=1 SCAR=0.0
24 10 my $file_suffix = $self->search_query;
25 10 $file_suffix =~ s!\W!!gi;
26 10 return join( '.', ( $self->output_base, $file_suffix, 'fa' ) );
27 }
28  
29 sub _build__parser_objects {
30 11 ▶ my ($self) = @_;
Subroutine _build__parser_objects: called CC=2 SCAR=6.9
31 11 my @parser_objects;
32 11 for my $gff_file ( @{ $self->gff_files } ) {
33 15 push(
34 @parser_objects,
35 Bio::AutomatedAnnotation::ParseGenesFromGFF->new(
36 gff_file => $gff_file,
37 search_query => $self->search_query,
38 search_qualifiers => $self->search_qualifiers
39 )
40 );
41 }
42 11 return \@parser_objects;
43 }
44  
45 sub create_fasta_file {
46 11 ▶ my ($self) = @_;
Subroutine create_fasta_file: called CC=7 SCAR=19.5
Pod undocumented
47  
48 11 my $output_fh = Bio::SeqIO->new(
49 -format => 'Fasta',
50 -file => ">" . $self->output_file
51 );
52 11 for my $parser_obj ( @{ $self->_parser_objects } ) {
53 15 ▶ if ( !defined( $parser_obj->_bio_seq_objects ) || @{ $parser_obj->_bio_seq_objects } == 0 )
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $parser_obj->_bio_seq_objects or @{$parser_obj->_bio_seq_objects;} == 0) { } 5 10 15
Condition66%2/3
not defined $parser_obj->_bio_seq_objects or @{$parser_obj->_bio_seq_objects;} == 0
l!l&&r!l&&!r
0510
MC/DC50%1/2
not defined $parser_obj->_bio_seq_objects or @{$parser_obj->_bio_seq_objects;} == 0
not defined $parser_obj->_bio_seq_objects @{$parser_obj->_bio_seq_objects;} == 0
Truth table66%2/3
not(A) or B
A= not defined $parser_obj->_bio_seq_objectsB= @{$parser_obj->_bio_seq_objects;} == 0
ABresult
1X1
011
000
54 {
55 5 $self->files_without_hits($self->files_without_hits() +1 );
56 5 next;
57 }
58 else
59 {
60 10 $self->files_with_hits($self->files_with_hits() +1);
61 }
62
63 10 for my $seq_obj ( @{ $parser_obj->_bio_seq_objects } ) {
64 18 ▶ next if ( !defined($seq_obj) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $seq_obj 0 18 18
65  
66 18 ▶ if ( $self->amino_acids ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->amino_acids) { } 3 15 18
67 3 $output_fh->write_seq( $seq_obj->translate( -codontable_id => $self->codontable_id ) );
68 }
69 else {
70 15 $output_fh->write_seq($seq_obj);
71 }
72 }
73 }
74 11 1;
75 }
76  
77 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
78 2 __PACKAGE__->meta->make_immutable;
79  
80 2 1;
81  
82 __END__
83  
84 =pod
85  
86 =encoding UTF-8
87  
88 =head1 NAME
89  
90 Bio::AutomatedAnnotation::ParseGenesFromGFFs - Parse GFF files and efficiency extract the gene sequence.
91  
92 =head1 VERSION
93  
94 version 1.182685
95  
96 =head1 SYNOPSIS
97  
98 Automated annotation of assemblies.
99 use Bio::AutomatedAnnotation::ParseGenesFromGFF;
100  
101 my $obj = Bio::AutomatedAnnotation::ParseGenesFromGFF->new(
102 gff_files => ['abc.gff','efg.gff'],
103 search_query => 'mecA'
104 );
105 $obj->annotate;
106  
107 =head1 AUTHOR
108  
109 Andrew J. Page <ap13@sanger.ac.uk>
110  
111 =head1 COPYRIGHT AND LICENSE
112  
113 This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
114  
115 This is free software, licensed under:
116  
117 The GNU General Public License, Version 3, June 2007
118  
119 =cut
« blib/lib/Bio/AutomatedAnnotation.pm ↑ Summary lib/Bio/AutomatedAnnotation/External/Cmscan.pm »