Skip to content

Commit

Permalink
add cleanups when exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
jluebeck committed Apr 19, 2024
1 parent dbaf0d1 commit cd1b1d7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/AmpliconSuiteAggregatorFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,22 @@ def run_amp_classifier(self):
AC_SRC = os.environ['AC_SRC']
except KeyError:
sys.stderr.write("AC_SRC variable not found! AmpliconClassifier is not properly installed.\n")
self.cleanup()
sys.exit(1)

print(f"AC_SRC is set to {AC_SRC}")
input_ec = os.system(f"{AC_SRC}/make_input.sh {OUTPUT_PATH} {OUTPUT_PATH}/{self.output_name}")
if input_ec != 0:
print("Failed to make input for AC!")
self.cleanup()
sys.exit(1)

## if reference isn't downloaded already, then download appropriate reference genome
try:
local_data_repo = os.environ['AA_DATA_REPO']
except KeyError:
sys.stderr.write("AA_DATA_REPO variable not found! The AA data repo directory is not properly configured.\n")
self.cleanup()
sys.exit(1)

if not os.path.exists(os.path.join(local_data_repo, self.ref)):
Expand Down Expand Up @@ -410,6 +413,7 @@ def json_modifications(self):
sys.stderr.write(str(ref_genomes) + "\n")
sys.stderr.write("ERROR! Multiple reference genomes detected in project.\n AmpliconRepository only "
"supports single-reference projects currently. Exiting.\n")
self.cleanup()
sys.exit(1)

potential_str_lsts = [
Expand Down

0 comments on commit cd1b1d7

Please sign in to comment.