Skip to content

Commit

Permalink
Add prefix for final report file and output report also as tsv
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Stöckl committed Sep 30, 2024
1 parent f912930 commit 1de7ef6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ main:
logPath: "logs/"
interimPath: "interim/"
resultPath: "results/"
prefix: "veryImportantSamples" # this prefix will be used to name the final report file

tools:
checkm2:
Expand Down
7 changes: 4 additions & 3 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RESULTPATH = os.path.normpath(config["main"]["resultPath"])

rule all:
input:
os.path.join(RESULTPATH,"final_report.html"),
os.path.join(RESULTPATH,config["main"]["prefix"] + "_final_report.html"),

# Get the number of contigs (=num_seqs) , N50, and length of the largest contig (=max_len)
checkpoint seqkit_stats:
Expand Down Expand Up @@ -324,7 +324,8 @@ rule createReport:
trnascan=expand(rules.trnascan.output, sampleID=SAMPLES),
decipher=rules.decipher.output,
output:
report=os.path.join(RESULTPATH,"final_report.html"),
reportHTML=os.path.join(RESULTPATH,config["main"]["prefix"] + "_final_report.html"),
reportTSV=os.path.join(RESULTPATH,config["main"]["prefix"] + "_final_report.tsv"),
log:
os.path.join(LOGPATH, "common", "logs", "createReport.log"),
params:
Expand All @@ -337,5 +338,5 @@ rule createReport:
os.path.join(workflow.basedir, "envs","r-tools.yaml")
shell:
"""
Rscript {params.script} {input.checkm2} {params.seqkit_stats_dir} {params.samtools_coverage_dir} {input.gtdbtk} {input.decipher} {params.tRNAscan_dir} {output} >{log} 2>&1
Rscript {params.script} {input.checkm2} {params.seqkit_stats_dir} {params.samtools_coverage_dir} {input.gtdbtk} {input.decipher} {params.tRNAscan_dir} {output.reportHTML} {output.reportTSV} >{log} 2>&1
"""
7 changes: 5 additions & 2 deletions workflow/scripts/createReport.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ samtools_coverage_path <- args[3]
gtdbtk_path <- args[4]
decipher_path <- args[5]
tRNAscan_path <- args[6]
outfileReport <- args[7]
outfileReportHTML <- args[7]
outfileReportTSV <- args[8]

# checkm2
checkm2 <- read_tsv(checkm2_path) %>%
Expand Down Expand Up @@ -192,6 +193,8 @@ style_table <- function(combinedDF) {
tab <- style_table(combinedDF)
tab

save_tt(tab, outfileReport, overwrite = TRUE)
save_tt(tab, outfileReportHTML, overwrite = TRUE)

write_tsv(combinedDF, outfileReportTSV)


0 comments on commit 1de7ef6

Please sign in to comment.