add latest changes to, um, Changes
[bioperl-live.git] / Bio / DB / SeqI.pm
blob0896c26611b9af822bca8e39a9b9763868d1bb72
2 # BioPerl module for Bio::DB::SeqI.pm
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Ewan Birney <birney@ebi.ac.uk>
8 # Copyright Ewan Birney
10 # You may distribute this module under the same terms as perl itself
14 =head1 NAME
16 Bio::DB::SeqI - Abstract Interface for Sequence databases
18 =head1 SYNOPSIS
20 # get a Bio::DB::SeqI somehow
22 $seq = $seqdb->get_Seq_by_id('some-id');
23 $seq = $seqdb->get_Seq_by_acc('some-accession-number');
25 @ids = $seqdb->get_all_ids();
26 $stream = $seqdb->get_PrimarySeq_stream();
27 while((my $seq = $stream->next_seq()) {
28 # $seq is a PrimarySeqI compliant object
31 =head1 DESCRIPTION
33 Abstract interface for a sequence database
35 =head1 FEEDBACK
37 =head2 Mailing Lists
39 User feedback is an integral part of the evolution of this and other
40 Bioperl modules. Send your comments and suggestions preferably to one
41 of the Bioperl mailing lists. Your participation is much appreciated.
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46 =head2 Support
48 Please direct usage questions or support issues to the mailing list:
50 I<bioperl-l@bioperl.org>
52 rather than to the module maintainer directly. Many experienced and
53 reponsive experts will be able look at the problem and quickly
54 address it. Please include a thorough description of the problem
55 with code and data examples if at all possible.
57 =head2 Reporting Bugs
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 the bugs and their resolution. Bug reports can be submitted via the
61 web:
63 https://github.com/bioperl/bioperl-live/issues
65 =head1 AUTHOR - Ewan Birney
67 Email birney@ebi.ac.uk
69 =head1 APPENDIX
71 The rest of the documentation details each of the object methods. Internal
72 methods are usually preceded with a _
74 =cut
77 package Bio::DB::SeqI;
79 use strict;
81 use base qw(Bio::DB::RandomAccessI);
83 =head1 Methods inherited from Bio::DB::RandomAccessI
85 =head2 get_Seq_by_id
87 Title : get_Seq_by_id
88 Usage : $seq = $db->get_Seq_by_id('ROA1_HUMAN')
89 Function: Gets a Bio::Seq object by its name
90 Returns : a Bio::Seq object
91 Args : the id (as a string) of a sequence
92 Throws : "id does not exist" exception
94 =head2 get_Seq_by_acc
96 Title : get_Seq_by_acc
97 Usage : $seq = $db->get_Seq_by_acc('X77802');
98 Function: Gets a Bio::Seq object by accession number
99 Returns : A Bio::Seq object
100 Args : accession number (as a string)
101 Throws : "acc does not exist" exception
103 =head2 get_Seq_by_version
105 Title : get_Seq_by_version
106 Usage : $seq = $db->get_Seq_by_version('X77802.1');
107 Function: Gets a Bio::Seq object by sequence version
108 Returns : A Bio::Seq object
109 Args : accession.version (as a string)
110 Throws : "acc.version does not exist" exception
112 =head1 Methods [that were] specific for Bio::DB::SeqI
114 =head2 get_PrimarySeq_stream
116 Title : get_PrimarySeq_stream
117 Usage : $stream = get_PrimarySeq_stream
118 Function: Makes a Bio::SeqIO compliant object
119 which provides a single method, next_seq
120 Returns : Bio::SeqIO
121 Args : none
123 =cut
125 sub get_PrimarySeq_stream{
126 my ($self,@args) = @_;
127 $self->throw("Object did not provide a PrimarySeq stream object");
131 =head2 get_all_primary_ids
133 Title : get_all_ids
134 Usage : @ids = $seqdb->get_all_primary_ids()
135 Function: gives an array of all the primary_ids of the
136 sequence objects in the database. These
137 may be ids (display style) or accession numbers
138 or something else completely different - they
139 *are not* meaningful outside of this database
140 implementation.
141 Example :
142 Returns : an array of strings
143 Args : none
145 =cut
147 sub get_all_primary_ids{
148 my ($self,@args) = @_;
149 $self->throw("Object did not provide a get_all_ids method");
153 =head2 get_Seq_by_primary_id
155 Title : get_Seq_by_primary_id
156 Usage : $seq = $db->get_Seq_by_primary_id($primary_id_string);
157 Function: Gets a Bio::Seq object by the primary id. The primary
158 id in these cases has to come from $db->get_all_primary_ids.
159 There is no other way to get (or guess) the primary_ids
160 in a database.
162 The other possibility is to get Bio::PrimarySeqI objects
163 via the get_PrimarySeq_stream and the primary_id field
164 on these objects are specified as the ids to use here.
165 Returns : A Bio::Seq object
166 Args : accession number (as a string)
167 Throws : "acc does not exist" exception
169 =cut
171 sub get_Seq_by_primary_id {
172 my ($self,@args) = @_;
173 $self->throw("Abstract database call of get_Seq_by_primary_id. Your database".
174 " has not implemented this method!");