Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/LiveSeq/DNA.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: DNA.pm,v 1.9 2001/10/22 08:22:51 heikki Exp $ | |
2 # | |
3 # bioperl module for Bio::LiveSeq::DNA | |
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::DNA - DNA object for LiveSeq | |
16 | |
17 =head1 SYNOPSIS | |
18 | |
19 # documentation needed | |
20 | |
21 =head1 DESCRIPTION | |
22 | |
23 This holds the DNA sequence (or the RNA in the case of cDNA entries) | |
24 and is accessed by exons, genes, transcripts... objects | |
25 | |
26 =head1 AUTHOR - Joseph A.L. Insana | |
27 | |
28 Email: Insana@ebi.ac.uk, jinsana@gmx.net | |
29 | |
30 Address: | |
31 | |
32 EMBL Outstation, European Bioinformatics Institute | |
33 Wellcome Trust Genome Campus, Hinxton | |
34 Cambs. CB10 1SD, United Kingdom | |
35 | |
36 =head1 APPENDIX | |
37 | |
38 The rest of the documentation details each of the object | |
39 methods. Internal methods are usually preceded with a _ | |
40 | |
41 =cut | |
42 | |
43 # Let the code begin... | |
44 | |
45 package Bio::LiveSeq::DNA; | |
46 $VERSION=1.4; | |
47 | |
48 # Version history: | |
49 # Mon Mar 20 19:21:22 GMT 2000 v.1.0 begun | |
50 # Tue Mar 21 14:20:30 GMT 2000 v.1.1 new() is now here, not inherited | |
51 # Wed Mar 22 19:43:20 GMT 2000 v.1.2 length override | |
52 # Thu Jun 22 20:02:39 BST 2000 v 1.3 valid() from SeqI now moved here, as override | |
53 # Wed Mar 28 17:01:59 BST 2001 v 1.4 changed croaks into throw | |
54 | |
55 use strict; | |
56 use vars qw($VERSION @ISA); | |
57 use Bio::LiveSeq::SeqI 3.2; # uses SeqI, inherits from it | |
58 @ISA=qw(Bio::LiveSeq::SeqI); | |
59 | |
60 =head2 new | |
61 | |
62 Title : new | |
63 Usage : $dna = Bio::LiveSeq::DNA->new(-seq => "atcgaccaatggacctca", | |
64 -offset => 3 ); | |
65 | |
66 Function: generates a new Bio::LiveSeq::DNA | |
67 Returns : reference to a new object of class DNA | |
68 Errorcode -1 | |
69 Args : a string | |
70 AND an optional offset to create nucleotide labels (default is 1, i.e. | |
71 starting the count of labels from "1") -> do not bother using it -> | |
72 it could be used by alternative loaders !EMBL format | |
73 NOTE : strand of DNA is set to 1 by default | |
74 | |
75 =cut | |
76 | |
77 sub new { | |
78 my ($thing, %args) = @_; | |
79 my $class = ref($thing) || $thing; | |
80 my (%empty,$obj); | |
81 | |
82 if ($args{-seq}) { | |
83 $obj = $thing->string2chain($args{-seq},$args{-offset}); # inherited from ChainI | |
84 $obj = bless $obj, $class; | |
85 } else { | |
86 $obj=\%empty; | |
87 $obj = bless $obj, $class; | |
88 $obj->throw("$class not initialized properly"); | |
89 } | |
90 | |
91 $obj->{'alphabet'}='dna'; # set alphabet default | |
92 $obj->{'strand'}=1; # set strand default = 1 | |
93 $obj->{'seq'}=$obj; # set seq field to itself | |
94 | |
95 return $obj; | |
96 } | |
97 | |
98 # START method | |
99 # it has to be redefined here because default from SeqI accesses field "start" | |
100 sub start { | |
101 my $self = shift; | |
102 return $self->{'begin'}; # the chain's start is called begin | |
103 } | |
104 | |
105 # it is overridden to provide faster output | |
106 sub length { | |
107 my $self=shift; | |
108 return $self->chain_length(); | |
109 } | |
110 | |
111 # it is overridden to provide MUCH faster output | |
112 sub valid { | |
113 my $self=shift(@_); | |
114 return $self->label_exists(@_); | |
115 } | |
116 | |
117 1; |