Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/DB/SeqI.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 | |
2 # | |
3 # $Id: SeqI.pm,v 1.7 2002/10/22 07:38:29 lapp Exp $ | |
4 # | |
5 # BioPerl module for Bio::DB::SeqI.pm | |
6 # | |
7 # Cared for by Ewan Birney <birney@ebi.ac.uk> | |
8 # | |
9 # Copyright Ewan Birney | |
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 Bio::DB::SeqI - Abstract Interface for Sequence databases | |
18 | |
19 =head1 SYNOPSIS | |
20 | |
21 # get a Bio::DB::SeqI somehow | |
22 | |
23 $seq = $seqdb->get_Seq_by_id('some-id'); | |
24 $seq = $seqdb->get_Seq_by_acc('some-accession-number'); | |
25 | |
26 @ids = $seqdb->get_all_ids(); | |
27 $stream = $seqdb->get_PrimarySeq_stream(); | |
28 while((my $seq = $stream->next_seq()) { | |
29 # $seq is a PrimarySeqI compliant object | |
30 } | |
31 | |
32 | |
33 =head1 DESCRIPTION | |
34 | |
35 Abstract interface for a sequence database | |
36 | |
37 =head1 FEEDBACK | |
38 | |
39 =head2 Mailing Lists | |
40 | |
41 User feedback is an integral part of the evolution of this and other | |
42 Bioperl modules. Send your comments and suggestions preferably to one | |
43 of the Bioperl mailing lists. Your participation is much appreciated. | |
44 | |
45 bioperl-l@bioperl.org - General discussion | |
46 http://bioperl.org/MailList.shtml - About the mailing lists | |
47 | |
48 =head2 Reporting Bugs | |
49 | |
50 Report bugs to the Bioperl bug tracking system to help us keep track | |
51 the bugs and their resolution. | |
52 Bug reports can be submitted via email or the web: | |
53 | |
54 bioperl-bugs@bio.perl.org | |
55 http://bugzilla.bioperl.org/ | |
56 | |
57 =head1 AUTHOR - Ewan Birney | |
58 | |
59 Email birney@ebi.ac.uk | |
60 | |
61 Describe contact details here | |
62 | |
63 =head1 APPENDIX | |
64 | |
65 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ | |
66 | |
67 =cut | |
68 | |
69 | |
70 # Let the code begin... | |
71 | |
72 | |
73 package Bio::DB::SeqI; | |
74 use vars qw(@ISA); | |
75 use strict; | |
76 | |
77 # Object preamble - inherits from Bio::Root::Object | |
78 | |
79 use Bio::DB::RandomAccessI; | |
80 @ISA = qw(Bio::DB::RandomAccessI); | |
81 | |
82 =head1 Methods inherieted from Bio::DB::RandomAccessI | |
83 | |
84 =head2 get_Seq_by_id | |
85 | |
86 Title : get_Seq_by_id | |
87 Usage : $seq = $db->get_Seq_by_id('ROA1_HUMAN') | |
88 Function: Gets a Bio::Seq object by its name | |
89 Returns : a Bio::Seq object | |
90 Args : the id (as a string) of a sequence | |
91 Throws : "id does not exist" exception | |
92 | |
93 | |
94 =cut | |
95 | |
96 =head2 get_Seq_by_acc | |
97 | |
98 Title : get_Seq_by_acc | |
99 Usage : $seq = $db->get_Seq_by_acc('X77802'); | |
100 Function: Gets a Bio::Seq object by accession number | |
101 Returns : A Bio::Seq object | |
102 Args : accession number (as a string) | |
103 Throws : "acc does not exist" exception | |
104 | |
105 | |
106 =cut | |
107 | |
108 =head1 Methods [that were] specific for Bio::DB::SeqI | |
109 | |
110 =head2 get_PrimarySeq_stream | |
111 | |
112 Title : get_PrimarySeq_stream | |
113 Usage : $stream = get_PrimarySeq_stream | |
114 Function: Makes a Bio::SeqIO compliant object | |
115 which provides a single method, next_seq | |
116 Returns : Bio::SeqIO | |
117 Args : none | |
118 | |
119 =cut | |
120 | |
121 sub get_PrimarySeq_stream{ | |
122 my ($self,@args) = @_; | |
123 | |
124 $self->throw("Object did not provide a PrimarySeq stream object"); | |
125 } | |
126 | |
127 =head2 get_all_primary_ids | |
128 | |
129 Title : get_all_ids | |
130 Usage : @ids = $seqdb->get_all_primary_ids() | |
131 Function: gives an array of all the primary_ids of the | |
132 sequence objects in the database. These | |
133 maybe ids (display style) or accession numbers | |
134 or something else completely different - they | |
135 *are not* meaningful outside of this database | |
136 implementation. | |
137 Example : | |
138 Returns : an array of strings | |
139 Args : none | |
140 | |
141 | |
142 =cut | |
143 | |
144 sub get_all_primary_ids{ | |
145 my ($self,@args) = @_; | |
146 $self->throw("Object did not provide a get_all_ids method"); | |
147 } | |
148 | |
149 | |
150 =head2 get_Seq_by_primary_id | |
151 | |
152 Title : get_Seq_by_primary_id | |
153 Usage : $seq = $db->get_Seq_by_primary_id($primary_id_string); | |
154 Function: Gets a Bio::Seq object by the primary id. The primary | |
155 id in these cases has to come from $db->get_all_primary_ids. | |
156 There is no other way to get (or guess) the primary_ids | |
157 in a database. | |
158 | |
159 The other possibility is to get Bio::PrimarySeqI objects | |
160 via the get_PrimarySeq_stream and the primary_id field | |
161 on these objects are specified as the ids to use here. | |
162 Returns : A Bio::Seq object | |
163 Args : accession number (as a string) | |
164 Throws : "acc does not exist" exception | |
165 | |
166 | |
167 =cut | |
168 | |
169 sub get_Seq_by_primary_id { | |
170 my ($self,@args) = @_; | |
171 | |
172 $self->throw("Abstract database call of get_Seq_by_primary_id. Your database has not implemented this method!"); | |
173 | |
174 } | |
175 | |
176 1; | |
177 | |
178 | |
179 |