Skip to content
Snippets Groups Projects
Commit 594987de authored by Steve Trevanion's avatar Steve Trevanion
Browse files

merge from vega-41-dev

parent d5acf644
No related branches found
No related tags found
No related merge requests found
...@@ -108,106 +108,63 @@ if($support->param('prune')){ ...@@ -108,106 +108,63 @@ if($support->param('prune')){
if(check_for_backup_table()){ if(check_for_backup_table()){
# backup table present # backup table present
if($support->user_proceed("Replace the current table 'repeat_consensus' with the backup table 'repeat_consensus_backup'?")){ if($support->user_proceed("Replace the current table 'repeat_consensus' with the backup table 'repeat_consensus_backup'?")){
if($dbh->do("drop table repeat_consensus")){
if($dbh->do("drop table repeat_consensus")){ if($dbh->do("create table repeat_consensus select * from repeat_consensus_backup")){
$support->log("prune (undo) was successful\n");
if($dbh->do("create table repeat_consensus select * from repeat_consensus_backup")){
$support->log("prune (undo) was successful\n");
$support->log_stamped("Done.\n"); $support->log_stamped("Done.\n");
# finish logfile # finish logfile
$support->finish_log; $support->finish_log;
exit(0);
exit(0);
}
else{
$support->log_error("prune failed\n");
} }
else {
} $support->log_error("prune failed\n");
else{ }
$support->log_error("prune failed\n");
} }
else {
$support->log_error("prune failed\n");
}
} }
else{ else{
#user is aborting #user is aborting
print "aborting...\n"; print "aborting...\n";
$support->log_error("aborting...\n"); $support->log_error("aborting...\n");
}
}
} }
else{ else{
print "Cannot do prune, as no backup table\n"; print "Cannot do prune, as no backup table\n";
$support->log_error("Cannot do prune, as no backup table\n"); $support->log_error("Cannot do prune, as no backup table\n");
} }
} }
else{ else{
# normal run # normal run
# check to see if the backup table 'repeat_consensus_backup' already exists # check to see if the backup table 'repeat_consensus_backup' already exists
if(check_for_backup_table()){ if(check_for_backup_table()){
#table already exists: ask user if OK to overwrite it #table already exists: ask user if OK to overwrite it
if ($support->user_proceed("The backup table 'repeat_consensus_backup' already exists, OK to delete?")) { if ($support->user_proceed("The backup table 'repeat_consensus_backup' already exists, OK to delete?")) {
if($dbh->do("drop table 'repeat_consensus_backup'")){ if($dbh->do("drop table 'repeat_consensus_backup'")){
$support->log("deleted previous backup table\n"); $support->log("deleted previous backup table\n");
make_backup_table(); make_backup_table();
} }
else{ else{
$support->log_error("tried but failed to delete previous backup table\n"); $support->log_error("tried but failed to delete previous backup table\n");
} }
} }
else{ else{
# user won't allow removing the backup table # user won't allow removing the backup table
print "Aborting ...\n"; print "Aborting ...\n";
$support->log_error("User won't allow removal of backup table ... aborting program\n"); $support->log_error("User won't allow removal of backup table ... aborting program\n");
} }
}else{ }else{
# table doesn't exist, therefore we can create it # table doesn't exist, therefore we can create it
make_backup_table(); make_backup_table();
} }
} }
# mouse fixes # mouse fixes
if ($support->species eq 'Mus_musculus') { if ($support->species eq 'Mus_musculus') {
$support->log("Making Vega mouse specific changes...\n"); $support->log("Making Vega mouse specific changes...\n");
...@@ -299,15 +256,11 @@ $support->finish_log; ...@@ -299,15 +256,11 @@ $support->finish_log;
sub make_backup_table{ sub make_backup_table{
if($dbh->do("create table repeat_consensus_backup select * from repeat_consensus")){ if($dbh->do("create table repeat_consensus_backup select * from repeat_consensus")){
$support->log("backup table 'repeat_consensus_backup was created successfully\n"); $support->log("backup table 'repeat_consensus_backup was created successfully\n");
} }
else{ else{
$support->log_error("failed to create backup table 'repeat_consensus_backup'\n"); $support->log_error("failed to create backup table 'repeat_consensus_backup'\n");
} }
} }
sub check_for_backup_table{ sub check_for_backup_table{
...@@ -318,18 +271,10 @@ sub check_for_backup_table{ ...@@ -318,18 +271,10 @@ sub check_for_backup_table{
foreach my $table(@tables){ foreach my $table(@tables){
#print "$table\n"; #print "$table\n";
if($table eq '`repeat_consensus_backup`'){ if($table eq '`repeat_consensus_backup`'){
$found=1; $found=1;
last; last;
}
}
} }
return $found; return $found;
}
}
\ No newline at end of file
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