3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
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
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.
20 package XrefMapper::CoreInfo;
34 # Get info from the core database.
36 # Need to load tables:-
38 # gene_transcript_translation
40 # transcript_stable_id
41 # translation_stable_id
45 my($class, $mapper) = @_;
49 $self->
core($mapper->core);
50 $self->xref($mapper->xref);
51 $self->verbose($mapper->verbose);
60 # gene_transcript_translation
62 # transcript_stable_id
63 # translation_stable_id
66 # load table gene_transcript_translation
68 $self->load_gene_transcript_translation();
70 # load table xxx_stable_id
72 $self->load_stable_ids();
75 my $sth = $self->xref->
dbc->prepare(
"insert into process_status (status, date) values('core_data_loaded',now())");
84 sub load_gene_transcript_translation{
87 my $ins_sth = $self->xref->dbc->prepare(
"insert ignore into gene_transcript_translation (gene_id, transcript_id, translation_id) values (?, ?, ?)");
89 my $sql =
"select tn.gene_id, tn.transcript_id, tl.translation_id from transcript tn left join translation tl on tl.transcript_id = tn.transcript_id";
90 my $sth = $self->core->dbc->prepare($sql);
92 my ($gene_id, $transcript_id, $translation_id);
93 $sth->bind_columns(\$gene_id, \$transcript_id, \$translation_id);
95 $ins_sth->execute($gene_id, $transcript_id, $translation_id);
105 my ($id, $stable_id, $biotype);
106 foreach my $table (qw(gene translation)){
108 my $sth = $self->core->dbc->prepare(
"select ".$table.
"_id, stable_id from ".$table);
109 my $ins_sth = $self->xref->dbc->prepare(
"insert ignore into ".$table.
"_stable_id (internal_id, stable_id) values(?, ?)");
111 $sth->bind_columns(\$id, \$stable_id);
113 $ins_sth->execute($id, $stable_id);
119 #populate transcript_stable_id table incuding the biotype column
120 my $table =
"transcript";
121 my $sth = $self->core->dbc->prepare(
"select ".$table.
"_id, stable_id, biotype from ".$table);
122 my $ins_sth = $self->xref->dbc->prepare(
"insert ignore into ".$table.
"_stable_id (internal_id, stable_id, biotype) values(?, ?, ?)");
124 $sth->bind_columns(\$id, \$stable_id, \$biotype);
126 $ins_sth->execute($id, $stable_id, $biotype);