3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
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
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.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
44 -type =>
'five_prime_UTR',
50 This is a
UTR feature within the Ensembl system.
51 A
UTR repsents the non-coding (untranslated) regions
60 package Bio::EnsEMBL::UTR;
66 use Scalar::Util qw(weaken isweak);
73 Arg [...] : Named arguments passed to superclass
81 -type =>
'five_prime_UTR');
84 Exceptions : Thrown on invalid -SLICE, -STRAND arguments
85 Caller : general, subclass constructors
93 #allow this to be called as class or object method
94 my $class = ref($caller) || $caller;
95 my $self = $class->SUPER::new(@_);
97 my ($transcript, $type, $seq_region_start, $seq_region_end) = rearrange([
'TRANSCRIPT',
'TYPE',
'SEQ_REGION_START',
'SEQ_REGION_END'],@_);
99 $self->{
'transcript'} = $transcript;
100 $self->{
'type'} = $type;
101 $self->{
'seq_region_start'} = $seq_region_start;
102 $self->{
'seq_region_end'} = $seq_region_end;
111 Example : $transcript = $utr->transcript();
112 Description: Getter/Setter
for the
transcript associated with
this
123 $self->{
'transcript'} = shift
if(@_);
124 return $self->{
'transcript'};
129 Description: Fetch the translation associated with
131 if there is no translation, ie. a pseudogene
143 =head2 seq_region_start
145 Arg [1] : (optional)
string $seq_region_start
146 Example : $seq_region_start = $cds->seq_region_start();
147 Description: Getter/Setter
for the seq_region_start
for this UTR.
148 Overwrite
default method from Feature as UTR does not have
157 sub seq_region_start {
159 $self->{
'seq_region_start'} = shift
if(@_);
160 return $self->{
'seq_region_start'};
163 =head2 seq_region_end
165 Arg [1] : (optional)
string $seq_region_end
166 Example : $seq_region_end = $cds->seq_region_end();
167 Description: Getter/Setter
for the seq_region_end
for this UTR.
168 Overwrite
default method from Feature as UTR does not have
179 $self->{
'seq_region_end'} = shift
if(@_);
180 return $self->{
'seq_region_end'};
185 Description: Get the gene associated with the ExonTranscript,
197 if($self->{
'transcript'}) {
198 return $self->{
'transcript'}->get_Gene();
206 Arg [1] : (optional)
string $type
207 Example : print $utr->type();
208 Description: This method returns a
string that describes
209 the type of UTR feature (5 prime or 3 prime)
219 $self->{
'type'} = shift
if( @_ );
220 return ( $self->{
'type'} ||
'UTR' );
224 # package variable to minimize duplication
225 my %utr_type_so_mapping = (
226 'five_prime_utr' => {
228 term =>
'five_prime_UTR',
230 'three_prime_utr' => {
232 term =>
'three_prime_UTR',
236 =head2 feature_so_acc
239 Description: This method returns a
string containing the SO
accession number of the UTR, based on type.
241 Returntype : string (Sequence Ontology
accession number)
248 # return UTR type SO acc, or UTR acc
249 return $utr_type_so_mapping{$self->type}->{
'acc'}
252 =head2 feature_so_term
254 Example : print $utr->feature_so_term;
255 Description: This method returns a
string containing the SO
accession term of the UTR, based on type.
257 Returntype : string (Sequence Ontology term)
261 sub feature_so_term {
264 # return UTR type SO acc, or UTR acc
265 return $utr_type_so_mapping{$self->type}->{
'term'}
268 =head2 summary_as_hash
270 Example : my $hash = $utr->summary_as_hash();
271 Description: Generates a HashRef compatible with GFFSerializer. Adds
272 Parent, source and type to the basic Feature hash
280 sub summary_as_hash {
282 my $hash = $self->SUPER::summary_as_hash();
283 $hash->{
'type'} = $self->type()
if $self->type();
284 my $parent = $self->transcript();
285 $hash->{
'Parent'} = $parent->display_id
if defined $parent;
286 $hash->{
'source'} = $self->transcript->source()
if $self->transcript();