1
# $Id: HIVAnnotProcessor.pm 221 2008-12-11 13:05:24Z maj $
3
# BioPerl module for HIVAnnotProcessor
5
# Cared for by Mark A. Jensen <maj@fortinbras.us>
7
# Copyright Mark A. Jensen
9
# You may distribute this module under the same terms as perl itself
11
# POD documentation - main docs before the code
15
HIVAnnotProcessor - Adds HIV-specific annotations to Bio::SeqIO streams
19
sub get_Stream_by_query {
20
my ($self, $query ) = @_;
21
my $stream = $self->get_seq_stream('-query' => $query, '-mode'=>'query');
22
return new Bio::DB::HIV::HIVAnnotProcessor( -hiv_query=>$query,
23
-source_stream=>$stream );
29
Bio::DB::HIV::HIVAnnotProcessor is chained to the C<next_seq> of a sequence stream returned from a query to the Los Alamos HIV sequence database made using L<Bio::DB::HIV> and L<Bio::DB::Query::HIVQuery>. It adds the annotations obtained in the C<Bio::DB::Query::HIVQuery> to the Bio::Seq objects themselves via the C<$seq-E<gt>annotation> method.
35
User feedback is an integral part of the evolution of this and other
36
Bioperl modules. Send your comments and suggestions preferably to
37
the Bioperl mailing list. Your participation is much appreciated.
39
bioperl-l@bioperl.org - General discussion
40
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
44
Report bugs to the Bioperl bug tracking system to help us keep track
45
of the bugs and their resolution. Bug reports can be submitted via
48
http://bugzilla.open-bio.org/
50
=head1 AUTHOR - Mark A. Jensen
52
Email maj@fortinbras.us
58
The rest of the documentation details each of the object methods.
59
Internal methods are usually preceded with a _
63
# Let the code begin...
65
package Bio::DB::HIV::HIVAnnotProcessor;
68
# Object preamble - inherits from Bio::Root::Root
71
use base qw( Bio::Root::Root);
78
Usage : my $obj = new HIVAnnotProcessor();
79
Function: Builds a new HIVAnnotProcessor object
80
Returns : an instance of HIVAnnotProcessor
86
my($class,@args) = @_;
87
my $self = $class->SUPER::new(@args);
88
my ($hiv_query, $source_stream) =
89
$self->_rearrange([qw(HIV_QUERY SOURCE_STREAM)], @args);
92
$hiv_query && $self->hiv_query($hiv_query);
93
$source_stream && $self->source_stream($source_stream);
98
=head1 Bio::Factory::SequenceProcessorI compliance
102
Title : source_stream
103
Usage : $hap->source_stream($newval)
106
Returns : value of source_stream (a scalar)
107
Args : on set, new value (a scalar or undef, optional)
114
$self->throw(-class=>'Bio::Root::BadParameter',
115
-text=>'Requires a Bio::SeqIO as argument',
116
-value=>$_[0]) unless $_[0]->isa('Bio::SeqIO');
118
return $self->{'source_stream'} = shift if @_;
119
return $self->{'source_stream'};
125
Usage : $seqobj = stream->next_seq
126
Function: Reads the next sequence object from the stream,
127
: adds annotations from the HIVQuery object according
128
: to the sequence id, and returns sequence object
129
Returns : a Bio::Seq sequence object
136
my $q = $self->hiv_query;
137
my $seqo = $self->source_stream->next_seq;
138
return $seqo unless ($q && $seqo);
140
my $ac = $q->get_annotations_by_id($seqo->primary_id);
141
$seqo->annotation($ac) if $ac;
142
my $acc = $q->get_accessions_by_id($seqo->primary_id);
143
$seqo->accession_number($acc) if $acc;
151
Usage : $seqobj->write_seq
152
Function: for HIVAnnotProcessor, throw an exception
154
Returns : Bio::Root::IOException
160
my ($self,@args) = @_;
161
$self->throw(-class=>'Bio::Root::IOException',
162
-text=>'This stream is read-only',
166
=head1 HIVAnnotProcessor-specific methods
171
Usage : $obj->hiv_query($newval)
174
Returns : value of hiv_query (a Bio::DB::Query::HIVQuery object)
175
Args : on set, new value (an HIVQuery object, optional)
182
$self->throw(-class=>'Bio::Root::BadParameter',
183
-text=>'Requires a Bio::DB::Query::HIVQuery as argument',
184
-value=>$_[0]) unless ref $_[0] && $_[0]->isa('Bio::DB::Query::HIVQuery');
186
return $self->{'hiv_query'} = shift if @_;
187
return $self->{'hiv_query'};