comparison variant_effect_predictor/Bio/LiveSeq/Mutation.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: Mutation.pm,v 1.6 2002/10/22 07:38:34 lapp Exp $
2 #
3 # BioPerl module for Bio::LiveSeq::Mutation
4 #
5 # Cared for by Heikki Lehvaslaiho <heikki@ebi.ac.uk>
6 #
7 # Copyright Heikki Lehvaslaiho
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::Mutation - Mutation event descriptor class
16
17 =head1 SYNOPSIS
18
19 # full descrition of a point mutation
20 $mutation1a = Bio::LiveSeq::Mutation->new ( -seq => 'A',
21 -seqori => 'T',
22 -pos => 100,
23 -len => 1 # optional, defaults to length(seq)
24 );
25
26 # minimal information for a point mutation
27 $mutation1b = Bio::LiveSeq::Mutation->new ( -seq => 'A',
28 -pos => 100
29 );
30 # insertion
31 $mutation2 = Bio::LiveSeq::Mutation->new ( -seq => 'ATT',
32 -pos => 100,
33 -len => 0
34 );
35 # deletion
36 $mutation3 = Bio::LiveSeq::Mutation->new ( -seq => '', # optional
37 -seqori => 'TTG', # optional
38 -pos => 100
39 -len => 3
40 );
41 # complex
42 $mutation4 = Bio::LiveSeq::Mutation->new ( -seq => 'CC',
43 -seqori => 'TTG', # optional
44 -pos => 100
45 -len => 3
46 );
47
48
49 =head1 DESCRIPTION
50
51 This class describes a local mutation event using minimalistic
52 description. It is not necessary to know anything about the original
53 sequence. You need to give the changed sequence, the position of the
54 mutation in the (unidentified) reference sequence, and the length of
55 the affected subsequence in the reference sequence. If the original
56 allele sequence is given, the objects applying the mutation into the
57 reference sequence (e.g. L<Bio::LiveSeq::Mutator>) might check for its
58 validity.
59
60 =head1 FEEDBACK
61
62 =head2 Mailing Lists
63
64 User feedback is an integral part of the evolution of this and other
65 Bioperl modules. Send your comments and suggestions preferably to the
66 Bioperl mailing lists Your participation is much appreciated.
67
68 bioperl-l@bioperl.org - General discussion
69 http://bio.perl.org/MailList.html - About the mailing lists
70
71 =head2 Reporting Bugs
72
73 report bugs to the Bioperl bug tracking system to help us keep track
74 the bugs and their resolution. Bug reports can be submitted via
75 email or the web:
76
77 bioperl-bugs@bio.perl.org
78 http://bugzilla.bioperl.org/
79
80 =head1 AUTHOR - Heikki Lehvaslaiho
81
82 Email: heikki@ebi.ac.uk
83 Address:
84
85 EMBL Outstation, European Bioinformatics Institute
86 Wellcome Trust Genome Campus, Hinxton
87 Cambs. CB10 1SD, United Kingdom
88
89 =head1 APPENDIX
90
91 The rest of the documentation details each of the object
92 methods. Internal methods are usually preceded with a _
93
94 =cut
95
96
97 # Let the code begin...
98
99 package Bio::LiveSeq::Mutation;
100 use vars qw(@ISA);
101 use strict;
102
103 # Object preamble - inheritance
104
105 use Bio::Root::Root;
106
107 @ISA = qw( Bio::Root::Root );
108
109 sub new {
110 my($class,@args) = @_;
111 my $self;
112 $self = {};
113 bless $self, $class;
114
115 my ($seq, $seqori, $pos, $len, $label) =
116 $self->_rearrange([qw(SEQ
117 SEQORI
118 POS
119 LEN
120 )],
121 @args);
122
123 $seq && $self->seq($seq);
124 $seqori && $self->seqori($seqori);
125 $pos && $self->pos($pos);
126 defined($len) && $self->len($len); # defined() added otherwise won't work for len==0
127
128 return $self; # success - we hope!
129 }
130
131
132 =head2 seq
133
134 Title : seq
135 Usage : $obj->seq();
136 Function:
137
138 Sets and returns the mutated sequence. No checking is done
139 to validate the symbols.
140
141 Example :
142 Returns : string
143 Args : integer
144
145 =cut
146
147
148 sub seq {
149 my ($self,$value) = @_;
150 if( defined $value) {
151 $self->{'seq'} = $value;
152 }
153 return $self->{'seq'};
154 }
155
156
157 =head2 seqori
158
159 Title : seqori
160 Usage : $obj->seqori();
161 Function:
162
163 Sets and returns the original subsequence in the reference
164 sequence. No checking is done to validate the symbols.
165 Optional value.
166
167 Example :
168 Returns : string
169 Args : string
170
171 =cut
172
173
174 sub seqori {
175 my ($self,$value) = @_;
176 if( defined $value) {
177 $self->{'seqori'} = $value;
178 }
179 return $self->{'seqori'};
180 }
181
182
183 =head2 pos
184
185 Title : pos
186 Usage : $obj->pos();
187 Function:
188
189 Sets and returns the position of the first element in the
190 sequence.
191
192 Example :
193 Returns : string
194 Args : integer
195
196 =cut
197
198
199 sub pos {
200 my ($self,$value) = @_;
201 if( defined $value) {
202 if ( $value !~ /^([+-])?\d+$/ ) {
203 $self->throw("[$value] for pos has to be an integer\n");
204 } else {
205 $self->{'pos'} = $value;
206 }
207 }
208 return $self->{'pos'};
209 }
210
211 =head2 len
212
213 Title : len
214 Usage : $obj->len();
215 Function:
216
217 Sets and returns the len of the affected original allele
218 sequence. If value is not set, defaults to the lenght of
219 the mutated sequence (seq).
220
221 Example :
222 Returns : string
223 Args : string
224
225 =cut
226
227 sub len {
228 my ($self,$value) = @_;
229 if ( defined $value) {
230 $self->{'len'} = $value;
231 }
232 if ( ! exists $self->{'len'} ) {
233 return length $self->{'seq'};
234 }
235 return $self->{'len'};
236 }
237
238 =head2 label
239
240 Title : label
241 Usage : $obj->label();
242 Function:
243
244 Sets and returns the label of the affected original allele
245 location. Label is a stable identifier whereas location
246 can be changed by mutations. Label comes from
247 l<Bio::LiveSeq::Gene>.
248
249 Example :
250 Returns : string
251 Args : string
252
253 =cut
254
255 sub label {
256 my ($self,$value) = @_;
257 if ( defined $value) {
258 $self->{'label'} = $value;
259 }
260 if ( ! exists $self->{'label'} ) {
261 return undef;
262 }
263 return $self->{'label'};
264 }
265
266
267 =head2 transpos
268
269 Title : transpos
270 Usage : $obj->transpos();
271 Function:
272
273 Sets and returns the transcript position of the mutation.
274 Set when associated with a reference sequence. Value
275 depends on reference molecule and the co-ordinate system
276 used.
277
278 Example :
279 Returns : string
280 Args : integer
281
282 =cut
283
284
285 sub transpos {
286 my ($self,$value) = @_;
287 if( defined $value) {
288 if ( $value !~ /^([+-])?\d+$/ ) {
289 $self->throw("[$value] for transpos has to be an integer\n");
290 } else {
291 $self->{'transpos'} = $value;
292 }
293 }
294 return $self->{'transpos'};
295 }
296
297
298 =head2 issue
299
300 Title : issue
301 Usage : $obj->issue();
302 Function:
303
304 Sets and returns the position of the mutation in an array
305 of mutations to be issued. Set after the validity of the
306 mutation has been confirmed.
307
308 Example :
309 Returns : string
310 Args : integer
311
312 =cut
313
314
315 sub issue {
316 my ($self,$value) = @_;
317 if( defined $value) {
318 if ( $value !~ /^([+-])?\d+$/ ) {
319 $self->throw("[$value] for issue has to be an integer\n");
320 } else {
321 $self->{'issue'} = $value;
322 }
323 }
324 return $self->{'issue'};
325 }
326
327
328 =head2 prelabel
329
330 Title : prelabel
331 Usage : $obj->prelabel();
332 Function:
333
334 Sets and returns the prelabel of the affected original allele
335 location. Prelabel is a stable identifier whereas location
336 can be changed by mutations. Prelabel comes from
337 l<Bio::LiveSeq::Gene>.
338
339 Example :
340 Returns : string
341 Args : string
342
343 =cut
344
345 sub prelabel {
346 my ($self,$value) = @_;
347 if ( defined $value) {
348 $self->{'prelabel'} = $value;
349 }
350 if ( ! exists $self->{'prelabel'} ) {
351 return undef;
352 }
353 return $self->{'prelabel'};
354 }
355
356
357 =head2 postlabel
358
359 Title : postlabel
360 Usage : $obj->postlabel();
361 Function:
362
363 Sets and returns the postlabel of the affected original allele
364 location. Postlabel is a stable identifier whereas location
365 can be changed by mutations. Postlabel comes from
366 l<Bio::LiveSeq::Gene>.
367
368 Example :
369 Returns : string
370 Args : string
371
372 =cut
373
374 sub postlabel {
375 my ($self,$value) = @_;
376 if ( defined $value) {
377 $self->{'postlabel'} = $value;
378 }
379 if ( ! exists $self->{'postlabel'} ) {
380 return undef;
381 }
382 return $self->{'postlabel'};
383 }
384
385
386 =head2 lastlabel
387
388 Title : lastlabel
389 Usage : $obj->lastlabel();
390 Function:
391
392 Sets and returns the lastlabel of the affected original allele
393 location. Lastlabel is a stable identifier whereas location
394 can be changed by mutations. Lastlabel comes from
395 l<Bio::LiveSeq::Gene>.
396
397 Example :
398 Returns : string
399 Args : string
400
401 =cut
402
403 sub lastlabel {
404 my ($self,$value) = @_;
405 if ( defined $value) {
406 $self->{'lastlabel'} = $value;
407 }
408 if ( ! exists $self->{'lastlabel'} ) {
409 return undef;
410 }
411 return $self->{'lastlabel'};
412 }
413
414 1;