diff --git a/lusSTR/workflows/snps.smk b/lusSTR/workflows/snps.smk index 026a561..2632fbb 100644 --- a/lusSTR/workflows/snps.smk +++ b/lusSTR/workflows/snps.smk @@ -1,3 +1,4 @@ +from datetime import datetime import lusSTR @@ -14,6 +15,18 @@ def format_filename(id, refs): return f"{id}_snp_reference" +def create_log(log): + now = datetime.now() + dt = now.strftime("%m%d%Y_%H_%M_%S") + shell("mkdir -p logs/{dt}/input/") + shell("cp {log} logs/{dt}/strs.log") + if os.path.isdir(input_name): + shell("cp {input_name}/* logs/{dt}/input/") + else: + shell("cp '{input_name}' logs/{dt}/input/") + shell("cp snp_config.yaml logs/{dt}/") + + rule all: input: expand("{name}.txt", name=output_name), @@ -49,3 +62,10 @@ rule convert: thresh=config["thresh"] script: lusSTR.wrapper("snps_convert") + + +onsuccess: + create_log(log) + +onerror: + create_log(log) \ No newline at end of file