| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Tools::Phylo::PAML::ModelResult; |
|
2
|
|
|
|
|
|
|
$Bio::Tools::Phylo::PAML::ModelResult::VERSION = '1.7.2'; |
|
3
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
11
|
|
|
4
|
2
|
|
|
2
|
|
60
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
47
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
59
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
8
|
use base qw(Bio::Root::Root); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
2064
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: A container for NSSite Model Result from PAML |
|
10
|
|
|
|
|
|
|
# AUTHOR: Jason Stajich |
|
11
|
|
|
|
|
|
|
# OWNER: Jason Stajich |
|
12
|
|
|
|
|
|
|
# LICENSE: Perl_5 |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
9
|
|
|
9
|
1
|
61
|
my($class,@args) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
9
|
|
|
|
|
67
|
my $self = $class->SUPER::new(@args); |
|
20
|
9
|
|
|
|
|
351
|
my ($modelnum,$modeldesc,$kappa, |
|
21
|
|
|
|
|
|
|
$timeused,$trees, |
|
22
|
|
|
|
|
|
|
$pos_sites,$neb_sites,$beb_sites, |
|
23
|
|
|
|
|
|
|
$num_site_classes, $shape_params, |
|
24
|
|
|
|
|
|
|
$dnds_classes, |
|
25
|
|
|
|
|
|
|
$likelihood) = $self->_rearrange([qw(MODEL_NUM |
|
26
|
|
|
|
|
|
|
MODEL_DESCRIPTION |
|
27
|
|
|
|
|
|
|
KAPPA |
|
28
|
|
|
|
|
|
|
TIME_USED |
|
29
|
|
|
|
|
|
|
TREES |
|
30
|
|
|
|
|
|
|
POS_SITES |
|
31
|
|
|
|
|
|
|
NEB_SITES BEB_SITES |
|
32
|
|
|
|
|
|
|
NUM_SITE_CLASSES |
|
33
|
|
|
|
|
|
|
SHAPE_PARAMS |
|
34
|
|
|
|
|
|
|
DNDS_SITE_CLASSES |
|
35
|
|
|
|
|
|
|
LIKELIHOOD)], |
|
36
|
|
|
|
|
|
|
@args); |
|
37
|
9
|
50
|
|
|
|
512
|
if( $trees ) { |
|
38
|
9
|
50
|
|
|
|
44
|
if(ref($trees) !~ /ARRAY/i ) { |
|
39
|
0
|
|
|
|
|
0
|
$self->warn("Must provide a valid array reference to initialize trees"); |
|
40
|
|
|
|
|
|
|
} else { |
|
41
|
9
|
|
|
|
|
22
|
foreach my $t ( @$trees ) { |
|
42
|
9
|
|
|
|
|
35
|
$self->add_tree($t); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
9
|
|
|
|
|
23
|
$self->{'_treeiterator'} = 0; |
|
47
|
9
|
100
|
|
|
|
26
|
if( $pos_sites ) { |
|
48
|
6
|
50
|
|
|
|
24
|
if(ref($pos_sites) !~ /ARRAY/i ) { |
|
49
|
0
|
|
|
|
|
0
|
$self->warn("Must provide a valid array reference to initialize pos_sites"); |
|
50
|
|
|
|
|
|
|
} else { |
|
51
|
6
|
|
|
|
|
17
|
foreach my $s ( @$pos_sites ) { |
|
52
|
8
|
50
|
|
|
|
22
|
if( ref($s) !~ /ARRAY/i ) { |
|
53
|
0
|
|
|
|
|
0
|
$self->warn("Need an array reference for each entry in the pos_sites object"); |
|
54
|
0
|
|
|
|
|
0
|
next; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
8
|
|
|
|
|
16
|
$self->add_pos_selected_site(@$s); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
9
|
100
|
|
|
|
23
|
if( $beb_sites ) { |
|
61
|
6
|
50
|
|
|
|
21
|
if(ref($beb_sites) !~ /ARRAY/i ) { |
|
62
|
0
|
|
|
|
|
0
|
$self->warn("Must provide a valid array reference to initialize beb_sites"); |
|
63
|
|
|
|
|
|
|
} else { |
|
64
|
6
|
|
|
|
|
14
|
foreach my $s ( @$beb_sites ) { |
|
65
|
9
|
50
|
|
|
|
42
|
if( ref($s) !~ /ARRAY/i ) { |
|
66
|
0
|
|
|
|
|
0
|
$self->warn("need an array ref for each entry in the beb_sites object"); |
|
67
|
0
|
|
|
|
|
0
|
next; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
9
|
|
|
|
|
23
|
$self->add_BEB_pos_selected_site(@$s); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
9
|
100
|
|
|
|
24
|
if( $neb_sites ) { |
|
74
|
6
|
50
|
|
|
|
23
|
if(ref($neb_sites) !~ /ARRAY/i ) { |
|
75
|
0
|
|
|
|
|
0
|
$self->warn("Must provide a valid array reference to initialize neb_sites"); |
|
76
|
|
|
|
|
|
|
} else { |
|
77
|
6
|
|
|
|
|
11
|
foreach my $s ( @$neb_sites ) { |
|
78
|
8
|
50
|
|
|
|
19
|
if( ref($s) !~ /ARRAY/i ) { |
|
79
|
0
|
|
|
|
|
0
|
$self->warn("need an array ref for each entry in the neb_sites object"); |
|
80
|
0
|
|
|
|
|
0
|
next; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
8
|
|
|
|
|
18
|
$self->add_NEB_pos_selected_site(@$s); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
9
|
100
|
|
|
|
34
|
defined $modelnum && $self->model_num($modelnum); |
|
88
|
9
|
100
|
|
|
|
35
|
defined $modeldesc && $self->model_description($modeldesc); |
|
89
|
9
|
50
|
|
|
|
35
|
defined $kappa && $self->kappa($kappa); |
|
90
|
9
|
100
|
|
|
|
25
|
defined $timeused && $self->time_used($timeused); |
|
91
|
9
|
50
|
|
|
|
33
|
defined $likelihood && $self->likelihood($likelihood); |
|
92
|
|
|
|
|
|
|
|
|
93
|
9
|
|
100
|
|
|
36
|
$self->num_site_classes($num_site_classes || 0); |
|
94
|
9
|
100
|
|
|
|
20
|
if( defined $dnds_classes ) { |
|
95
|
8
|
50
|
33
|
|
|
70
|
if( ref($dnds_classes) !~ /HASH/i || |
|
96
|
|
|
|
|
|
|
! defined $dnds_classes->{'p'} || |
|
97
|
|
|
|
|
|
|
! defined $dnds_classes->{'w'} ) { |
|
98
|
0
|
|
|
|
|
0
|
$self->warn("-dnds_site_classes expects a hashref with keys p and w"); |
|
99
|
|
|
|
|
|
|
} else { |
|
100
|
8
|
|
|
|
|
25
|
$self->dnds_site_classes($dnds_classes); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
} |
|
103
|
9
|
100
|
|
|
|
22
|
if( defined $shape_params ) { |
|
104
|
3
|
50
|
|
|
|
12
|
if( ref($shape_params) !~ /HASH/i ) { |
|
105
|
0
|
|
|
|
|
0
|
$self->warn("-shape_params expects a hashref not $shape_params\n"); |
|
106
|
|
|
|
|
|
|
} else { |
|
107
|
3
|
|
|
|
|
8
|
$self->shape_params($shape_params); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
9
|
|
|
|
|
87
|
return $self; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub model_num { |
|
116
|
14
|
|
|
14
|
1
|
6205
|
my $self = shift; |
|
117
|
14
|
100
|
|
|
|
46
|
return $self->{'_num'} = shift if @_; |
|
118
|
7
|
|
|
|
|
31
|
return $self->{'_num'}; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub model_description{ |
|
123
|
12
|
|
|
12
|
1
|
20
|
my $self = shift; |
|
124
|
12
|
100
|
|
|
|
35
|
return $self->{'_model_description'} = shift if @_; |
|
125
|
5
|
|
|
|
|
93
|
return $self->{'_model_description'}; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub time_used{ |
|
130
|
7
|
|
|
7
|
1
|
12
|
my $self = shift; |
|
131
|
7
|
50
|
|
|
|
21
|
return $self->{'_time_used'} = shift if @_; |
|
132
|
0
|
|
|
|
|
0
|
return $self->{'_time_used'}; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub kappa{ |
|
137
|
15
|
|
|
15
|
1
|
36
|
my $self = shift; |
|
138
|
15
|
100
|
|
|
|
41
|
return $self->{'_kappa'} = shift if @_; |
|
139
|
6
|
|
|
|
|
23
|
return $self->{'_kappa'}; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub num_site_classes{ |
|
144
|
17
|
|
|
17
|
1
|
32
|
my $self = shift; |
|
145
|
17
|
100
|
|
|
|
44
|
return $self->{'_num_site_classes'} = shift if @_; |
|
146
|
8
|
|
|
|
|
33
|
return $self->{'_num_site_classes'}; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub dnds_site_classes{ |
|
151
|
12
|
|
|
12
|
1
|
2383
|
my $self = shift; |
|
152
|
12
|
100
|
|
|
|
36
|
return $self->{'_dnds_site_classes'} = shift if @_; |
|
153
|
4
|
|
|
|
|
11
|
return $self->{'_dnds_site_classes'}; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub get_pos_selected_sites{ |
|
158
|
1
|
50
|
|
1
|
1
|
820
|
return @{$_[0]->{'_posselsites'} || []}; |
|
|
1
|
|
|
|
|
5
|
|
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub add_pos_selected_site{ |
|
163
|
8
|
|
|
8
|
1
|
17
|
my ($self,$site,$aa,$pvalue,$signif) = @_; |
|
164
|
8
|
|
|
|
|
10
|
push @{$self->{'_posselsites'}}, [ $site,$aa,$pvalue,$signif ]; |
|
|
8
|
|
|
|
|
21
|
|
|
165
|
8
|
|
|
|
|
10
|
return scalar @{$self->{'_posselsites'}}; |
|
|
8
|
|
|
|
|
16
|
|
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub get_NEB_pos_selected_sites{ |
|
170
|
1
|
50
|
|
1
|
1
|
839
|
return @{$_[0]->{'_NEBposselsites'} || []}; |
|
|
1
|
|
|
|
|
5
|
|
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub add_NEB_pos_selected_site{ |
|
175
|
8
|
|
|
8
|
1
|
17
|
my ($self,@args) = @_; |
|
176
|
8
|
|
|
|
|
11
|
push @{$self->{'_NEBposselsites'}}, [ @args ]; |
|
|
8
|
|
|
|
|
34
|
|
|
177
|
8
|
|
|
|
|
11
|
return scalar @{$self->{'_NEBposselsites'}}; |
|
|
8
|
|
|
|
|
17
|
|
|
178
|
|
|
|
|
|
|
} |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub get_BEB_pos_selected_sites{ |
|
184
|
0
|
0
|
|
0
|
1
|
0
|
return @{$_[0]->{'_BEBposselsites'} || []}; |
|
|
0
|
|
|
|
|
0
|
|
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub add_BEB_pos_selected_site{ |
|
189
|
9
|
|
|
9
|
1
|
33
|
my ($self,@args) = @_; |
|
190
|
9
|
|
|
|
|
14
|
push @{$self->{'_BEBposselsites'}}, [ @args ]; |
|
|
9
|
|
|
|
|
33
|
|
|
191
|
9
|
|
|
|
|
18
|
return scalar @{$self->{'_BEBposselsites'}}; |
|
|
9
|
|
|
|
|
26
|
|
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub next_tree{ |
|
196
|
5
|
|
|
5
|
1
|
12
|
my ($self,@args) = @_; |
|
197
|
5
|
|
50
|
|
|
21
|
return $self->{'_trees'}->[$self->{'_treeiterator'}++] || undef; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub get_trees{ |
|
202
|
2
|
|
|
2
|
1
|
4
|
my ($self) = @_; |
|
203
|
2
|
50
|
|
|
|
3
|
return @{$self->{'_trees'} || []}; |
|
|
2
|
|
|
|
|
11
|
|
|
204
|
|
|
|
|
|
|
} |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub rewind_tree_iterator { |
|
208
|
0
|
|
|
0
|
1
|
0
|
shift->{'_treeiterator'} = 0; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub add_tree{ |
|
213
|
9
|
|
|
9
|
1
|
19
|
my ($self,$tree) = @_; |
|
214
|
9
|
50
|
33
|
|
|
70
|
if( $tree && ref($tree) && $tree->isa('Bio::Tree::TreeI') ) { |
|
|
|
|
33
|
|
|
|
|
|
215
|
9
|
|
|
|
|
18
|
push @{$self->{'_trees'}},$tree; |
|
|
9
|
|
|
|
|
27
|
|
|
216
|
|
|
|
|
|
|
} |
|
217
|
9
|
|
|
|
|
15
|
return scalar @{$self->{'_trees'}}; |
|
|
9
|
|
|
|
|
26
|
|
|
218
|
|
|
|
|
|
|
} |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub shape_params{ |
|
222
|
4
|
|
|
4
|
1
|
1259
|
my $self = shift; |
|
223
|
4
|
100
|
|
|
|
12
|
return $self->{'_shape_params'} = shift if @_; |
|
224
|
1
|
|
|
|
|
4
|
return $self->{'_shape_params'}; |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub likelihood{ |
|
229
|
15
|
|
|
15
|
1
|
28
|
my $self = shift; |
|
230
|
15
|
100
|
|
|
|
40
|
return $self->{'likelihood'} = shift if @_; |
|
231
|
6
|
|
|
|
|
21
|
return $self->{'likelihood'}; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1; |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
__END__ |