File Coverage

Bio/DB/SeqI.pm
Criterion Covered Total %
statement 6 12 50.0
branch n/a
condition n/a
subroutine 2 5 40.0
pod 3 3 100.0
total 11 20 55.0


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::DB::SeqI.pm
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Ewan Birney
7             #
8             # Copyright Ewan Birney
9             #
10             # You may distribute this module under the same terms as perl itself
11             #
12              
13              
14             =head1 NAME
15              
16             Bio::DB::SeqI - Abstract Interface for Sequence databases
17              
18             =head1 SYNOPSIS
19              
20             # get a Bio::DB::SeqI somehow
21              
22             $seq = $seqdb->get_Seq_by_id('some-id');
23             $seq = $seqdb->get_Seq_by_acc('some-accession-number');
24              
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
29             }
30              
31             =head1 DESCRIPTION
32              
33             Abstract interface for a sequence database
34              
35             =head1 FEEDBACK
36              
37             =head2 Mailing Lists
38              
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.
42              
43             bioperl-l@bioperl.org - General discussion
44             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
45              
46             =head2 Support
47              
48             Please direct usage questions or support issues to the mailing list:
49              
50             I
51              
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.
56              
57             =head2 Reporting Bugs
58              
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:
62              
63             https://github.com/bioperl/bioperl-live/issues
64              
65             =head1 AUTHOR - Ewan Birney
66              
67             Email birney@ebi.ac.uk
68              
69             =head1 APPENDIX
70              
71             The rest of the documentation details each of the object methods. Internal
72             methods are usually preceded with a _
73              
74             =cut
75              
76              
77             package Bio::DB::SeqI;
78              
79 151     151   981 use strict;
  151         278  
  151         4211  
80              
81 151     151   663 use base qw(Bio::DB::RandomAccessI);
  151         252  
  151         38869  
82              
83             =head1 Methods inherited from Bio::DB::RandomAccessI
84              
85             =head2 get_Seq_by_id
86              
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
93              
94             =head2 get_Seq_by_acc
95              
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
102              
103             =head2 get_Seq_by_version
104              
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
111              
112             =head1 Methods [that were] specific for Bio::DB::SeqI
113              
114             =head2 get_PrimarySeq_stream
115              
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
122              
123             =cut
124              
125             sub get_PrimarySeq_stream{
126 0     0 1   my ($self,@args) = @_;
127 0           $self->throw("Object did not provide a PrimarySeq stream object");
128             }
129              
130              
131             =head2 get_all_primary_ids
132              
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
144              
145             =cut
146              
147             sub get_all_primary_ids{
148 0     0 1   my ($self,@args) = @_;
149 0           $self->throw("Object did not provide a get_all_ids method");
150             }
151              
152              
153             =head2 get_Seq_by_primary_id
154              
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.
161              
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
168              
169             =cut
170              
171             sub get_Seq_by_primary_id {
172 0     0 1   my ($self,@args) = @_;
173 0           $self->throw("Abstract database call of get_Seq_by_primary_id. Your database".
174             " has not implemented this method!");
175              
176             }
177              
178             1;
179              
180              
181