EnsEMBL/IdMapping/InternalIdMapper/EnsemblGeneGeneric.pm untested

filter: Statementstmt 0.0% 0 / 101 Branchbran 0.0% 0 / 10 Conditioncond n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 129 CC 6 SCAR 14.7
CC
6
Cov
0%
synteny
6.0
best_transcript
6.0
biotype
6.0
CRAP 4.4
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::IdMapping::InternalIdMapper::EnsemblGeneGeneric - default Ensembl
34 InternalIdMapper implementation for genes
35  
36 =head1 SYNOPSIS
37  
38 =head1 DESCRIPTION
39  
40 =head1 METHODS
41  
42 =cut
43  
44 package Bio::EnsEMBL::IdMapping::InternalIdMapper::EnsemblGeneGeneric;
45 $Bio::EnsEMBL::IdMapping::InternalIdMapper::EnsemblGeneGeneric::VERSION = '114.0.0_50'; # TRIAL
46 $Bio::EnsEMBL::IdMapping::InternalIdMapper::EnsemblGeneGeneric::VERSION = '114.0.050';
47 use strict;
48 use warnings;
49 no warnings 'uninitialized';
50  
51 use Bio::EnsEMBL::IdMapping::InternalIdMapper::BaseMapper;
52 our @ISA = qw(Bio::EnsEMBL::IdMapping::InternalIdMapper::BaseMapper);
53  
54 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
55 use Bio::EnsEMBL::Utils::ScriptUtils qw(path_append);
56  
57  
58 #
59 # basic mapping
60 #
61 sub init_basic {
62 my $self = shift;
63 my $num = shift;
64 my $gsb = shift;
65 my $mappings = shift;
66 my $gene_scores = shift;
67  
68 $self->logger->info("Basic gene mapping...\n", 0, 'stamped');
69  
70 $mappings = $self->basic_mapping($gene_scores, "gene_mappings$num");
71 $num++;
72 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $mappings,
73 "gene_matrix$num");
74  
75 return ($new_scores, $mappings);
76 }
77  
78  
79 #
80 # build the synteny from unambiguous mappings
81 #
82 sub synteny {
83 my $self = shift;
84 my $num = shift;
85 my $gsb = shift;
86 my $mappings = shift;
87 my $gene_scores = shift;
88  
89 unless ($gene_scores->loaded) {
90 $self->logger->info("Synteny Framework building...\n", 0, 'stamped');
91 my $dump_path = path_append($self->conf->param('basedir'), 'mapping');
92 my $sf = Bio::EnsEMBL::IdMapping::SyntenyFramework->new(
93 -DUMP_PATH => $dump_path,
94 -CACHE_FILE => 'synteny_framework.ser',
95 -LOGGER => $self->logger,
96 -CONF => $self->conf,
97 -CACHE => $self->cache,
98 );
99 $sf->build_synteny($mappings);
100  
101 # use it to rescore the genes
102 $self->logger->info("\nSynteny assisted mapping...\n", 0, 'stamped');
103 $gene_scores = $sf->rescore_gene_matrix_lsf($gene_scores);
104  
105 # checkpoint
106 $gene_scores->write_to_file;
107 }
108  
109 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num");
110 $num++;
111 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings,
112 "gene_matrix$num");
113  
114 return ($new_scores, $new_mappings);
115 }
116  
117  
118 #
119 # rescore with simple scoring function and try again
120 #
121 sub best_transcript {
122 my $self = shift;
123 my $num = shift;
124 my $gsb = shift;
125 my $mappings = shift;
126 my $gene_scores = shift;
127 my $transcript_scores = shift;
128  
129 $self->logger->info("Retry with simple best transcript score...\n", 0, 'stamped');
130
131 unless ($gene_scores->loaded) {
132 $gsb->simple_gene_rescore($gene_scores, $transcript_scores);
133 $gene_scores->write_to_file;
134 }
135
136 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num");
137 $num++;
138 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings,
139 "gene_matrix$num");
140  
141 return ($new_scores, $new_mappings);
142 }
143  
144  
145 #
146 # rescore by penalising scores between genes with different biotypes
147 #
148 sub biotype {
149 my $self = shift;
150 my $num = shift;
151 my $gsb = shift;
152 my $mappings = shift;
153 my $gene_scores = shift;
154  
155 $self->logger->info("Retry with biotype disambiguation...\n", 0, 'stamped');
156
157 unless ($gene_scores->loaded) {
158 $gsb->biotype_gene_rescore($gene_scores);
159 $gene_scores->write_to_file;
160 }
161  
162 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num");
163 $num++;
164 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings,
165 "gene_matrix$num");
166  
167 return ($new_scores, $new_mappings);
168 }
169  
170 sub location {
171 my $self = shift;
172 my $num = shift;
173 my $gsb = shift;
174 my $mappings = shift;
175 my $gene_scores = shift;
176  
177 $self->logger->info("Retry with location disambiguation...\n", 0, 'stamped');
178  
179 unless ($gene_scores->loaded) {
180 $gsb->location_gene_rescore($gene_scores);
181 $gene_scores->write_to_file;
182 }
183  
184 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num");
185 $num++;
186 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings,
187 "gene_matrix$num");
188  
189 return ($new_scores, $new_mappings);
190  
191 }
192  
193  
194 #
195 # selectively rescore by penalising scores between genes with different
196 # internalIDs
197 #
198 sub internal_id {
199 my $self = shift;
200 my $num = shift;
201 my $gsb = shift;
202 my $mappings = shift;
203 my $gene_scores = shift;
204  
205 $self->logger->info("Retry with internalID disambiguation...\n", 0, 'stamped');
206
207 unless ($gene_scores->loaded) {
208 $gsb->internal_id_rescore($gene_scores);
209 $gene_scores->write_to_file;
210 }
211  
212 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num");
213 $num++;
214 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings,
215 "gene_matrix$num");
216  
217 return ($new_scores, $new_mappings);
218 }
219  
220  
221 1;
222