From a24286702e1ee07800bf3b3438b2f67df4f01933 Mon Sep 17 00:00:00 2001 From: Ian Longden <ianl@sanger.ac.uk> Date: Tue, 29 Sep 2009 12:54:19 +0000 Subject: [PATCH] if noxref_database is specified do not try to write to the xref database. Needed for -recalc_display_xrefs option --- .../xref_mapping/XrefMapper/DisplayXrefs.pm | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm b/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm index 2c131d1f58..537ab4c782 100644 --- a/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm +++ b/misc-scripts/xref_mapping/XrefMapper/DisplayXrefs.pm @@ -120,18 +120,26 @@ sub genes_and_transcripts_attributes_set{ # build_meta_timestamp, and, if "-upload" is set, uses the SQL files # produced to update the core database. - my ($self,$fullmode) = @_; + my ($self, $fullmode, $noxref_database) = @_; - my $status = $self->mapper->xref_latest_status(); - + my $status; + if(defined($noxref_database)){ + $status = "none"; + } + else{ + $status = $self->mapper->xref_latest_status(); + } + if(!$fullmode){ if($status ne "display_xref_done"){ $self->build_transcript_and_gene_display_xrefs(); - my $sth_stat = $self->xref->dbc->prepare("insert into process_status (status, date) values('display_xref_done',now())"); - $sth_stat->execute(); - $sth_stat->finish; + if(!defined($noxref_database)){ + my $sth_stat = $self->xref->dbc->prepare("insert into process_status (status, date) values('display_xref_done',now())"); + $sth_stat->execute(); + $sth_stat->finish; + } } @@ -149,10 +157,12 @@ sub genes_and_transcripts_attributes_set{ $self->build_meta_timestamp; - my $sth_stat = $self->xref->dbc->prepare("insert into process_status (status, date) values('gene_description_done',now())"); - $sth_stat->execute(); - $sth_stat->finish; - + if(!defined($noxref_database)){ + my $sth_stat = $self->xref->dbc->prepare("insert into process_status (status, date) values('gene_description_done',now())"); + $sth_stat->execute(); + $sth_stat->finish; + } + return 1; } @@ -722,6 +732,7 @@ GSQL if ($filtered_description ne "") { $xref_descriptions{$xref_id} = $description; $xref_accessions{$xref_id} = $acc; + $ex_db{$xref_id} = $ex_db_id; if($level{$ex_db_id} > $best_gene_level){ $best_gene_xref = $xref_id; $best_gene_level = $level{$ex_db_id}; @@ -885,6 +896,9 @@ GSQL $description =~ s/\"//ig; # remove " as they will cause problems in .sql files + if(!defined($ex_db_id_to_display_name{$ex_db{$best_gene_xref}})){ + print STDERR "Could not find display name for gene $best_gene_xref for external db ".$ex_db{$best_gene_xref}."\n"; + } my $desc = $description . " [Source:".$ex_db_id_to_display_name{$ex_db{$best_gene_xref}}.";Acc:$acc]"; $update_gene_desc_sth->execute($desc, $gene_id) if($description); -- GitLab