Skip to content
Snippets Groups Projects
Commit 7918612d authored by Ian Longden's avatar Ian Longden
Browse files

dump dependent xref synonyms

parent db9e81ca
No related branches found
No related tags found
No related merge requests found
......@@ -1235,6 +1235,17 @@ sub dump_core_xrefs {
# build cache of source id -> external_db id; note %source_to_external_db is global
%source_to_external_db = $self->map_source_to_external_db();
my $sql_syn= "select s.xref_id, s.synonym ";
$sql_syn .= " from xref x, synonym s, dependent_xref d ";
$sql_syn .= " where d.dependent_xref_id = x.xref_id and ";
$sql_syn .= " s.xref_id = x.xref_id and ";
$sql_syn .= " x.xref_id = ?";
my $dep_syn_sth = $self->xref->dbc->prepare($sql_syn);
# execute several queries with a max of 200 entries in each IN clause - more efficient
my $batch_size = 200;
......@@ -1299,6 +1310,7 @@ sub dump_core_xrefs {
my $external_db_id = $source_to_external_db{$source_id};
next if (!$external_db_id);
$label = $accession if (!$label);
if (!$xrefs_written{$xref_id}) {
......@@ -1306,6 +1318,16 @@ sub dump_core_xrefs {
$xrefs_written{$xref_id} = 1;
$source_ids{$source_id} = $source_id;
}
#dump synonyms for dependent_xref
$dep_syn_sth->execute($xref_id);
my ($syn_xref, $syn);
$dep_syn_sth->bind_columns(\$syn_xref, \$syn);
while ($dep_syn_sth->fetch()) {
print EXTERNAL_SYNONYM ($syn_xref+$xref_id_offset) . "\t" .$syn."\n";
}
# create an object_xref linking this (dependent) xref with any objects it maps to
# write to file and add to object_xref_mappings
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment