From 5fd827b1d767d4265168356eaf66b1299fd0a738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Wed, 19 Oct 2011 10:49:04 +0000 Subject: [PATCH] Make this deal with release 65 schemas. --- modules/Bio/EnsEMBL/IdMapping/Cache.pm | 41 +++++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/modules/Bio/EnsEMBL/IdMapping/Cache.pm b/modules/Bio/EnsEMBL/IdMapping/Cache.pm index 0c33503817..bdcb08f759 100644 --- a/modules/Bio/EnsEMBL/IdMapping/Cache.pm +++ b/modules/Bio/EnsEMBL/IdMapping/Cache.pm @@ -791,7 +791,8 @@ sub check_empty_tables { } eval { - my @tables = qw( + my @tables = + qw( gene_stable_id transcript_stable_id translation_stable_id @@ -804,18 +805,42 @@ sub check_empty_tables { my $dba = $self->get_DBAdaptor($dbtype); foreach my $table (@tables) { - if ($c = $self->fetch_value_from_db($dba, "SELECT COUNT(*) FROM $table")) { - $self->logger->warning("$table table in $dbtype db has $c entries.\n"); - $err++; + if ( $table =~ /^([^_]+)_stable_id/ ) { + $table = $1; + if ( $c = + $self->fetch_value_from_db( + $dba, + "SELECT COUNT(*) FROM $table WHERE stable_id IS NOT NULL" + ) ) + { + $self->logger->warning( + "$table table in $dbtype db has $c stable IDs.\n"); + $err++; + } } - } + else { + if ( $c = + $self->fetch_value_from_db( + $dba, "SELECT COUNT(*) FROM $table" + ) ) + { + $self->logger->warning( + "$table table in $dbtype db has $c entries.\n"); + $err++; + } + } + } ## end foreach my $table (@tables) }; if ($@) { - $self->logger->warning("Error retrieving stable ID and archive table row counts from $dbtype db: $@\n"); + $self->logger->warning( +"Error retrieving stable ID and archive table row counts from $dbtype db: $@\n" + ); $err++; - } elsif (!$err) { - $self->logger->debug("All stable ID and archive tables in $dbtype db are empty.\n"); + } + elsif ( !$err ) { + $self->logger->debug( + "All stable ID and archive tables in $dbtype db are empty.\n"); } return $err; } -- GitLab