line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::TreeIO::nhx |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Aaron Mackey |
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 |
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
|
5
|
|
|
5
|
|
17
|
use strict; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
129
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Object preamble - inherits from Bio::Root::Root |
83
|
|
|
|
|
|
|
|
84
|
5
|
|
|
5
|
|
1601
|
use Bio::Tree::NodeNHX; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
118
|
|
85
|
5
|
|
|
5
|
|
19
|
use Bio::Event::EventGeneratorI; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
92
|
|
86
|
|
|
|
|
|
|
#use XML::Handler::Subs; |
87
|
|
|
|
|
|
|
|
88
|
5
|
|
|
5
|
|
14
|
use base qw(Bio::TreeIO::newick); |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
1390
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _initialize { |
91
|
29
|
|
|
29
|
|
51
|
my($self, %args) = @_; |
92
|
29
|
|
50
|
|
|
103
|
$args{-nodetype} ||= 'Bio::Tree::NodeNHX'; |
93
|
29
|
|
|
|
|
94
|
$self->SUPER::_initialize(%args); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _node_as_string { |
97
|
496
|
|
|
496
|
|
359
|
my $self = shift; |
98
|
496
|
|
|
|
|
312
|
my $node = shift; |
99
|
496
|
|
|
|
|
319
|
my $params = shift; |
100
|
|
|
|
|
|
|
|
101
|
496
|
|
|
|
|
581
|
my $label_stringbuffer = $self->SUPER::_node_as_string($node,$params); |
102
|
|
|
|
|
|
|
|
103
|
496
|
|
|
|
|
718
|
my @tags = $node->get_all_tags; |
104
|
496
|
100
|
|
|
|
723
|
if( scalar(@tags) > 0 ) { |
105
|
430
|
|
|
|
|
348
|
@tags = sort @tags; |
106
|
|
|
|
|
|
|
$label_stringbuffer .= '[' . |
107
|
|
|
|
|
|
|
join(":", "&&NHX", |
108
|
430
|
|
|
|
|
376
|
map { "$_=" .join(',',$node->get_tag_values($_)) } |
|
674
|
|
|
|
|
918
|
|
109
|
|
|
|
|
|
|
@tags ) . ']'; |
110
|
|
|
|
|
|
|
} |
111
|
496
|
|
|
|
|
720
|
return $label_stringbuffer; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |