ensembl-hive  2.7.0
RepeatConsensus.pm
Go to the documentation of this file.
1 =head1 LICENSE
2 
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5 
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 
18 =cut
19 
20 
21 =head1 CONTACT
22 
23  Please email comments or questions to the public Ensembl
24  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25 
26  Questions may also be sent to the Ensembl help desk at
27  <http://www.ensembl.org/Help/Contact>.
28 
29 =cut
30 
31 package Bio::EnsEMBL::RepeatConsensus;
32 
33 use strict;
34 
36 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
37 
38 use vars qw(@ISA);
39 @ISA = qw(Bio::EnsEMBL::Storable);
40 
41 
42 =head2 new
43 
44  Arg [NAME] : string (optional)
45  The name of this repeat consensus
46  Arg [LENGTH]: int (optional)
47  The length of the repeat consensus sequence
48  Arg [REPEAT_CLASS]: string (optional)
49  The type of repeat consensus
50  Arg [REPEAT_CONSENSUS]: string (optional)
51  The sequence of this repeat consensus
52  Arg [REPEAT_TYPE]: string
53  Its like class only more general
54  Arg [...]: Named arguments to superclass constructor
55  (see Bio::EnsEMBL::Storable)
56  Example : $rc = Bio::EnsEMBL::RepeatConsensus->new
57  (-REPEAT_CONSENSUS => 'AATG'
58  -NAME => '(AATG)n',
59  -REPEAT_CLASS => 'Simple_repeat',
60  -LENGTH => '4',
61  -DBID => 1023,
62  -ADAPTOR => $rc_adaptor);
63  Description: Creates a new Bio::EnsEMBL::RepeatConsensus object
65  Exceptions : none
66  Caller : RepeatFeatureAdaptors
67  Status : Stable
68 
69 =cut
70 
71 sub new {
72  my $caller = shift;
73 
74  my $class = ref($caller) || $caller;
75 
76  my $self = $class->SUPER::new(@_);
77 
78  my ($name, $length, $repeat_class, $repeat_consensus, $repeat_type ) =
79  rearrange(['NAME', 'LENGTH', 'REPEAT_CLASS', 'REPEAT_CONSENSUS', 'REPEAT_TYPE'], @_);
80 
81  $self->{'name'} = $name;
82  $self->{'length'} = $length;
83  $self->{'repeat_class'} = $repeat_class;
84  $self->{'repeat_consensus'} = $repeat_consensus;
85  $self->{'repeat_type'} = $repeat_type;
86 
87  return $self;
88 }
89 
90 
91 =head2 name
92 
93  Arg [1] : string $name (optional)
94  Example : $name = $repeat_consensus->name()
95  Description: Getter/Setter for the name of this repeat_consensus
96  Returntype : string
97  Exceptions : none
98  Caller : general
99  Status : Stable
100 
101 =cut
102 
103 sub name {
104  my $self = shift;
105  $self->{'name'} = shift if(@_);
106  return $self->{'name'};
107 }
108 
109 
110 =head2 length
111 
112  Arg [1] : int $length (optional)
113  Example : $length = $repeat_consensus->length()
114  Description: Getter/Setter for the length of this repeat_consensus
115  Returntype : int
116  Exceptions : none
117  Caller : general
118  Status : Stable
119 
120 =cut
121 
122 sub length {
123  my $self = shift;
124  $self->{'length'} = shift if(@_);
125  return $self->{'length'};
126 }
127 
128 
129 =head2 repeat_class
130 
131  Arg [1] : string $class (optional)
132  The class of
133  Example : $class = $repeat_consensus->repeat_class()
134  Description: Getter/Setter for the class of this repeat_consensus
135  Returntype : string
136  Exceptions : none
137  Caller : general
138  Status : Stable
139 
140 =cut
141 
142 sub repeat_class {
143  my $self = shift;
144  $self->{'repeat_class'} = shift if(@_);
145  return $self->{'repeat_class'};
146 }
147 
148 =head2 repeat_type
149 
150  Arg [1] : string $type (optional)
151  The type of the consensus
152  Example : $type = $repeat_consensus->repeat_type()
153  Description: Getter/Setter for the type of this repeat_consensus
154  Returntype : string
155  Exceptions : none
156  Caller : general
157 
158 =cut
159 
160 sub repeat_type {
161  my $self = shift;
162  $self->{'repeat_type'} = shift if(@_);
163  return $self->{'repeat_type'};
164 }
165 
166 
167 =head2 desc
168 
169  Arg [1] : none
170  Example : $desc = $repeat_consensus->desc()
171  Description: Getter for the description of this repeat consensus as extracted
172  from the repeat_class. This method is probably useless.
173  Returntype : string
174  Exceptions : none
175  Caller : general
176  Status : Medium risk
177 
178 =cut
179 
180 sub desc {
181  my $self = shift;
182  my $class = $self->repeat_class or return;
183  return "class=$class";
184 }
185 
186 
187 
188 =head2 repeat_consensus
189 
190  Arg [1] : string $consensus_seq (optional)
191  The sequence of this repeat consensus
192  Example : $consensus = $repeat_consensus->repeat_consensus();
193  Description: Getter/Setter for the sequence of this repeat_consensus.
194  Returntype : string
195  Exceptions : none
196  Caller : general
197 
198 =cut
199 
200 sub repeat_consensus {
201  my $self = shift;
202  $self->{'repeat_consensus'} = shift if(@_);
203  return $self->{'repeat_consensus'};
204 }
205 
206 
207 
208 =head2 seq
209 
210  Arg [1] : none
211  Example : none
212  Description: Returns the repeat consensus. This method is useless - Use
213  repeat_consensus() instead.
214  Returntype : string
215  Exceptions : none
216  Caller : general
217  Status : Stable
218 
219 =cut
220 
221 sub seq {
222  my( $self ) = @_;
223  return $self->repeat_consensus;
224 }
225 
226 1;
227 
228 __END__
229 
230 =head1 NAME - Bio::EnsEMBL::RepeatConsensus
231 
232 =head1 DESCRIPTION
233 
234 This object represents an entry in the
235 repeat_consensus table.
236 
237 It can contain the consensus sequence for a
238 repeat such as a particular Alu, or "cag" for a
239 simple triplet repeat.
240 
Bio::EnsEMBL::Storable
Definition: Storable.pm:23
Bio::EnsEMBL::Utils::Argument
Definition: Argument.pm:34
Bio::EnsEMBL::RepeatConsensus
Definition: RepeatConsensus.pm:5