EnsEMBL/MANE.pm untested

filter: Statementstmt 0.0% 0 / 65 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 100 CC 7 SCAR 16.6
CC
7
Cov
0%
summary_as_hash
12.0
transcript
6.0
stable_id
6.0
CRAP 5.3
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  
37 use Bio::EnsEMBL::MANE;
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 $Bio::EnsEMBL::MANE::VERSION = '114.0.0_50'; # TRIAL
56 $Bio::EnsEMBL::MANE::VERSION = '114.0.050';
57 use vars qw(@ISA);
58  
59 use Bio::EnsEMBL::Feature;
60 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
61 use Scalar::Util qw(weaken isweak);
62  
63 @ISA = qw(Bio::EnsEMBL::Feature);
64  
65 use constant SEQUENCE_ONTOLOGY => {
66 acc => 'SO:0000673',
67 term => 'transcript',
68 };
69  
70 =head2 new
71  
72 Arg [...] : Named arguments passed to superclass
73 Example : $feature = Bio::EnsEMBL::MANE->new
74 (-transcript => $transcript);
75 Description: Constructs a new Bio::EnsEMBL::MANE.
76 Returntype : Bio::EnsEMBL::MANE
77 Exceptions :
78 Caller : general, subclass constructors
79 Status : Stable
80  
81 =cut
82  
83 sub new {
84 my $caller = shift;
85  
86 #allow this to be called as class or object method
87 my $class = ref($caller) || $caller;
88 my $self = $class->SUPER::new(@_);
89  
90 my ($transcript, $stable_id, $seq_region_start, $seq_region_end) = rearrange(['TRANSCRIPT', 'STABLE_ID', 'SEQ_REGION_START', 'SEQ_REGION_END'],@_);
91  
92 $self->{'transcript'} = $transcript;
93 $self->{'stable_id'} = $stable_id;
94 $self->{'seq_region_start'} = $seq_region_start;
95 $self->{'seq_region_end'} = $seq_region_end;
96 return $self;
97 }
98  
99 =head2 transcript
100 Arg [1] : Fetch the original transcript object
101 Example : $transcript = $mane->transcript();
102 Description: Getter/Setter for the transcript object
103 Returntype : Bio::EnsEMBL::Transcript
104 Exceptions : none
105 Caller : general
106 Status : Stable
107  
108 =cut
109  
110 sub transcript {
111 my $self = shift;
112 $self->{'transcript'} = shift if(@_);
113 return $self->{'transcript'};
114 }
115  
116 =head2 stable_id
117 Arg [1] : (optional) string $stable_id
118 Example : $stable_id = $mane->stable_id();
119 Description: Getter/Setter for the stable_id for
120 the transcript associated with this MANE transcript
121 Returntype : String
122 Exceptions : none
123 Caller : general
124 Status : Stable
125  
126 =cut
127  
128 sub stable_id {
129 my $self = shift;
130 $self->{'stable_id'} = shift if(@_);
131 return $self->{'stable_id'};
132 }
133  
134  
135 =head2 refseq
136  
137 Arg [1] : Fetch the RefSeq accession associated with
138 this transcript
139 Example : $refseq = $mane->refseq();
140 Description: Getter/Setter for the RefSeq associated with this
141 MANE transcript.
142 Returntype : string
143 Exceptions : none
144 Caller : general
145 Status : Stable
146  
147 =cut
148  
149 sub refseq {
150 my $self = shift;
151 my $transcript = $self->transcript;
152 my @attributes = @{ $transcript->get_all_Attributes() };
153 foreach my $attribute (@attributes) {
154 if ($attribute->code =~ /MANE/) {
155 return $attribute->value;
156 }
157 }
158 }
159  
160 =head2 type
161  
162 Arg [1] : (optional) string mane class
163 Example : $mane = $mane->type();
164 Description: Getter/Setter for the class of MANE
165 associated with this transcript.
166 Returntype : String
167 Exceptions : none
168 Caller : general
169 Status : Stable
170  
171 =cut
172  
173 sub type {
174 my $self = shift;
175 my $transcript = $self->transcript;
176 my @attributes = @{ $transcript->get_all_Attributes() };
177 foreach my $attribute (@attributes) {
178 if ($attribute->code =~ /MANE/) {
179 return $attribute->code;
180 }
181 }
182 }
183  
184 sub display_id {
185 my $self = shift;
186 my $id = $self->stable_id;
187 return $id;
188 }
189  
190  
191 =head2 summary_as_hash
192  
193 Example : my $hash = $mane->summary_as_hash();
194 Description: Generates a HashRef compatible with GFFSerializer. Adds
195 Gene, RefSeq accession and MANE class to the basic feature hash
196 Returntype : Hash
197 Exceptions : none
198 Caller : general
199 Status : Stable
200  
201 =cut
202  
203 sub summary_as_hash {
204 my ($self) = @_;
205 my $summary_ref = $self->SUPER::summary_as_hash;
206 $summary_ref->{'refseq_match'} = $self->refseq();
207 $summary_ref->{'type'} = $self->type();
208 $summary_ref->{'id'} = $self->stable_id();
209 my $parent = $self->transcript->get_Gene();
210 $summary_ref->{'Parent'} = $parent->display_id if defined $parent;
211 $summary_ref->{'strand'} = $self->transcript->strand();
212 $summary_ref->{'version'} = $self->transcript->version() if $self->transcript->version();
213 return $summary_ref;
214 }
215  
216  
217 1;