Skip to content

Commit

Permalink
updated snp workflow to include log [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
rnmitchell committed Jul 8, 2024
1 parent 3133bae commit 49be971
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lusSTR/workflows/snps.smk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import lusSTR


Expand All @@ -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),
Expand Down Expand Up @@ -49,3 +62,10 @@ rule convert:
thresh=config["thresh"]
script:
lusSTR.wrapper("snps_convert")


onsuccess:
create_log(log)

onerror:
create_log(log)

0 comments on commit 49be971

Please sign in to comment.