merge upstream
[bioperl-live.git] / Bio / LiveSeq / ChainI.pm
blob8eea51c028476d17df882cc5bbdd97eec80a5488
2 # bioperl module for Bio::LiveSeq::ChainI
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Joseph Insana <insana@ebi.ac.uk> <jinsana@gmx.net>
8 # Copyright Joseph Insana
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::LiveSeq::ChainI - Double linked chain data structure
18 =head1 SYNOPSIS
20 #documentation needed
22 =head1 DESCRIPTION
24 This class generates and manipulates generic double linked list, chain,
25 that can be used to manage biological sequences.
27 The advantages over strings or plain arrays is the ease of tracking
28 changes (mutations) in the elements (sequence). The other side of the
29 coin is that these structures need consideraly more memory, but that
30 is cheap and constantly inceasing resource in computers.
32 =head1 FEEDBACK
34 =head2 Mailing Lists
36 User feedback is an integral part of the evolution of this and other
37 Bioperl modules. Send your comments and suggestions preferably to one
38 of the Bioperl mailing lists. Your participation is much appreciated.
40 bioperl-l@bioperl.org - General discussion
41 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
43 =head2 Support
45 Please direct usage questions or support issues to the mailing list:
47 I<bioperl-l@bioperl.org>
49 rather than to the module maintainer directly. Many experienced and
50 reponsive experts will be able look at the problem and quickly
51 address it. Please include a thorough description of the problem
52 with code and data examples if at all possible.
54 =head2 Reporting Bugs
56 Report bugs to the Bioperl bug tracking system to help us keep track
57 the bugs and their resolution. Bug reports can be submitted via the
58 web:
60 https://github.com/bioperl/bioperl-live/issues
62 =head1 AUTHOR - Joseph A.L. Insana
64 Email: Insana@ebi.ac.uk, jinsana@gmx.net
66 =head1 APPENDIX
68 The rest of the documentation details each of the object
69 methods. Internal methods are usually preceded with a _
71 =cut
73 # Let the code begin...
75 package Bio::LiveSeq::ChainI;
77 use Carp qw(croak);
78 use strict; # this will be moved before when strict enforced in Chain.pm
80 use Bio::LiveSeq::Chain; # package where all the subroutines are defined
83 =head2 new
85 Title : new
86 Usage : $chain = Bio::LiveSeq::ChainI->new(-string => "thequickbrownfoxjumpsoverthelazydog",
87 -offset => 3 );
88 OR $chain = Bio::LiveSeq::ChainI->new(-array => \@array,
89 -offset => 3 );
90 Function: generates a new Bio::LiveSeq:ChainI
91 Returns : a new Chain
92 Args : string
93 OR arrayreference
94 AND optional offset to create element labels
96 =cut
98 sub new {
99 my ($thing, %args) = @_;
100 my $class = ref($thing) || $thing;
101 my $obj;
103 if ($args{-string}) {
104 $obj = $thing->string2chain($args{-string}, $args{-offset});
105 } elsif ($args{-array}) {
106 $obj = $thing->array2chain($args{-array}, $args{-offset});
107 } else {
108 croak "$class not initialized properly";
111 $obj = bless $obj, $class;
112 return $obj;
115 # added as of 1.9
116 sub string2chain {
117 shift @_; # so that it doesn't pass the object reference
118 return Bio::LiveSeq::Chain::string2chain(@_);
120 sub array2chain {
121 shift @_; # so that it doesn't pass the object reference
122 return Bio::LiveSeq::Chain::array2chain(@_);
125 sub chain2string {
126 croak "ambiguous method call. Explicit down_ or up_";
128 sub down_chain2string {
129 return Bio::LiveSeq::Chain::down_chain2string(@_);
131 sub up_chain2string {
132 return Bio::LiveSeq::Chain::up_chain2string(@_);
134 sub chain2string_verbose {
135 croak "ambiguous method call. Explicit down_ or up_";
137 sub down_chain2string_verbose {
138 return Bio::LiveSeq::Chain::down_chain2string_verbose(@_);
140 sub up_chain2string_verbose {
141 return Bio::LiveSeq::Chain::up_chain2string_verbose(@_);
143 sub invert_chain {
144 return Bio::LiveSeq::Chain::invert_chain(@_);
146 sub mutate_element {
147 croak "Old method name, please update code to: set_value_at_label";
150 # new as of version 2.33 of Chain.pm
151 sub down_labels {
152 return Bio::LiveSeq::Chain::down_labels(@_);
154 sub up_labels {
155 return Bio::LiveSeq::Chain::up_labels(@_);
158 sub start {
159 return Bio::LiveSeq::Chain::start(@_);
161 sub end {
162 return Bio::LiveSeq::Chain::end(@_);
164 sub label_exists {
165 return Bio::LiveSeq::Chain::label_exists(@_);
168 sub get_value_at_pos {
169 croak "ambiguous method call. Explicit down_ or up_";
171 sub down_get_value_at_pos {
172 return Bio::LiveSeq::Chain::down_get_value_at_pos(@_);
174 sub up_get_value_at_pos {
175 return Bio::LiveSeq::Chain::up_get_value_at_pos(@_);
177 sub set_value_at_pos {
178 croak "ambiguous method call. Explicit down_ or up_";
180 sub down_set_value_at_pos {
181 return Bio::LiveSeq::Chain::down_set_value_at_pos(@_);
183 sub up_set_value_at_pos {
184 return Bio::LiveSeq::Chain::up_set_value_at_pos(@_);
186 sub get_value_at_label {
187 return Bio::LiveSeq::Chain::get_value_at_label(@_);
189 sub set_value_at_label {
190 return Bio::LiveSeq::Chain::set_value_at_label(@_);
192 sub get_label_at_pos {
193 croak "ambiguous method call. Explicit down_ or up_";
195 sub up_get_label_at_pos {
196 return Bio::LiveSeq::Chain::up_get_label_at_pos(@_);
198 sub down_get_label_at_pos {
199 return Bio::LiveSeq::Chain::down_get_label_at_pos(@_);
201 sub get_pos_of_label {
202 croak "ambiguous method call. Explicit down_ or up_";
204 sub up_get_pos_of_label {
205 return Bio::LiveSeq::Chain::up_get_pos_of_label(@_);
207 sub down_get_pos_of_label {
208 return Bio::LiveSeq::Chain::down_get_pos_of_label(@_);
212 sub preinsert_string {
213 return Bio::LiveSeq::Chain::praeinsert_string(@_);
215 sub preinsert_array {
216 return Bio::LiveSeq::Chain::praeinsert_array(@_);
218 sub praeinsert_string {
219 return Bio::LiveSeq::Chain::praeinsert_string(@_);
221 sub postinsert_string {
222 return Bio::LiveSeq::Chain::postinsert_string(@_);
224 sub praeinsert_array {
225 return Bio::LiveSeq::Chain::praeinsert_array(@_);
227 sub postinsert_array {
228 return Bio::LiveSeq::Chain::postinsert_array(@_);
230 sub down_element{
231 return Bio::LiveSeq::Chain::down_element(@_);
233 sub up_element {
234 return Bio::LiveSeq::Chain::up_element(@_);
236 sub is_downstream {
237 return Bio::LiveSeq::Chain::is_downstream(@_);
239 sub is_upstream {
240 return Bio::LiveSeq::Chain::is_upstream(@_);
242 sub check_chain {
243 return Bio::LiveSeq::Chain::check_chain(@_);
245 sub chain_length {
246 return Bio::LiveSeq::Chain::chain_length(@_);
248 sub splice_chain {
249 return Bio::LiveSeq::Chain::splice_chain(@_);
251 sub pos_of_element {
252 croak "ambiguous and old method name. use: down_pos_of_label";
254 sub up_pos_of_element {
255 croak "old method name. use: down_pos_of_label";
256 return Bio::LiveSeq::Chain::up_pos_of_element(@_);
258 sub down_pos_of_element {
259 croak "old method name. use: up_pos_of_label";
260 return Bio::LiveSeq::Chain::down_pos_of_element(@_);
262 sub subchain_length {
263 croak "ambiguous method call. Explicit down_ or up_";
265 sub down_subchain_length {
266 return Bio::LiveSeq::Chain::down_subchain_length(@_);
268 sub up_subchain_length {
269 return Bio::LiveSeq::Chain::up_subchain_length(@_);
272 # these have to be deleted and changed names to conform to terminology
273 sub elements {
274 return Bio::LiveSeq::Chain::down_elements(@_);
276 sub up_elements {
277 return Bio::LiveSeq::Chain::up_elements(@_);
279 sub down_elements {
280 return Bio::LiveSeq::Chain::down_elements(@_);