| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id: HIVAnnotProcessor.pm 221 2008-12-11 13:05:24Z maj $ |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# BioPerl module for HIVAnnotProcessor |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Please direct questions and support issues to |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# Cared for by Mark A. Jensen |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Copyright Mark A. Jensen |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
HIVAnnotProcessor - Adds HIV-specific annotations to Bio::SeqIO streams |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_Stream_by_query { |
|
22
|
|
|
|
|
|
|
my ($self, $query ) = @_; |
|
23
|
|
|
|
|
|
|
my $stream = $self->get_seq_stream('-query' => $query, '-mode'=>'query'); |
|
24
|
|
|
|
|
|
|
return new Bio::DB::HIV::HIVAnnotProcessor( -hiv_query=>$query, |
|
25
|
|
|
|
|
|
|
-source_stream=>$stream ); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Bio::DB::HIV::HIVAnnotProcessor is chained to the C of a sequence stream returned from a query to the Los Alamos HIV sequence database made using L and L. It adds the annotations obtained in the C to the Bio::Seq objects themselves via the C<$seq-Eannotation> method. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 FEEDBACK |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 Mailing Lists |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
|
38
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
|
39
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
|
42
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 Support |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
I |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
|
51
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
|
52
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
|
53
|
|
|
|
|
|
|
with code and data examples if at all possible. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Reporting Bugs |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
|
58
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via |
|
59
|
|
|
|
|
|
|
the web: |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR - Mark A. Jensen |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Email maj@fortinbras.us |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Mark A. Jensen |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 APPENDIX |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
|
74
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Let the code begin... |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Bio::DB::HIV::HIVAnnotProcessor; |
|
81
|
3
|
|
|
3
|
|
719
|
use strict; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
67
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Object preamble - inherits from Bio::Root::Root |
|
84
|
|
|
|
|
|
|
|
|
85
|
3
|
|
|
3
|
|
9
|
use Bio::Root::Root; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
47
|
|
|
86
|
3
|
|
|
3
|
|
10
|
use base qw( Bio::Root::Root); |
|
|
3
|
|
|
|
|
2
|
|
|
|
3
|
|
|
|
|
993
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 Constructor |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 new |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Title : new |
|
93
|
|
|
|
|
|
|
Usage : my $obj = new HIVAnnotProcessor(); |
|
94
|
|
|
|
|
|
|
Function: Builds a new HIVAnnotProcessor object |
|
95
|
|
|
|
|
|
|
Returns : an instance of HIVAnnotProcessor |
|
96
|
|
|
|
|
|
|
Args : |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub new { |
|
101
|
1
|
|
|
1
|
1
|
109
|
my($class,@args) = @_; |
|
102
|
1
|
|
|
|
|
7
|
my $self = $class->SUPER::new(@args); |
|
103
|
1
|
|
|
|
|
8
|
my ($hiv_query, $source_stream) = |
|
104
|
|
|
|
|
|
|
$self->_rearrange([qw(HIV_QUERY SOURCE_STREAM)], @args); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
1
|
50
|
|
|
|
3
|
$hiv_query && $self->hiv_query($hiv_query); |
|
108
|
1
|
50
|
|
|
|
2
|
$source_stream && $self->source_stream($source_stream); |
|
109
|
|
|
|
|
|
|
|
|
110
|
1
|
|
|
|
|
2
|
return $self; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 Bio::Factory::SequenceProcessorI compliance |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 source_stream |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Title : source_stream |
|
118
|
|
|
|
|
|
|
Usage : $hap->source_stream($newval) |
|
119
|
|
|
|
|
|
|
Function: |
|
120
|
|
|
|
|
|
|
Example : |
|
121
|
|
|
|
|
|
|
Returns : value of source_stream (a scalar) |
|
122
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub source_stream{ |
|
127
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
|
128
|
2
|
100
|
|
|
|
5
|
if (@_) { |
|
129
|
1
|
50
|
|
|
|
8
|
$self->throw(-class=>'Bio::Root::BadParameter', |
|
130
|
|
|
|
|
|
|
-text=>'Requires a Bio::SeqIO as argument', |
|
131
|
|
|
|
|
|
|
-value=>$_[0]) unless $_[0]->isa('Bio::SeqIO'); |
|
132
|
|
|
|
|
|
|
} |
|
133
|
2
|
100
|
|
|
|
7
|
return $self->{'source_stream'} = shift if @_; |
|
134
|
1
|
|
|
|
|
3
|
return $self->{'source_stream'}; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 next_seq |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Title : next_seq |
|
140
|
|
|
|
|
|
|
Usage : $seqobj = stream->next_seq |
|
141
|
|
|
|
|
|
|
Function: Reads the next sequence object from the stream, |
|
142
|
|
|
|
|
|
|
: adds annotations from the HIVQuery object according |
|
143
|
|
|
|
|
|
|
: to the sequence id, and returns sequence object |
|
144
|
|
|
|
|
|
|
Returns : a Bio::Seq sequence object |
|
145
|
|
|
|
|
|
|
Args : none |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub next_seq { |
|
150
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
151
|
1
|
|
|
|
|
2
|
my $q = $self->hiv_query; |
|
152
|
1
|
|
|
|
|
18
|
my $seqo = $self->source_stream->next_seq; |
|
153
|
1
|
50
|
33
|
|
|
5
|
return $seqo unless ($q && $seqo); |
|
154
|
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
0
|
my $ac = $q->get_annotations_by_id($seqo->primary_id); |
|
156
|
0
|
0
|
|
|
|
0
|
$seqo->annotation($ac) if $ac; |
|
157
|
0
|
|
|
|
|
0
|
my $acc = $q->get_accessions_by_id($seqo->primary_id); |
|
158
|
0
|
0
|
|
|
|
0
|
$seqo->accession_number($acc) if $acc; |
|
159
|
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
0
|
return $seqo; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 write_seq |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Title : write_seq |
|
166
|
|
|
|
|
|
|
Usage : $seqobj->write_seq |
|
167
|
|
|
|
|
|
|
Function: for HIVAnnotProcessor, throw an exception |
|
168
|
|
|
|
|
|
|
Example : |
|
169
|
|
|
|
|
|
|
Returns : Bio::Root::IOException |
|
170
|
|
|
|
|
|
|
Args : |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub write_seq{ |
|
175
|
1
|
|
|
1
|
1
|
2
|
my ($self,@args) = @_; |
|
176
|
1
|
|
|
|
|
4
|
$self->throw(-class=>'Bio::Root::IOException', |
|
177
|
|
|
|
|
|
|
-text=>'This stream is read-only', |
|
178
|
|
|
|
|
|
|
-value=>""); |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 HIVAnnotProcessor-specific methods |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 hiv_query |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Title : hiv_query |
|
186
|
|
|
|
|
|
|
Usage : $obj->hiv_query($newval) |
|
187
|
|
|
|
|
|
|
Function: |
|
188
|
|
|
|
|
|
|
Example : |
|
189
|
|
|
|
|
|
|
Returns : value of hiv_query (a Bio::DB::Query::HIVQuery object) |
|
190
|
|
|
|
|
|
|
Args : on set, new value (an HIVQuery object, optional) |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub hiv_query{ |
|
195
|
2
|
|
|
2
|
1
|
1494
|
my $self = shift; |
|
196
|
2
|
100
|
|
|
|
6
|
if (@_) { |
|
197
|
1
|
50
|
33
|
|
|
18
|
$self->throw(-class=>'Bio::Root::BadParameter', |
|
198
|
|
|
|
|
|
|
-text=>'Requires a Bio::DB::Query::HIVQuery as argument', |
|
199
|
|
|
|
|
|
|
-value=>$_[0]) unless ref $_[0] && $_[0]->isa('Bio::DB::Query::HIVQuery'); |
|
200
|
|
|
|
|
|
|
} |
|
201
|
1
|
50
|
|
|
|
3
|
return $self->{'hiv_query'} = shift if @_; |
|
202
|
1
|
|
|
|
|
1
|
return $self->{'hiv_query'}; |
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
1; |
|
207
|
|
|
|
|
|
|
|