comparison variant_effect_predictor/Bio/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 # $Id: SeqI.pm,v 1.25 2002/12/05 13:46:30 heikki Exp $
2 #
3 # BioPerl module for Bio::SeqI
4 #
5 # Cared for by Ewan Birney <birney@ebi.ac.uk>
6 #
7 # Copyright Ewan Birney
8 #
9 # You may distribute this module under the same terms as perl itself
10
11 # POD documentation - main docs before the code
12
13 =head1 NAME
14
15 Bio::SeqI [Developers] - Abstract Interface of Sequence (with features)
16
17 =head1 SYNOPSIS
18
19 # Bio::SeqI is the interface class for sequences.
20
21 # If you are a newcomer to bioperl, you should
22 # start with Bio::Seq documentation. This
23 # documentation is mainly for developers using
24 # Bioperl.
25
26 # Bio::SeqI implements Bio::PrimarySeqI
27 $seq = $seqobj->seq(); # actual sequence as a string
28 $seqstr = $seqobj->subseq(10,50);
29
30 # Bio::SeqI has annotationcollections
31
32 $ann = $seqobj->annotation(); # annotation object
33
34 # Bio::SeqI has sequence features
35 # features must implement Bio::SeqFeatureI
36
37 @features = $seqobj->get_SeqFeatures(); # just top level
38 @features = $seqobj->get_all_SeqFeatures(); # descend into sub features
39
40
41
42 =head1 DESCRIPTION
43
44 Bio::SeqI is the abstract interface of annotated Sequences. These
45 methods are those which you can be guarenteed to get for any Bio::SeqI
46 - for most users of the package the documentation (and methods) in
47 this class are not at useful - this is a developers only class which
48 defines what methods have to be implmented by other Perl objects to
49 comply to the Bio::SeqI interface. Go "perldoc Bio::Seq" or "man
50 Bio::Seq" for more information.
51
52
53 There aren't many here, because too many complicated functions here
54 prevent implementations which are just wrappers around a database or
55 similar delayed mechanisms.
56
57 Most of the clever stuff happens inside the SeqFeatureI system.
58
59 A good reference implementation is Bio::Seq which is a pure perl
60 implementation of this class with alot of extra pieces for extra
61 manipulation. However, if you want to be able to use any sequence
62 object in your analysis, if you can do it just using these methods,
63 then you know you will be future proof and compatible with other
64 implementations of Seq.
65
66 =head1 FEEDBACK
67
68 =head2 Mailing Lists
69
70 User feedback is an integral part of the evolution of this and other
71 Bioperl modules. Send your comments and suggestions preferably to one
72 of the Bioperl mailing lists. Your participation is much appreciated.
73
74 bioperl-l@bioperl.org - General discussion
75 http://bio.perl.org/MailList.html - About the mailing lists
76
77 =head2 Reporting Bugs
78
79 Report bugs to the Bioperl bug tracking system to help us keep track
80 the bugs and their resolution. Bug reports can be submitted via email
81 or the web:
82
83 bioperl-bugs@bio.perl.org
84 http://bugzilla.bioperl.org/
85
86 =head1 AUTHOR - Ewan Birney
87
88 Email birney@sanger.ac.uk
89
90
91 =head1 APPENDIX
92
93 The rest of the documentation details each of the object
94 methods. Internal methods are usually preceded with a _
95
96 =cut
97
98 #'
99 # Let the code begin...
100
101
102 package Bio::SeqI;
103 use strict;
104
105 use vars qw(@ISA);
106 use Bio::PrimarySeqI;
107 use Bio::AnnotatableI;
108 use Bio::FeatureHolderI;
109
110 # Object preamble - inheriets from Bio::PrimarySeqI
111
112 @ISA = qw(Bio::PrimarySeqI Bio::AnnotatableI Bio::FeatureHolderI);
113
114 =head2 get_SeqFeatures
115
116 Title : get_SeqFeatures
117 Usage : my @feats = $seq->get_SeqFeatures();
118 Function: retrieve just the toplevel sequence features attached to this seq
119 Returns : array of Bio::SeqFeatureI objects
120 Args : none
121
122 This method comes through extension of Bio::FeatureHolderI. See
123 L<Bio::FeatureHolderI> and L<Bio::SeqFeatureI> for more information.
124
125 =cut
126
127 =head2 get_all_SeqFeatures
128
129 Title : get_all_SeqFeatures
130 Usage : @features = $annseq->get_all_SeqFeatures()
131 Function: returns all SeqFeatures, included sub SeqFeatures
132 Returns : an array of Bio::SeqFeatureI objects
133 Args : none
134
135 This method comes through extension of Bio::FeatureHolderI. See
136 L<Bio::FeatureHolderI> and L<Bio::SeqFeatureI> for more information.
137
138 =cut
139
140 =head2 feature_count
141
142 Title : feature_count
143 Usage : $seq->feature_count()
144 Function: Return the number of SeqFeatures attached to a sequence
145 Returns : integer representing the number of SeqFeatures
146 Args : none
147
148 This method comes through extension of Bio::FeatureHolderI. See
149 L<Bio::FeatureHolderI> for more information.
150
151 =cut
152
153 =head2 seq
154
155 Title : seq
156 Usage : my $string = $seq->seq();
157 Function: Retrieves the sequence string for the sequence object
158 Returns : string
159 Args : none
160
161
162 =cut
163
164 sub seq{
165 my ($self) = @_;
166 $self->throw_not_implemented();
167 }
168
169 =head2 write_GFF
170
171 Title : write_GFF
172 Usage : $seq->write_GFF(\*FILEHANDLE);
173 Function: Convience method to write out all the sequence features
174 in GFF format to the provided filehandle (STDOUT by default)
175 Returns : none
176 Args : [optional] filehandle to write to (default is STDOUT)
177
178
179 =cut
180
181 sub write_GFF{
182 my ($self,$fh) = @_;
183
184 $fh || do { $fh = \*STDOUT; };
185
186 foreach my $sf ( $self->get_all_SeqFeatures() ) {
187 print $fh $sf->gff_string, "\n";
188 }
189
190 }
191
192 =head2 annotation
193
194 Title : annotation
195 Usage : $obj->annotation($seq_obj)
196 Function: retrieve the attached annotation object
197 Returns : Bio::AnnotationCollectionI or none;
198
199 See L<Bio::AnnotationCollectionI> and L<Bio::Annotation::Collection>
200 for more information. This method comes through extension from
201 L<Bio::AnnotatableI>.
202
203 =cut
204
205 =head2 species
206
207 Title : species
208 Usage :
209 Function: Gets or sets the species
210 Example : $species = $self->species();
211 Returns : Bio::Species object
212 Args : Bio::Species object or none;
213
214 See L<Bio::Species> for more information
215
216 =cut
217
218 sub species {
219 my ($self) = @_;
220 $self->throw_not_implemented();
221 }
222
223 =head2 primary_seq
224
225 Title : primary_seq
226 Usage : $obj->primary_seq($newval)
227 Function: Retrieve the underlying Bio::PrimarySeqI object if available.
228 This is in the event one has a sequence with lots of features
229 but want to be able to narrow the object to just one with
230 the basics of a sequence (no features or annotations).
231 Returns : Bio::PrimarySeqI
232 Args : Bio::PrimarySeqI or none;
233
234 See L<Bio::PrimarySeqI> for more information
235
236 =cut
237
238 sub primary_seq {
239 my ($self) = @_;
240 $self->throw_not_implemented;
241 }
242
243 1;