File Coverage

blib/lib/Bio/NEXUS/CodonsBlock.pm
Criterion Covered Total %
statement 18 34 52.9
branch 0 8 0.0
condition 0 3 0.0
subroutine 6 8 75.0
pod 1 1 100.0
total 25 54 46.3


line stmt bran cond sub pod time code
1             #################################################################
2             # CodonsBlock.pm
3             #################################################################
4             #
5             # thanks to Tom Hladish for the original version
6             #
7             # $Id: CodonsBlock.pm,v 1.14 2012/02/07 21:38:09 astoltzfus Exp $
8              
9             #################### START POD DOCUMENTATION ##################
10              
11             =head1 NAME
12              
13             Bio::NEXUS::CodonsBlock - Represents CODONS block in NEXUS file
14              
15             =head1 SYNOPSIS
16              
17             =head1 DESCRIPTION
18              
19             Placeholding module for the CODONS block class.
20              
21             =head1 COMMENTS
22              
23             =head1 FEEDBACK
24              
25             All feedback (bugs, feature enhancements, etc.) are greatly appreciated.
26              
27             =head1 AUTHORS
28              
29             Thomas Hladish (tjhladish at yahoo)
30              
31             =head1 VERSION
32              
33             $Revision: 1.14 $
34              
35             =head1 METHODS
36              
37             =cut
38              
39             package Bio::NEXUS::CodonsBlock;
40              
41 34     34   347 use strict;
  34         79  
  34         1301  
42 34     34   221 use Bio::NEXUS::Functions;
  34         71  
  34         8820  
43 34     34   218 use Bio::NEXUS::Util::Logger;
  34         73  
  34         892  
44 34     34   203 use Bio::NEXUS::Util::Exceptions;
  34         79  
  34         1556  
45 34     34   200 use vars qw(@ISA $VERSION $AUTOLOAD);
  34         87  
  34         5828  
46 34     34   192 use Bio::NEXUS; $VERSION = $Bio::NEXUS::VERSION;
  34         92  
  34         13547  
47              
48             @ISA = qw(Bio::NEXUS::Block);
49             my $logger = Bio::NEXUS::Util::Logger->new();
50              
51             =head2 new
52              
53             Title : new
54             Usage : block_object = new Bio::NEXUS::CodonsBlock($block_type, $commands, $verbose);
55             Function: Creates a new Bio::NEXUS::CodonsBlock object
56             Returns : Bio::NEXUS::CodonsBlock object
57             Args : type (string), the commands/comments to parse (array ref), and a verbose flag (0 or 1; optional)
58              
59             =cut
60              
61             sub new {
62 0     0 1   my ( $class, $type, $commands, $verbose, $taxa ) = @_;
63 0 0         if ( not $type) {
64 0           ( $type = lc $class ) =~ s/Bio::NEXUS::(.+)Block/$1/i;
65             }
66 0           my $self = {
67             'type' => $type
68             };
69 0           bless $self, $class;
70 0 0 0       if ( ( defined $commands ) and @$commands ) {
71 0           $self->_parse_block( $commands, $verbose )
72             }
73 0           return $self;
74             }
75              
76             sub AUTOLOAD {
77 0 0   0     return if $AUTOLOAD =~ /DESTROY$/;
78 0           my $package_name = __PACKAGE__ . '::';
79              
80             # The following methods are deprecated and are temporarily supported
81             # via a warning and a redirection
82 0           my %synonym_for = (
83              
84             # "${package_name}parse" => "${package_name}_parse_tree", # example
85             );
86              
87 0 0         if ( defined $synonym_for{$AUTOLOAD} ) {
88 0           $logger->warn("$AUTOLOAD() is deprecated; use $synonym_for{$AUTOLOAD}() instead");
89 0           goto &{ $synonym_for{$AUTOLOAD} };
  0            
90             }
91             else {
92 0           Bio::NEXUS::Util::Exceptions::UnknownMethod->throw(
93             'UnknownMethod' => "ERROR: Unknown method $AUTOLOAD called"
94             );
95             }
96             }
97             1;