Bio/TreeIO/nhx.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 94.7% 36 / 38 CC 3 SCAR 4.1
CC
3
Cov
97%
_initialize
2.0
_node_as_string
2.0
BEGIN
1.0
CRAP 1.5
« Bio/Tools/Run/ParametersI.pm ↑ Summary Bio/Ontology/DocumentRegistry.pm »
1 #
2 # BioPerl module for Bio::TreeIO::nhx
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Aaron Mackey <amackey@virginia.edu>
7 #
8 # Copyright Aaron Mackey
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 =head1 NAME
15  
16 Bio::TreeIO::nhx - TreeIO implementation for parsing
17 Newick/New Hampshire eXtendend (NHX) format.
18  
19 =head1 SYNOPSIS
20  
21 # do not use this module directly
22 use Bio::TreeIO;
23 my $treeio = Bio::TreeIO->new(-format => 'nhx', -file => 'tree.dnd');
24 my $tree = $treeio->next_tree;
25  
26 =head1 DESCRIPTION
27  
28 This module handles parsing and writing of Newick/New Hampshire eXtended (NHX) format.
29  
30 =head1 FEEDBACK
31  
32 =head2 Mailing Lists
33  
34 User feedback is an integral part of the evolution of this and other
35 Bioperl modules. Send your comments and suggestions preferably to the
36 Bioperl mailing list. Your participation is much appreciated.
37  
38 bioperl-l@bioperl.org - General discussion
39 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
40  
41 =head2 Support
42  
43 Please direct usage questions or support issues to the mailing list:
44  
45 I<bioperl-l@bioperl.org>
46  
47 rather than to the module maintainer directly. Many experienced and
48 reponsive experts will be able look at the problem and quickly
49 address it. Please include a thorough description of the problem
50 with code and data examples if at all possible.
51  
52 =head2 Reporting Bugs
53  
54 Report bugs to the Bioperl bug tracking system to help us keep track
55 of the bugs and their resolution. Bug reports can be submitted viax the
56 web:
57  
58 https://github.com/bioperl/bioperl-live/issues
59  
60 =head1 AUTHOR - Aaron Mackey
61  
62 Email amackey-at-virginia.edu
63  
64 =head1 CONTRIBUTORS
65  
66 Email jason-at-bioperl-dot-org
67  
68 =head1 APPENDIX
69  
70 The rest of the documentation details each of the object methods.
71 Internal methods are usually preceded with a _
72  
73 =cut
74  
75  
76 # Let the code begin...
77  
78  
79 package Bio::TreeIO::nhx;
80 6 $Bio::TreeIO::nhx::VERSION = '1.7.8';
81 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 # Object preamble - inherits from Bio::Root::Root
84  
85 6 ▶use Bio::Tree::NodeNHX;
Subroutine BEGIN: called CC=1 SCAR=0.0
86 6 ▶use Bio::Event::EventGeneratorI;
Subroutine BEGIN: called CC=1 SCAR=0.0
87 #use XML::Handler::Subs;
88  
89 6 ▶use base qw(Bio::TreeIO::newick);
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 29 ▶sub _initialize {
Subroutine _initialize: called CC=2 SCAR=7.1
92 29 my($self, %args) = @_;
93 29 ▶ $args{-nodetype} ||= 'Bio::Tree::NodeNHX';
Condition50%1/2
$args{"-nodetype"} ||= "Bio::Tree::NodeNHX"
l!l
029
MC/DC0%0/1
$args{"-nodetype"} ||= "Bio::Tree::NodeNHX"
$args{"-nodetype"}
Truth table50%1/2
A
A= $args{"-nodetype"}
Aresult
11
00
94 29 $self->SUPER::_initialize(%args);
95 }
96  
97 496 ▶sub _node_as_string {
Subroutine _node_as_string: called CC=2 SCAR=6.9
98 496 my $self = shift;
99 496 my $node = shift;
100 496 my $params = shift;
101
102 496 my $label_stringbuffer = $self->SUPER::_node_as_string($node,$params);
103  
104 496 my @tags = $node->get_all_tags;
105 496 ▶ if( scalar(@tags) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @tags > 0) 430 66 496
106 430 @tags = sort @tags;
107 $label_stringbuffer .= '[' .
108 join(":", "&&NHX",
109 430 map { "$_=" .join(',',$node->get_tag_values($_)) }
110 @tags ) . ']';
111 }
112 496 return $label_stringbuffer;
113 }
114  
115 6 1;
« Bio/Tools/Run/ParametersI.pm ↑ Summary Bio/Ontology/DocumentRegistry.pm »