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
50 This is a
CDS feature within the Ensembl
CDS.
51 It represents the coding regions of a
transcript.
59 package Bio::EnsEMBL::CDS;
65 use Scalar::Util qw(weaken isweak);
69 use constant SEQUENCE_ONTOLOGY => {
76 Arg [...] : Named arguments passed to superclass
87 Exceptions : Thrown on invalid -SLICE, -STRAND arguments
88 Caller : general, subclass constructors
96 #allow this to be called as class or object method
97 my $class = ref($caller) || $caller;
98 my $self = $class->SUPER::new(@_);
100 my ($transcript, $phase, $translation_id, $seq_region_start, $seq_region_end) = rearrange([
'TRANSCRIPT',
'PHASE',
'TRANSLATION_ID',
'SEQ_REGION_START',
'SEQ_REGION_END'],@_);
102 $self->{
'transcript'} = $transcript;
103 $self->{
'phase'} = $phase;
104 $self->{
'translation_id'} = $translation_id;
105 $self->{
'seq_region_start'} = $seq_region_start;
106 $self->{
'seq_region_end'} = $seq_region_end;
115 Example : $transcript = $cds->transcript();
116 Description: Getter/Setter
for the
transcript associated with
this
127 $self->{
'transcript'} = shift
if(@_);
128 return $self->{
'transcript'};
133 Description: Fetch the translation associated with
135 if there is no translation, ie. a pseudogene
147 =head2 seq_region_start
149 Arg [1] : (optional)
string $seq_region_start
150 Example : $seq_region_start = $cds->seq_region_start();
151 Description: Getter/Setter
for the seq_region_start
for this CDS.
152 Overwrite
default method from Feature as CDS does not have
161 sub seq_region_start {
163 $self->{
'seq_region_start'} = shift
if(@_);
164 return $self->{
'seq_region_start'};
167 =head2 seq_region_end
169 Arg [1] : (optional)
string $seq_region_end
170 Example : $seq_region_end = $cds->seq_region_end();
171 Description: Getter/Setter
for the seq_region_end
for this CDS.
172 Overwrite
default method from Feature as CDS does not have
183 $self->{
'seq_region_end'} = shift
if(@_);
184 return $self->{
'seq_region_end'};
189 Description: Get the gene associated with the ExonTranscript,
201 if($self->{
'transcript'}) {
202 return $self->{
'transcript'}->get_Gene();
208 =head2 translation_id
210 Arg [1] : (optional)
string $translation_id
211 Example : $translation_id = $cds->translation_id();
212 Description: Getter/Setter
for the stable_id
for the translation
213 associated with
this CDS.
223 $self->{
'translation_id'} = shift
if(@_);
224 return $self->{
'translation_id'};
230 Arg [1] : (optional)
string $phase
231 Example : print $cds->phase();
232 Description: This method returns an integer that describes
233 the phase of the coding feature
243 $self->{
'phase'} = shift
if( @_ );
244 return ( $self->{
'phase'} || 0 );
248 =head2 summary_as_hash
251 Description: Generates a HashRef compatible with GFFSerializer. Adds
252 Parent, source and phase to the basic feature hash
260 sub summary_as_hash {
262 my $hash = $self->SUPER::summary_as_hash();
263 $hash->{
'phase'} = $self->phase();
264 my $parent = $self->transcript();
265 $hash->{
'Parent'} = $parent->display_id
if defined $parent;
266 $hash->{
'source'} = $self->transcript->source()
if $self->transcript();
267 $hash->{
'id'} = $self->translation_id()
if $self->translation_id();
268 $hash->{
'protein_id'} = $self->translation_id()
if $self->translation_id();
269 $hash->{
'version'} = $self->translation()->version()
if $self->translation();