ensembl-hive  2.8.1
MANE.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 =head1 NAME
32 
33 Bio::EnsEMBL::MANE - Object representing a MANE transcript
34 
35 =head1 SYNOPSIS
36 
38 
39  $mane_transcript = Bio::EnsEMBL::MANE->new(
40  -transcript => $transcript
41  );
42 
43 =head1 DESCRIPTION
44 
45 This is a MANE transcript
46 It represents an Ensembl transcript that has a matching RefSeq equivalent
47 
48 =head1 METHODS
49 
50 =cut
51 
52 use strict;
53 
54 package Bio::EnsEMBL::MANE;
55 
56 use vars qw(@ISA);
57 
59 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
60 use Scalar::Util qw(weaken isweak);
61 
62 @ISA = qw(Bio::EnsEMBL::Feature);
63 
64 use constant SEQUENCE_ONTOLOGY => {
65  acc => 'SO:0000673',
66  term => 'transcript',
67 };
68 
69 =head2 new
70 
71  Arg [...] : Named arguments passed to superclass
72  Example : $feature = Bio::EnsEMBL::MANE->new
73  (-transcript => $transcript);
74  Description: Constructs a new Bio::EnsEMBL::MANE.
75  Returntype : Bio::EnsEMBL::MANE
76  Exceptions :
77  Caller : general, subclass constructors
78  Status : Stable
79 
80 =cut
81 
82 sub new {
83  my $caller = shift;
84 
85  #allow this to be called as class or object method
86  my $class = ref($caller) || $caller;
87  my $self = $class->SUPER::new(@_);
88 
89  my ($transcript, $stable_id, $seq_region_start, $seq_region_end) = rearrange(['TRANSCRIPT', 'STABLE_ID', 'SEQ_REGION_START', 'SEQ_REGION_END'],@_);
90 
91  $self->{'transcript'} = $transcript;
92  $self->{'stable_id'} = $stable_id;
93  $self->{'seq_region_start'} = $seq_region_start;
94  $self->{'seq_region_end'} = $seq_region_end;
95  return $self;
96 }
97 
98 =head2 transcript
99  Arg [1] : Fetch the original transcript object
100  Example : $transcript = $mane->transcript();
101  Description: Getter/Setter for the transcript object
102  Returntype : Bio::EnsEMBL::Transcript
103  Exceptions : none
104  Caller : general
105  Status : Stable
106 
107 =cut
108 
109 sub transcript {
110  my $self = shift;
111  $self->{'transcript'} = shift if(@_);
112  return $self->{'transcript'};
113 }
114 
115 =head2 stable_id
116  Arg [1] : (optional) string $stable_id
117  Example : $stable_id = $mane->stable_id();
118  Description: Getter/Setter for the stable_id for
119  the transcript associated with this MANE transcript
120  Returntype : String
121  Exceptions : none
122  Caller : general
123  Status : Stable
124 
125 =cut
126 
127 sub stable_id {
128  my $self = shift;
129  $self->{'stable_id'} = shift if(@_);
130  return $self->{'stable_id'};
131 }
132 
133 
134 =head2 refseq
135 
136  Arg [1] : Fetch the RefSeq accession associated with
137  this transcript
138  Example : $refseq = $mane->refseq();
139  Description: Getter/Setter for the RefSeq associated with this
140  MANE transcript.
141  Returntype : string
142  Exceptions : none
143  Caller : general
144  Status : Stable
145 
146 =cut
147 
148 sub refseq {
149  my $self = shift;
150  my $transcript = $self->transcript;
151  my @attributes = @{ $transcript->get_all_Attributes() };
152  foreach my $attribute (@attributes) {
153  if ($attribute->code =~ /MANE/) {
154  return $attribute->value;
155  }
156  }
157 }
158 
159 =head2 type
160 
161  Arg [1] : (optional) string mane class
162  Example : $mane = $mane->type();
163  Description: Getter/Setter for the class of MANE
164  associated with this transcript.
165  Returntype : String
166  Exceptions : none
167  Caller : general
168  Status : Stable
169 
170 =cut
171 
172 sub type {
173  my $self = shift;
174  my $transcript = $self->transcript;
175  my @attributes = @{ $transcript->get_all_Attributes() };
176  foreach my $attribute (@attributes) {
177  if ($attribute->code =~ /MANE/) {
178  return $attribute->code;
179  }
180  }
181 }
182 
183 sub display_id {
184  my $self = shift;
185  my $id = $self->stable_id;
186  return $id;
187 }
188 
189 
190 =head2 summary_as_hash
191 
192  Example : my $hash = $mane->summary_as_hash();
193  Description: Generates a HashRef compatible with GFFSerializer. Adds
194  Gene, RefSeq accession and MANE class to the basic feature hash
195  Returntype : Hash
196  Exceptions : none
197  Caller : general
198  Status : Stable
199 
200 =cut
201 
202 sub summary_as_hash {
203  my ($self) = @_;
204  my $summary_ref = $self->SUPER::summary_as_hash;
205  $summary_ref->{'refseq_match'} = $self->refseq();
206  $summary_ref->{'type'} = $self->type();
207  $summary_ref->{'id'} = $self->stable_id();
208  my $parent = $self->transcript->get_Gene();
209  $summary_ref->{'Parent'} = $parent->display_id if defined $parent;
210  $summary_ref->{'strand'} = $self->transcript->strand();
211  $summary_ref->{'version'} = $self->transcript->version() if $self->transcript->version();
212  return $summary_ref;
213 }
214 
215 
216 1;
transcript
public transcript()
Bio::EnsEMBL::Feature
Definition: Feature.pm:47
accession
public accession()
Bio::EnsEMBL::Transcript
Definition: Transcript.pm:44
Bio::EnsEMBL::MANE
Definition: MANE.pm:23
Bio::EnsEMBL::MANE::new
public Bio::EnsEMBL::MANE new()
Bio::EnsEMBL::Utils::Argument
Definition: Argument.pm:34