0
|
1 # $Id: ChainI.pm,v 1.9 2002/10/22 07:38:34 lapp Exp $
|
|
2 #
|
|
3 # bioperl module for Bio::LiveSeq::ChainI
|
|
4 #
|
|
5 # Cared for by Joseph Insana <insana@ebi.ac.uk> <jinsana@gmx.net>
|
|
6 #
|
|
7 # Copyright Joseph Insana
|
|
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::LiveSeq::ChainI - Double linked chain data structure
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 #documentation needed
|
|
20
|
|
21 =head1 DESCRIPTION
|
|
22
|
|
23 This class generates and manipulates generic double linked list, chain,
|
|
24 that can be used to manage biological sequences.
|
|
25
|
|
26 The advantages over strings or plain arrays is the ease of tracking
|
|
27 changes (mutations) in the elements (sequence). The other side of the
|
|
28 coin is that these structures need consideraly more memory, but that
|
|
29 is cheap and constantly inceasing resource in computers.
|
|
30
|
|
31 =head1 FEEDBACK
|
|
32
|
|
33 =head2 Mailing Lists
|
|
34
|
|
35 User feedback is an integral part of the evolution of this and other
|
|
36 Bioperl modules. Send your comments and suggestions preferably to one
|
|
37 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
38
|
|
39 bioperl-l@bioperl.org - General discussion
|
|
40 http://bio.perl.org/MailList.html - About the mailing lists
|
|
41
|
|
42 =head2 Reporting Bugs
|
|
43
|
|
44 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
45 the bugs and their resolution. Bug reports can be submitted via email
|
|
46 or the web:
|
|
47
|
|
48 bioperl-bugs@bio.perl.org
|
|
49 http://bugzilla.bioperl.org/
|
|
50
|
|
51 =head1 AUTHOR - Joseph A.L. Insana
|
|
52
|
|
53 Email: Insana@ebi.ac.uk, jinsana@gmx.net
|
|
54 Address:
|
|
55
|
|
56 EMBL Outstation, European Bioinformatics Institute
|
|
57 Wellcome Trust Genome Campus, Hinxton
|
|
58 Cambs. CB10 1SD, United Kingdom
|
|
59
|
|
60 =head1 APPENDIX
|
|
61
|
|
62 The rest of the documentation details each of the object
|
|
63 methods. Internal methods are usually preceded with a _
|
|
64
|
|
65 =cut
|
|
66
|
|
67 # Let the code begin...
|
|
68
|
|
69 package Bio::LiveSeq::ChainI;
|
|
70 $VERSION=1.9;
|
|
71 # Version history:
|
|
72 # Thu Mar 16 01:38:25 GMT 2000 v.1.4 1st wraparound of methods complete
|
|
73 # tested with chainseq_asobj_test.pl
|
|
74 # Thu Mar 16 19:03:56 GMT 2000 v.1.5 decided to stick with same names as Chain
|
|
75 # Fri Mar 17 05:08:15 GMT 2000 v.1.6 in sync with Chain 2.4
|
|
76 # Fri Mar 17 15:47:23 GMT 2000 v.1.7 added pos_of_label, enforced down_ or up_
|
|
77 # Fri Mar 17 20:12:27 GMT 2000 v.1.8 NAMING change: index->label everywhere
|
|
78 # Mon Mar 20 19:20:17 GMT 2000 v.1.81 minor addings, Chain 2.52
|
|
79 # Mon Mar 20 23:15:09 GMT 2000 v.1.82 in sync with Chain 2.6
|
|
80 # Tue Mar 21 01:36:29 GMT 2000 v.1.83 added default strand if new(DNA)
|
|
81 # Tue Mar 21 14:19:17 GMT 2000 v.1.9 moved new(DNA) to DNA, added chain2string()
|
|
82
|
|
83 use Carp qw(croak);
|
|
84 use strict; # this will be moved before when strict enforced in Chain.pm
|
|
85
|
|
86 use Bio::LiveSeq::Chain 2.6; # package where all the subroutines are defined
|
|
87
|
|
88
|
|
89 =head2 new
|
|
90
|
|
91 Title : new
|
|
92 Usage : $chain = Bio::LiveSeq::ChainI->new(-string => "thequickbrownfoxjumpsoverthelazydog",
|
|
93 -offset => 3 );
|
|
94 OR $chain = Bio::LiveSeq::ChainI->new(-array => \@array,
|
|
95 -offset => 3 );
|
|
96 Function: generates a new Bio::LiveSeq:ChainI
|
|
97 Returns : a new Chain
|
|
98 Args : string
|
|
99 OR arrayreference
|
|
100 AND optional offset to create element labels
|
|
101 =cut
|
|
102
|
|
103 sub new {
|
|
104 my ($thing, %args) = @_;
|
|
105 my $class = ref($thing) || $thing;
|
|
106 my $obj;
|
|
107
|
|
108 if ($args{-string}) {
|
|
109 $obj = $thing->string2chain($args{-string}, $args{-offset});
|
|
110 } elsif ($args{-array}) {
|
|
111 $obj = $thing->array2chain($args{-array}, $args{-offset});
|
|
112 } else {
|
|
113 croak "$class not initialized properly";
|
|
114 }
|
|
115
|
|
116 $obj = bless $obj, $class;
|
|
117 return $obj;
|
|
118 }
|
|
119
|
|
120 # added as of 1.9
|
|
121 sub string2chain {
|
|
122 shift @_; # so that it doesn't pass the object reference
|
|
123 return Bio::LiveSeq::Chain::string2chain(@_);
|
|
124 }
|
|
125 sub array2chain {
|
|
126 shift @_; # so that it doesn't pass the object reference
|
|
127 return Bio::LiveSeq::Chain::array2chain(@_);
|
|
128 }
|
|
129 #
|
|
130 sub chain2string {
|
|
131 croak "ambiguous method call. Explicit down_ or up_";
|
|
132 }
|
|
133 sub down_chain2string {
|
|
134 return Bio::LiveSeq::Chain::down_chain2string(@_);
|
|
135 }
|
|
136 sub up_chain2string {
|
|
137 return Bio::LiveSeq::Chain::up_chain2string(@_);
|
|
138 }
|
|
139 sub chain2string_verbose {
|
|
140 croak "ambiguous method call. Explicit down_ or up_";
|
|
141 }
|
|
142 sub down_chain2string_verbose {
|
|
143 return Bio::LiveSeq::Chain::down_chain2string_verbose(@_);
|
|
144 }
|
|
145 sub up_chain2string_verbose {
|
|
146 return Bio::LiveSeq::Chain::up_chain2string_verbose(@_);
|
|
147 }
|
|
148 sub invert_chain {
|
|
149 return Bio::LiveSeq::Chain::invert_chain(@_);
|
|
150 }
|
|
151 sub mutate_element {
|
|
152 croak "Old method name, please update code to: set_value_at_label";
|
|
153 }
|
|
154
|
|
155 # new as of version 2.33 of Chain.pm
|
|
156 sub down_labels {
|
|
157 return Bio::LiveSeq::Chain::down_labels(@_);
|
|
158 }
|
|
159 sub up_labels {
|
|
160 return Bio::LiveSeq::Chain::up_labels(@_);
|
|
161 }
|
|
162
|
|
163 sub start {
|
|
164 return Bio::LiveSeq::Chain::start(@_);
|
|
165 }
|
|
166 sub end {
|
|
167 return Bio::LiveSeq::Chain::end(@_);
|
|
168 }
|
|
169 sub label_exists {
|
|
170 return Bio::LiveSeq::Chain::label_exists(@_);
|
|
171 }
|
|
172
|
|
173 sub get_value_at_pos {
|
|
174 croak "ambiguous method call. Explicit down_ or up_";
|
|
175 }
|
|
176 sub down_get_value_at_pos {
|
|
177 return Bio::LiveSeq::Chain::down_get_value_at_pos(@_);
|
|
178 }
|
|
179 sub up_get_value_at_pos {
|
|
180 return Bio::LiveSeq::Chain::up_get_value_at_pos(@_);
|
|
181 }
|
|
182 sub set_value_at_pos {
|
|
183 croak "ambiguous method call. Explicit down_ or up_";
|
|
184 }
|
|
185 sub down_set_value_at_pos {
|
|
186 return Bio::LiveSeq::Chain::down_set_value_at_pos(@_);
|
|
187 }
|
|
188 sub up_set_value_at_pos {
|
|
189 return Bio::LiveSeq::Chain::up_set_value_at_pos(@_);
|
|
190 }
|
|
191 sub get_value_at_label {
|
|
192 return Bio::LiveSeq::Chain::get_value_at_label(@_);
|
|
193 }
|
|
194 sub set_value_at_label {
|
|
195 return Bio::LiveSeq::Chain::set_value_at_label(@_);
|
|
196 }
|
|
197 sub get_label_at_pos {
|
|
198 croak "ambiguous method call. Explicit down_ or up_";
|
|
199 }
|
|
200 sub up_get_label_at_pos {
|
|
201 return Bio::LiveSeq::Chain::up_get_label_at_pos(@_);
|
|
202 }
|
|
203 sub down_get_label_at_pos {
|
|
204 return Bio::LiveSeq::Chain::down_get_label_at_pos(@_);
|
|
205 }
|
|
206 sub get_pos_of_label {
|
|
207 croak "ambiguous method call. Explicit down_ or up_";
|
|
208 }
|
|
209 sub up_get_pos_of_label {
|
|
210 return Bio::LiveSeq::Chain::up_get_pos_of_label(@_);
|
|
211 }
|
|
212 sub down_get_pos_of_label {
|
|
213 return Bio::LiveSeq::Chain::down_get_pos_of_label(@_);
|
|
214 }
|
|
215 #
|
|
216
|
|
217 sub preinsert_string {
|
|
218 return Bio::LiveSeq::Chain::praeinsert_string(@_);
|
|
219 }
|
|
220 sub preinsert_array {
|
|
221 return Bio::LiveSeq::Chain::praeinsert_array(@_);
|
|
222 }
|
|
223 sub praeinsert_string {
|
|
224 return Bio::LiveSeq::Chain::praeinsert_string(@_);
|
|
225 }
|
|
226 sub postinsert_string {
|
|
227 return Bio::LiveSeq::Chain::postinsert_string(@_);
|
|
228 }
|
|
229 sub praeinsert_array {
|
|
230 return Bio::LiveSeq::Chain::praeinsert_array(@_);
|
|
231 }
|
|
232 sub postinsert_array {
|
|
233 return Bio::LiveSeq::Chain::postinsert_array(@_);
|
|
234 }
|
|
235 sub down_element{
|
|
236 return Bio::LiveSeq::Chain::down_element(@_);
|
|
237 }
|
|
238 sub up_element {
|
|
239 return Bio::LiveSeq::Chain::up_element(@_);
|
|
240 }
|
|
241 sub is_downstream {
|
|
242 return Bio::LiveSeq::Chain::is_downstream(@_);
|
|
243 }
|
|
244 sub is_upstream {
|
|
245 return Bio::LiveSeq::Chain::is_upstream(@_);
|
|
246 }
|
|
247 sub check_chain {
|
|
248 return Bio::LiveSeq::Chain::check_chain(@_);
|
|
249 }
|
|
250 sub chain_length {
|
|
251 return Bio::LiveSeq::Chain::chain_length(@_);
|
|
252 }
|
|
253 sub splice_chain {
|
|
254 return Bio::LiveSeq::Chain::splice_chain(@_);
|
|
255 }
|
|
256 sub pos_of_element {
|
|
257 croak "ambiguous and old method name. use: down_pos_of_label";
|
|
258 }
|
|
259 sub up_pos_of_element {
|
|
260 croak "old method name. use: down_pos_of_label";
|
|
261 return Bio::LiveSeq::Chain::up_pos_of_element(@_);
|
|
262 }
|
|
263 sub down_pos_of_element {
|
|
264 croak "old method name. use: up_pos_of_label";
|
|
265 return Bio::LiveSeq::Chain::down_pos_of_element(@_);
|
|
266 }
|
|
267 sub subchain_length {
|
|
268 croak "ambiguous method call. Explicit down_ or up_";
|
|
269 }
|
|
270 sub down_subchain_length {
|
|
271 return Bio::LiveSeq::Chain::down_subchain_length(@_);
|
|
272 }
|
|
273 sub up_subchain_length {
|
|
274 return Bio::LiveSeq::Chain::up_subchain_length(@_);
|
|
275 }
|
|
276
|
|
277 # these have to be deleted and changed names to conform to terminology
|
|
278 sub elements {
|
|
279 return Bio::LiveSeq::Chain::down_elements(@_);
|
|
280 }
|
|
281 sub up_elements {
|
|
282 return Bio::LiveSeq::Chain::up_elements(@_);
|
|
283 }
|
|
284 sub down_elements {
|
|
285 return Bio::LiveSeq::Chain::down_elements(@_);
|
|
286 }
|
|
287
|
|
288 1;
|