| 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 | =head1 AUTHOR | ||
| 30 | |||
| 31 | Juguang Xiao <juguang@tll.org.sg> | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | =head1 NAME | ||
| 36 | |||
| 37 | Bio::EnsEMBL::Utils::Converter::bio_ens_transcript - the instance converter | ||
| 38 | |||
| 39 | =head1 SYNOPISIS | ||
| 40 | |||
| 41 | =head1 DESCRIPTION | ||
| 42 | |||
| 43 | =head1 METHODS | ||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | package Bio::EnsEMBL::Utils::Converter::bio_ens_transcript; | ||
| 48 | $Bio::EnsEMBL::Utils::Converter::bio_ens_transcript::VERSION = '114.0.0'; | ||
| 49 | use strict; | ||
| 50 | use vars qw(@ISA); | ||
| 51 | use Bio::EnsEMBL::Transcript; | ||
| 52 | use Bio::EnsEMBL::Utils::Converter::bio_ens; | ||
| 53 | @ISA = qw(Bio::EnsEMBL::Utils::Converter::bio_ens); | ||
| 54 | |||
| 55 | sub _convert_single { | ||
| 56 | my ($self, $arg) = @_; | ||
| 57 | unless($arg->isa('Bio::SeqFeature::Gene::Transcript')){ | ||
| 58 | $self->throw("A Bio::SeqFeature::Gene::Transcript object needed"); | ||
| 59 | } | ||
| 60 | my $transcript = $arg; | ||
| 61 | |||
| 62 | my @exons = $transcript->exons_ordered; | ||
| 63 | $self->{_converter_for_exons}->contig($self->contig); | ||
| 64 | $self->{_converter_for_exons}->analysis($self->analysis); | ||
| 65 | |||
| 66 | my $ens_exons = $self->{_converter_for_exons}->convert(\@exons); | ||
| 67 | |||
| 68 | my $ens_transcript = Bio::EnsEMBL::Transcript->new(@{$ens_exons}); | ||
| 69 | $ens_transcript->start($transcript->start); | ||
| 70 | $ens_transcript->end($transcript->end); | ||
| 71 | # $ens_transcript->strand($transcript->strand); | ||
| 72 | return $ens_transcript; | ||
| 73 | } | ||
| 74 | |||
| 75 | |||
| 76 | sub _initialize { | ||
| 77 | my ($self, @args) = @_; | ||
| 78 | $self->SUPER::_initialize(@args); | ||
| 79 | |||
| 80 | $self->{_converter_for_exons} = new Bio::EnsEMBL::Utils::Converter( | ||
| 81 | -in => 'Bio::SeqFeature::Gene::Exon', | ||
| 82 | -out => 'Bio::EnsEMBL::Exon' | ||
| 83 | ); | ||
| 84 | |||
| 85 | } | ||
| 86 |