Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/IdMapping/InternalIdMapper/EnsemblGeneGeneric.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 =head1 LICENSE | |
2 | |
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
4 Genome Research Limited. All rights reserved. | |
5 | |
6 This software is distributed under a modified Apache license. | |
7 For license details, please see | |
8 | |
9 http://www.ensembl.org/info/about/code_licence.html | |
10 | |
11 =head1 CONTACT | |
12 | |
13 Please email comments or questions to the public Ensembl | |
14 developers list at <dev@ensembl.org>. | |
15 | |
16 Questions may also be sent to the Ensembl help desk at | |
17 <helpdesk@ensembl.org>. | |
18 | |
19 =cut | |
20 | |
21 =head1 NAME | |
22 | |
23 Bio::EnsEMBL::IdMapping::InternalIdMapper::EnsemblGeneGeneric - default Ensembl | |
24 InternalIdMapper implementation for genes | |
25 | |
26 =head1 SYNOPSIS | |
27 | |
28 =head1 DESCRIPTION | |
29 | |
30 =head1 METHODS | |
31 | |
32 =cut | |
33 | |
34 package Bio::EnsEMBL::IdMapping::InternalIdMapper::EnsemblGeneGeneric; | |
35 | |
36 use strict; | |
37 use warnings; | |
38 no warnings 'uninitialized'; | |
39 | |
40 use Bio::EnsEMBL::IdMapping::InternalIdMapper::BaseMapper; | |
41 our @ISA = qw(Bio::EnsEMBL::IdMapping::InternalIdMapper::BaseMapper); | |
42 | |
43 use Bio::EnsEMBL::Utils::Exception qw(throw warning); | |
44 use Bio::EnsEMBL::Utils::ScriptUtils qw(path_append); | |
45 | |
46 | |
47 # | |
48 # basic mapping | |
49 # | |
50 sub init_basic { | |
51 my $self = shift; | |
52 my $num = shift; | |
53 my $gsb = shift; | |
54 my $mappings = shift; | |
55 my $gene_scores = shift; | |
56 | |
57 $self->logger->info("Basic gene mapping...\n", 0, 'stamped'); | |
58 | |
59 $mappings = $self->basic_mapping($gene_scores, "gene_mappings$num"); | |
60 $num++; | |
61 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $mappings, | |
62 "gene_matrix$num"); | |
63 | |
64 return ($new_scores, $mappings); | |
65 } | |
66 | |
67 | |
68 # | |
69 # build the synteny from unambiguous mappings | |
70 # | |
71 sub synteny { | |
72 my $self = shift; | |
73 my $num = shift; | |
74 my $gsb = shift; | |
75 my $mappings = shift; | |
76 my $gene_scores = shift; | |
77 | |
78 unless ($gene_scores->loaded) { | |
79 $self->logger->info("Synteny Framework building...\n", 0, 'stamped'); | |
80 my $dump_path = path_append($self->conf->param('basedir'), 'mapping'); | |
81 my $sf = Bio::EnsEMBL::IdMapping::SyntenyFramework->new( | |
82 -DUMP_PATH => $dump_path, | |
83 -CACHE_FILE => 'synteny_framework.ser', | |
84 -LOGGER => $self->logger, | |
85 -CONF => $self->conf, | |
86 -CACHE => $self->cache, | |
87 ); | |
88 $sf->build_synteny($mappings); | |
89 | |
90 # use it to rescore the genes | |
91 $self->logger->info("\nSynteny assisted mapping...\n", 0, 'stamped'); | |
92 $gene_scores = $sf->rescore_gene_matrix_lsf($gene_scores); | |
93 | |
94 # checkpoint | |
95 $gene_scores->write_to_file; | |
96 } | |
97 | |
98 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num"); | |
99 $num++; | |
100 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings, | |
101 "gene_matrix$num"); | |
102 | |
103 return ($new_scores, $new_mappings); | |
104 } | |
105 | |
106 | |
107 # | |
108 # rescore with simple scoring function and try again | |
109 # | |
110 sub best_transcript { | |
111 my $self = shift; | |
112 my $num = shift; | |
113 my $gsb = shift; | |
114 my $mappings = shift; | |
115 my $gene_scores = shift; | |
116 my $transcript_scores = shift; | |
117 | |
118 $self->logger->info("Retry with simple best transcript score...\n", 0, 'stamped'); | |
119 | |
120 unless ($gene_scores->loaded) { | |
121 $gsb->simple_gene_rescore($gene_scores, $transcript_scores); | |
122 $gene_scores->write_to_file; | |
123 } | |
124 | |
125 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num"); | |
126 $num++; | |
127 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings, | |
128 "gene_matrix$num"); | |
129 | |
130 return ($new_scores, $new_mappings); | |
131 } | |
132 | |
133 | |
134 # | |
135 # rescore by penalising scores between genes with different biotypes | |
136 # | |
137 sub biotype { | |
138 my $self = shift; | |
139 my $num = shift; | |
140 my $gsb = shift; | |
141 my $mappings = shift; | |
142 my $gene_scores = shift; | |
143 | |
144 $self->logger->info("Retry with biotype disambiguation...\n", 0, 'stamped'); | |
145 | |
146 unless ($gene_scores->loaded) { | |
147 $gsb->biotype_gene_rescore($gene_scores); | |
148 $gene_scores->write_to_file; | |
149 } | |
150 | |
151 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num"); | |
152 $num++; | |
153 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings, | |
154 "gene_matrix$num"); | |
155 | |
156 return ($new_scores, $new_mappings); | |
157 } | |
158 | |
159 | |
160 # | |
161 # selectively rescore by penalising scores between genes with different | |
162 # internalIDs | |
163 # | |
164 sub internal_id { | |
165 my $self = shift; | |
166 my $num = shift; | |
167 my $gsb = shift; | |
168 my $mappings = shift; | |
169 my $gene_scores = shift; | |
170 | |
171 $self->logger->info("Retry with internalID disambiguation...\n", 0, 'stamped'); | |
172 | |
173 unless ($gene_scores->loaded) { | |
174 $gsb->internal_id_rescore($gene_scores); | |
175 $gene_scores->write_to_file; | |
176 } | |
177 | |
178 my $new_mappings = $self->basic_mapping($gene_scores, "gene_mappings$num"); | |
179 $num++; | |
180 my $new_scores = $gsb->create_shrinked_matrix($gene_scores, $new_mappings, | |
181 "gene_matrix$num"); | |
182 | |
183 return ($new_scores, $new_mappings); | |
184 } | |
185 | |
186 | |
187 1; | |
188 |