EnsEMBL/Utils/Converter/bio_ens_gene.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 37 CC 2 SCAR 12.0
CC
2
Cov
0%
_convert_single
6.0
_initialize
2.0
BEGIN
2.0
CRAP 3.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 =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_gene
38  
39 =head1 SYNOPISIS
40  
41 =head1 DESCRIPTION
42  
43 This module is to convert from objects of
44 Bio::SeqFeature::Gene::GeneStructure to those of Bio::EnsEMBL::Gene
45  
46 =head1 METHODS
47  
48 =cut
49  
50 package Bio::EnsEMBL::Utils::Converter::bio_ens_gene;
51 $Bio::EnsEMBL::Utils::Converter::bio_ens_gene::VERSION = '114.0.0';
52 use strict;
53 use vars qw(@ISA);
54 use Bio::EnsEMBL::Utils::Converter::bio_ens;
55 @ISA = qw(Bio::EnsEMBL::Utils::Converter::bio_ens);
56  
57 sub _initialize {
58 my ($self, @args) = @_;
59 $self->SUPER::_initialize(@args);
60
61 $self->{_converter_for_transcripts} = new Bio::EnsEMBL::Utils::Converter(
62 -in => 'Bio::SeqFeature::Gene::Transcript',
63 -out => 'Bio::EnsEMBL::Transcript'
64 );
65  
66 }
67  
68 sub _convert_single {
69 my ($self, $input) = @_;
70  
71 unless($input->isa('Bio::SeqFeature::Gene::GeneStructure')){
72 $self->throw("a Bio::SeqFeature::Gene::GeneStructure object needed");
73 }
74 my $gene = $input;
75 my $ens_gene = Bio::EnsEMBL::Gene->new();
76 $ens_gene->analysis($self->analysis);
77 my @transcripts = $gene->transcripts;
78
79 # contig is needed by exon and Supporting Feature; S.F. needs an analysis.
80 $self->{_converter_for_transcripts}->contig($self->contig);
81 $self->{_converter_for_transcripts}->analysis($self->analysis);
82
83 my $ens_transcripts = $self->{_converter_for_transcripts}->convert(
84 \@transcripts);
85
86 foreach(@{$ens_transcripts}){
87 $ens_gene->add_Transcript($_);
88 }
89 return $ens_gene;
90 }
91  
92 1;