ensembl-hive  2.8.1
drosophila.pm
Go to the documentation of this file.
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 package XrefMapper::drosophila;
21 use strict;
22 
24 use vars '@ISA';
25 
26 @ISA = qw{ XrefMapper::BasicMapper };
27 
28 use XrefMapper::BasicMapper qw(%stable_id_to_internal_id %object_xref_mappings %xref_to_source %xref_accessions %source_to_external_db);
29 
30 my %genes_to_transcripts;
31 my %transcript_to_translation;
32 my %translation_to_transcript;
33 my %transcript_length;
34 
35 sub gene_description_filter_regexps {
36 
37  return ();
38 
39 }
40 
41 sub set_methods{
42 
43  my $default_method = 'ExonerateGappedBest1';
44  my %override_method_for_source = (
45  ExonerateGappedBest5 => ['RefSeq_mRNA','RefSeq_mRNA_predicted', 'RefSeq_ncRNA', 'RefSeq_ncRNA_predicted' ],
46  );
47 
48  return $default_method, \%override_method_for_source;
49 }
50 
51 
52 
53 # Special logic for drosophila display_xrefs:
54 #
55 # gene: flybase_name if present, else gadfly_gene_cgid
56 #
57 # transcript: flybase_name if present, else gadfly_transcript_cgid
58 sub xref_offset{
59  my ($self, $val) = @_;
60 
61  if(defined($val)){
62  $self->{'_xref_offset'} = $val;
63  }
64  return $self->{'_xref_offset'};
65 }
66 
67 sub gene_description_sources {
68  return (
69  "FlyBaseName_gene",
70  "FlyBaseCGID_gene",
71  );
72 }
73 
74 sub transcript_display_xref_sources {
75  my $self = shift;
76 
77  my @list = qw(FlyBaseName_transcript
78  FlyBaseCGID_transcript);
79 
80  my %ignore;
81 
82  return [\@list,\%ignore];
83 
84 }
85 
86 sub gene_display_xref_sources {
87  my $self = shift;
88 
89  my @list = qw(FlyBaseName_gene
90  FlyBaseCGID_gene
91  flybase_gene_id);
92 
93  my %ignore;
94 
95 
96  return [\@list,\%ignore];
97 
98 }
99 
100 
101 sub build_genes_to_transcripts {
102 
103  my ($self) = @_;
104 
105  my $sql = "SELECT gene_id, transcript_id, seq_region_start, seq_region_end FROM transcript";
106  my $sth = $self->core->dbc->prepare($sql);
107  $sth->execute();
108 
109  my ($gene_id, $transcript_id, $start, $end);
110  $sth->bind_columns(\$gene_id, \$transcript_id, \$start, \$end);
111 
112  # Note %genes_to_transcripts is global
113  while ($sth->fetch()) {
114  push @{$genes_to_transcripts{$gene_id}}, $transcript_id;
115  $transcript_length{$transcript_id} = $end- $start;
116  }
117 
118 }
119 
120 sub load_translation_to_transcript{
121  my ($self) = @_;
122 
123  my $sth = $self->core->dbc->prepare("SELECT translation_id, transcript_id FROM translation");
124  $sth->execute();
125 
126  my ($translation_id, $transcript_id);
127  $sth->bind_columns(\$translation_id, \$transcript_id);
128 
129  while ($sth->fetch()) {
130  $translation_to_transcript{$translation_id} = $transcript_id;
131  $transcript_to_translation{$transcript_id} = $translation_id if ($translation_id);
132  }
133 }
134 
135 # Want to use FlyBase transcript names, rather than deriving them from genes.
136 sub transcript_names_from_gene {
137  return;
138 }
139 
140 1;
XrefMapper::BasicMapper
Definition: BasicMapper.pm:8