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
31 Juguang Xiao <juguang@tll.org.sg>
47 package Bio::EnsEMBL::Utils::Converter::bio_ens_predictionGene;
57 my ($self, @args) = @_;
60 -in =>
'Bio::SeqFeature::Gene::Exon',
61 -out =>
'Bio::EnsEMBL::Exon',
63 $self->SUPER::_initialize(@args);
65 $self->{_predictionExonConverter}->contig($self->contig);
66 $self->{_predictionExonConverter}->analysis($self->analysis);
70 my ($self, $input) = @_;
72 $self->throw(
"one argument needed") unless($input and defined($input));
73 $self->throw(
"a Bio::Tools::Prediction::Gene object needed")
74 unless(ref($input) && $input->isa(
'Bio::Tools::Prediction::Gene'));
79 my @exons = sort {$a->start <=> $b->start} $input->exons;
81 # Not sure on the correctivity of phase calculation.
82 my $previous_end_phase = -1;
84 my $length = $_->length;
85 my $frame = $_->frame;
86 my $phase = ($previous_end_phase+1) %3;
87 my $end_phase = ($length-$frame) %1;
88 $previous_end_phase = $end_phase;
89 $_->add_tag_value(
"phase", $phase);
90 $_->add_tag_value(
"end_phase", $end_phase);
93 my @ens_exons = @{$self->{_predictionExonConverter}->convert(\@exons)};
95 $output->add_Exon($_)
foreach(@ens_exons);
103 Usage : $self->contig
104 Function: get and set
for contig
105 Return : L<Bio::EnsEMBL::RawContig>
106 Args : L<Bio::EnsEMBL::RawContig>
110 my ($self, $arg) = @_;
112 $self->throws(
"A Bio::EnsEMBL::RawContig object expected.") unless(defined $arg);
113 $self->{_contig} = $arg;
114 # assign it to the sub converter which converts exons
115 $self->{_predictionExonConverter}->contig($arg);
117 return $self->{_contig};