2 # BioPerl module for Bio::Seq::MetaI
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Heikki Lehvaslaiho
8 # Copyright Heikki Lehvaslaiho
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Seq::MetaI - Interface for sequence objects with residue-based
21 # get a Bio::Seq::MetaI compliant object somehow
23 # to test this is a meta seq object
24 $obj->isa("Bio::Seq::MetaI")
25 || $obj->throw("$obj not a Bio::Seq::MetaI");
29 $string = $obj->meta_text;
30 $substring = $obj->submeta(12,50);
31 $unique_key = $obj->accession_number();
36 This class defines an abstract interface for basic residue-based meta
37 information. Examples of this kind of meta data are secondary
38 structures (RNA and protein), protein hydrophobicity assignments, or
39 other alternative alphabets for polypeptides, sequence quality data
40 and nucleotide alignments with translations.
42 The length of the meta data sequence is not dependent on the amount of
43 the meta information. The meta information always covers all the
44 residues, but a blank value is used to denote unavailable
45 information. If necessary the implementation quietly truncates or
46 extends meta information with blank values. Definition of blank is
47 implementation dependent. Gaps in MSAs should not have meta
50 At this point a residue in a sequence object can have only one meta
51 value. If you need more, use multiple copies of the sequence object.
53 Meta data storage can be implemented in various ways, e.g: string,
54 array of scalars, array of hashes, array of objects.
56 If the implementation so chooses, there can be more then one meta
57 values associated to each residue. See L<named_meta> and
58 L<names_submeta>. Note that use of arbitrary names is very prone to
59 typos leading to creation of additional copies of meta data sets.
61 Bio::Seq::Meta provides basic, pure perl implementation of sequences
62 with meta information. See L<Bio::Seq::Meta>. Application specific
63 implementations will override and add to these methods.
67 Character based meta data is read and set by method meta() and its
68 variants. These are the suffixes and prefixes used in the variants:
70 [named_] [sub] meta [_text]
76 Suffix B<_text> guaranties that output is a string. Note that it does
81 Prefix B<sub>, like in subseq(), means that the method applies to sub
82 region of the sequence range and takes start and end as arguments.
83 Unlike subseq(), these methods are able to set values. If the range
84 is not defined, it defaults to the complete sequence.
88 Prefix B<named_> in method names allows the used to attach multiple
89 meta strings to one sequence by explicitly naming them. The name is
90 always the first argument to the method. The "unnamed" methods use the
91 class wide default name for the meta data and are thus special cases
94 Note that internally names are keys in a hash and any misspelling of a
95 name will silently store the data under a wrong name. The used names
96 (keys) can be retrieved using method meta_names(). See L<meta_names>.
104 L<Bio::Seq::Meta::Array>,
105 L<Bio::Seq::EncodedSeq>,
106 L<Bio::Tools::OddCodes>,
114 User feedback is an integral part of the evolution of this and other
115 Bioperl modules. Send your comments and suggestions preferably to one
116 of the Bioperl mailing lists. Your participation is much appreciated.
118 bioperl-l@bioperl.org - General discussion
119 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
123 Please direct usage questions or support issues to the mailing list:
125 I<bioperl-l@bioperl.org>
127 rather than to the module maintainer directly. Many experienced and
128 reponsive experts will be able look at the problem and quickly
129 address it. Please include a thorough description of the problem
130 with code and data examples if at all possible.
132 =head2 Reporting Bugs
134 Report bugs to the Bioperl bug tracking system to help us keep track
135 the bugs and their resolution. Bug reports can be submitted via the
138 https://github.com/bioperl/bioperl-live/issues
140 =head1 AUTHOR - Heikki Lehvaslaiho
142 Email heikki-at-bioperl-dot-org
146 Chad Matsalla, bioinformatics@dieselwurks.com;
147 Aaron Mackey, amackey@virginia.edu;
148 Peter Schattner schattner@alum.mit.edu;
149 Richard Adams, Richard.Adams@ed.ac.uk
153 The rest of the documentation details each of the object methods.
154 Internal methods are usually preceded with a _
159 # Let the code begin...
162 package Bio
::Seq
::MetaI
;
165 use base
qw(Bio::Root::RootI);
170 Usage : $meta_values = $obj->meta($values_string);
173 Get and set method for the unnamed meta data starting from
174 residue position one. Since it is dependent on the length
175 of the sequence, it needs to be manipulated after the
178 The implementation may choose to accept argument values in
179 a string or in an array (reference) or in a hash
182 The return value may be a string or an array reference,
183 depending on the implentation. If in doubt, use meta_text()
184 which is a variant guarantied to return a string. See
187 The length of the returned value always matches the length
190 Returns : A reference to an array or a string
191 Args : new value, optional
195 sub meta
{ shift->throw_not_implemented }
200 Usage : $meta_values = $obj->meta_text($values_arrayref);
201 Function: Variant of meta() guarantied to return a textual
202 representation of the meta data. For details, see L<meta>.
204 Args : new value, optional
208 sub meta_text
{ shift->throw_not_implemented }
213 Usage : $meta_values = $obj->named_meta($name, $values_arrayref);
214 Function: A more general version of meta(). Each meta data set needs
215 to be named. See also L<meta_names>.
217 Args : scalar, name of the meta data set
222 sub named_meta
{ shift->throw_not_implemented }
224 =head2 named_meta_text
226 Title : named_meta_text()
227 Usage : $meta_values = $obj->named_meta_text($name, $values_arrayref);
228 Function: Variant of named_meta() guarantied to return a textual
229 representation of the named meta data.
230 For details, see L<meta>.
232 Args : scalar, name of the meta data set
237 sub named_meta_text
{ shift->throw_not_implemented }
242 Usage : $subset_of_meta_values = $obj->submeta(10, 20, $value_string);
243 $subset_of_meta_values = $obj->submeta(10, undef, $value_string);
246 Get and set method for meta data for subsequences.
248 Numbering starts from 1 and the number is inclusive, ie 1-2
249 are the first two residue of the sequence. Start cannot be
250 larger than end but can be equal.
252 If the second argument is missing the returned values
253 should extend to the end of the sequence.
255 If implementation tries to set values beyond the current
256 sequence, they should be ignored.
258 The return value may be a string or an array reference,
259 depending on the implentation. If in doubt, use
260 submeta_text() which is a variant guarantied to return a
261 string. See L<submeta_text>.
263 Returns : A reference to an array or a string
264 Args : integer, start position, optional
265 integer, end position, optional
270 sub submeta
{ shift->throw_not_implemented }
275 Usage : $meta_values = $obj->submeta_text(20, $value_string);
276 Function: Variant of submeta() guarantied to return a textual
277 representation of meta data. For details, see L<meta>.
279 Args : integer, start position, optional
280 integer, end position, optional
285 sub submeta_text
{ shift->throw_not_implemented }
289 Title : named_submeta
290 Usage : $subset_of_meta_values = $obj->named_submeta($name, 10, 20, $value_string);
291 $subset_of_meta_values = $obj->named_submeta($name, 10);
292 Function: Variant of submeta() guarantied to return a textual
293 representation of meta data. For details, see L<meta>.
294 Returns : A reference to an array or a string
295 Args : scalar, name of the meta data set
296 integer, start position
297 integer, end position, optional when a third argument present
302 sub named_submeta
{ shift->throw_not_implemented }
304 =head2 named_submeta_text
306 Title : named_submeta_text
307 Usage : $meta_values = $obj->named_submeta_text($name, 20, $value_string);
308 Function: Variant of submeta() guarantied to return a textual
309 representation of meta data. For details, see L<meta>.
311 Args : scalar, name of the meta data
312 Args : integer, start position, optional
313 integer, end position, optional
318 sub named_submeta_text
{ shift->throw_not_implemented }
323 Usage : @meta_names = $obj->meta_names()
324 Function: Retrives an array of meta data set names. The default (unnamed)
325 set name is guarantied to be the first name.
326 Returns : an array of names
331 sub meta_names
{ shift->throw_not_implemented }
336 Title : force_flush()
337 Usage : $force_flush = $obj->force_flush(1);
338 Function: Automatically pad with empty values or truncate meta values to
340 Returns : boolean 1 or 0
341 Args : optional boolean value
345 sub force_flush
{ shift->throw_not_implemented }
351 Usage : $is_flush = $obj->is_flush()
352 or $is_flush = $obj->is_flush($my_meta_name)
353 Function: Boolean to tell if all meta values are in
354 flush with the sequence length.
355 Returns true if force_flush() is set
356 Set verbosity to a positive value to see failed meta sets
357 Returns : boolean 1 or 0
358 Args : optional name of the meta set
362 sub is_flush
{ shift->throw_not_implemented }
367 Title : meta_length()
368 Usage : $meeta_len = $obj->meta_length();
369 Function: return the number of elements in the meta set
375 sub meta_length
{ shift->throw_not_implemented }
377 =head2 named_meta_length
379 Title : named_meta_length()
380 Usage : $meeta_len = $obj->named_meta_length($name);
381 Function: return the number of elements in the named meta set
387 sub named_meta_length
{ shift->throw_not_implemented }
390 =head1 Bio::PrimarySeqI methods
392 Implemeting classes will need to rewrite these Bio::PrimaryI methods.
399 Usage : $newseq = $seq->revcom();
400 Function: Produces a new Bio::Seq::MetaI implementing object where
401 the order of residues and their meta information is reversed.
402 Returns : A new (fresh) Bio::Seq::MetaI object
407 sub revcom
{ shift->throw_not_implemented }
412 Usage : $subseq = $myseq->trunc(10,100);
413 Function: Provides a truncation of a sequence
414 Returns : a fresh Bio::Seq::MetaI implementing object
415 Args : Two integers denoting first and last residue of the sub-sequence.
419 sub trunc
{ shift->throw_not_implemented }