3 # BioPerl module for Bio::Seq::MetaI
5 # Cared for by Heikki Lehvaslaiho
7 # Copyright Heikki Lehvaslaiho
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Seq::MetaI - Interface for sequence objects with residue-based
20 # get a Bio::Seq::MetaI compliant object somehow
22 # to test this is a meta seq object
23 $obj->isa("Bio::Seq::MetaI")
24 || $obj->throw("$obj not a Bio::Seq::MetaI");
28 $string = $obj->meta_text;
29 $substring = $obj->submeta(12,50);
30 $unique_key = $obj->accession_number();
35 This class defines an abstract interface for basic residue-based meta
36 information. Examples of this kind of meta data are secondary
37 structures (RNA and protein), protein hydrophobicity assignments, or
38 other alternative alphabets for polypeptides, sequence quality data
39 and nucleotide alignments with translations.
41 The length of the meta data sequence is not dependent on the amount of
42 the meta information. The meta information always covers all the
43 residues, but a blank value is used to denote unavailable
44 information. If necessary the implementation quietly truncates or
45 extends meta information with blank values. Definition of blank is
46 implementation dependent. Gaps in MSAs should not have meta
49 At this point a residue in a sequence object can have only one meta
50 value. If you need more, use multiple copies of the sequence object.
52 Meta data storage can be implemented in various ways, e.g: string,
53 array of scalars, array of hashes, array of objects.
55 If the implementation so chooses, there can be more then one meta
56 values associated to each residue. See L<named_meta> and
57 L<names_submeta>. Note that use of arbitrary names is very prone to
58 typos leading to creation of additional copies of meta data sets.
60 Bio::Seq::Meta provides basic, pure perl implementation of sequences
61 with meta information. See L<Bio::Seq::Meta>. Application specific
62 implementations will override and add to these methods.
66 Character based meta data is read and set by method meta() and its
67 variants. These are the suffixes and prefixes used in the variants:
69 [named_] [sub] meta [_text]
75 Suffix B<_text> guaranties that output is a string. Note that it does
80 Prefix B<sub>, like in subseq(), means that the method applies to sub
81 region of the sequence range and takes start and end as arguments.
82 Unlike subseq(), these methods are able to set values. If the range
83 is not defined, it defaults to the complete sequence.
87 Prefix B<named_> in method names allows the used to attach multiple
88 meta strings to one sequence by explicitly naming them. The name is
89 always the first argument to the method. The "unnamed" methods use the
90 class wide default name for the meta data and are thus special cases
93 Note that internally names are keys in a hash and any misspelling of a
94 name will silently store the data under a wrong name. The used names
95 (keys) can be retrieved using method meta_names(). See L<meta_names>.
103 L<Bio::Seq::Meta::Array>,
104 L<Bio::Seq::EncodedSeq>,
105 L<Bio::Tools::OddCodes>,
113 User feedback is an integral part of the evolution of this and other
114 Bioperl modules. Send your comments and suggestions preferably to one
115 of the Bioperl mailing lists. Your participation is much appreciated.
117 bioperl-l@bioperl.org - General discussion
118 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
120 =head2 Reporting Bugs
122 Report bugs to the Bioperl bug tracking system to help us keep track
123 the bugs and their resolution. Bug reports can be submitted via the
126 http://bugzilla.open-bio.org/
128 =head1 AUTHOR - Heikki Lehvaslaiho
130 Email heikki-at-bioperl-dot-org
134 Chad Matsalla, bioinformatics@dieselwurks.com;
135 Aaron Mackey, amackey@virginia.edu;
136 Peter Schattner schattner@alum.mit.edu;
137 Richard Adams, Richard.Adams@ed.ac.uk
141 The rest of the documentation details each of the object methods.
142 Internal methods are usually preceded with a _
147 # Let the code begin...
150 package Bio
::Seq
::MetaI
;
153 use base
qw(Bio::Root::RootI);
158 Usage : $meta_values = $obj->meta($values_string);
161 Get and set method for the unnamed meta data starting from
162 residue position one. Since it is dependent on the length
163 of the sequence, it needs to be manipulated after the
166 The implementation may choose to accept argument values in
167 a string or in an array (reference) or in a hash
170 The return value may be a string or an array reference,
171 depending on the implentation. If in doubt, use meta_text()
172 which is a variant guarantied to return a string. See
175 The length of the returned value always matches the length
178 Returns : A reference to an array or a string
179 Args : new value, optional
183 sub meta
{ shift->throw_not_implemented }
188 Usage : $meta_values = $obj->meta_text($values_arrayref);
189 Function: Variant of meta() guarantied to return a textual
190 representation of the meta data. For details, see L<meta>.
192 Args : new value, optional
196 sub meta_text
{ shift->throw_not_implemented }
201 Usage : $meta_values = $obj->named_meta($name, $values_arrayref);
202 Function: A more general version of meta(). Each meta data set needs
203 to be named. See also L<meta_names>.
205 Args : scalar, name of the meta data set
210 sub named_meta
{ shift->throw_not_implemented }
212 =head2 named_meta_text
214 Title : named_meta_text()
215 Usage : $meta_values = $obj->named_meta_text($name, $values_arrayref);
216 Function: Variant of named_meta() guarantied to return a textual
217 representation of the named meta data.
218 For details, see L<meta>.
220 Args : scalar, name of the meta data set
225 sub named_meta_text
{ shift->throw_not_implemented }
230 Usage : $subset_of_meta_values = $obj->submeta(10, 20, $value_string);
231 $subset_of_meta_values = $obj->submeta(10, undef, $value_string);
234 Get and set method for meta data for subsequences.
236 Numbering starts from 1 and the number is inclusive, ie 1-2
237 are the first two residue of the sequence. Start cannot be
238 larger than end but can be equal.
240 If the second argument is missing the returned values
241 should extend to the end of the sequence.
243 If implementation tries to set values beyond the current
244 sequence, they should be ignored.
246 The return value may be a string or an array reference,
247 depending on the implentation. If in doubt, use
248 submeta_text() which is a variant guarantied to return a
249 string. See L<submeta_text>.
251 Returns : A reference to an array or a string
252 Args : integer, start position, optional
253 integer, end position, optional
258 sub submeta
{ shift->throw_not_implemented }
263 Usage : $meta_values = $obj->submeta_text(20, $value_string);
264 Function: Variant of submeta() guarantied to return a textual
265 representation of meta data. For details, see L<meta>.
267 Args : integer, start position, optional
268 integer, end position, optional
273 sub submeta_text
{ shift->throw_not_implemented }
277 Title : named_submeta
278 Usage : $subset_of_meta_values = $obj->named_submeta($name, 10, 20, $value_string);
279 $subset_of_meta_values = $obj->named_submeta($name, 10);
280 Function: Variant of submeta() guarantied to return a textual
281 representation of meta data. For details, see L<meta>.
282 Returns : A reference to an array or a string
283 Args : scalar, name of the meta data set
284 integer, start position
285 integer, end position, optional when a third argument present
290 sub named_submeta
{ shift->throw_not_implemented }
292 =head2 named_submeta_text
294 Title : named_submeta_text
295 Usage : $meta_values = $obj->named_submeta_text($name, 20, $value_string);
296 Function: Variant of submeta() guarantied to return a textual
297 representation of meta data. For details, see L<meta>.
299 Args : scalar, name of the meta data
300 Args : integer, start position, optional
301 integer, end position, optional
306 sub named_submeta_text
{ shift->throw_not_implemented }
311 Usage : @meta_names = $obj->meta_names()
312 Function: Retrives an array of meta data set names. The default (unnamed)
313 set name is guarantied to be the first name.
314 Returns : an array of names
319 sub meta_names
{ shift->throw_not_implemented }
324 Title : force_flush()
325 Usage : $force_flush = $obj->force_flush(1);
326 Function: Automatically pad with empty values or truncate meta values to
328 Returns : boolean 1 or 0
329 Args : optional boolean value
333 sub force_flush
{ shift->throw_not_implemented }
339 Usage : $is_flush = $obj->is_flush()
340 or $is_flush = $obj->is_flush($my_meta_name)
341 Function: Boolean to tell if all meta values are in
342 flush with the sequence length.
343 Returns true if force_flush() is set
344 Set verbosity to a positive value to see failed meta sets
345 Returns : boolean 1 or 0
346 Args : optional name of the meta set
350 sub is_flush
{ shift->throw_not_implemented }
355 Title : meta_length()
356 Usage : $meeta_len = $obj->meta_length();
357 Function: return the number of elements in the meta set
363 sub meta_length
{ shift->throw_not_implemented }
365 =head2 named_meta_length
367 Title : named_meta_length()
368 Usage : $meeta_len = $obj->named_meta_length($name);
369 Function: return the number of elements in the named meta set
375 sub named_meta_length
{ shift->throw_not_implemented }
378 =head1 Bio::PrimarySeqI methods
380 Implemeting classes will need to rewrite these Bio::PrimaryI methods.
387 Usage : $newseq = $seq->revcom();
388 Function: Produces a new Bio::Seq::MetaI implementing object where
389 the order of residues and their meta information is reversed.
390 Returns : A new (fresh) Bio::Seq::MetaI object
395 sub revcom
{ shift->throw_not_implemented }
400 Usage : $subseq = $myseq->trunc(10,100);
401 Function: Provides a truncation of a sequence
402 Returns : a fresh Bio::Seq::MetaI implementing object
403 Args : Two integers denoting first and last residue of the sub-sequence.
407 sub trunc
{ shift->throw_not_implemented }