From: elserj Date: Tue, 20 Oct 2015 00:46:08 +0000 (+0000) Subject: Add check to see if table exists, and skip ahead if it doesn't X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=8e1e6bf7eba2d9cf4e6d1fdbe59e1e7c00295f72;p=old-jaiswallab-svn%2F.git Add check to see if table exists, and skip ahead if it doesn't svn path=/; revision=636 --- diff --git a/interactome_scripts/supercluster.pl b/interactome_scripts/supercluster.pl index ba14deb..dd986b2 100755 --- a/interactome_scripts/supercluster.pl +++ b/interactome_scripts/supercluster.pl @@ -88,6 +88,14 @@ my %big_count_hash; my $num_species = @species; +my @tables = $dbh->tables(); +my %table_hash; +foreach my $table (@tables) { + my ($db,$table_name) = split ('`.`', $table); + $table_name =~ s/`$//; + $table_hash{$table_name} = $table_name; +} + for (my $i=0; $i<$num_species-1; $i++) { print "Working on species: $species[$i]\n"; @@ -109,13 +117,22 @@ for (my $i=0; $i<$num_species-1; $i++) { # $species_2 = $spec_temp; # print "non optimal order\n"; # } - - + + # create the statement handler to pull the species-pair data my $spec_table = "$species_1" . "_" . "$species_2"; my $safe_species_table = $dbh->quote_identifier($spec_table); + + # Check to make sure table exists and skip if it doesn't + if(!defined($table_hash{$spec_table})) { + next; + } + + my $sth = $dbh->prepare("select * from $safe_species_table"); + + my $id_prev = "";