From a8f5e66eb9aa869b3f1a4bcbe1e44953b527521c Mon Sep 17 00:00:00 2001 From: Pavel Dimens Date: Tue, 11 May 2021 13:40:11 -0400 Subject: [PATCH] fix trimming rules --- rules/trim.smk | 14 +++++++++----- scripts/LepWrapQA.r | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/rules/trim.smk b/rules/trim.smk index 147ae4d..9f42242 100644 --- a/rules/trim.smk +++ b/rules/trim.smk @@ -24,17 +24,21 @@ rule trim_summary: input: expand("5_Trim/ordered.{lg}.trimmed", lg = lg_range) output: - "5_Trim/trim.summary" + detailed = "5_Trim/trim.details", + summary = "5_Trim/trim.summary" message: "Summarizing trim logs >> {output}" priority: 1 shell: """ - echo "# this is a summary of which markers were removed from which linkage group via trimming distant edge clusters" >> {output} - echo -e "LG\trm_marker" >> {output} + echo "# this is a summary of which markers were removed from which linkage group via trimming distant edge clusters" >> {output.detailed} + echo -e "LG\trm_marker" >> {output.detailed} for each in 5_Trim/logs/ordered.*.removed ; do BASE=$(basename $each | cut -d "." -f1,2) - sed -e "s/^/$BASE /" $each >> {output}.tmp + sed -e "s/^/$BASE /" $each >> {output.detailed}.tmp done - sort -V {output}.tmp > {output} && rm {output}.tmp + sort -V {output.detailed}.tmp > {output.detailed} && rm {output.detailed}.tmp + echo "n_removed map" > {output.summary}.tmp + cut -d" " -f1 {output.detailed} | uniq -c >> {output.summary}.tmp + column -t {output.summary}.tmp > {output.summary} && rm {output.summary}.tmp """ diff --git a/scripts/LepWrapQA.r b/scripts/LepWrapQA.r index 601ca6f..9e6efac 100755 --- a/scripts/LepWrapQA.r +++ b/scripts/LepWrapQA.r @@ -30,8 +30,8 @@ filename_trunc <- paste(filename_trunc[1], filename_trunc[2], sep = ".") # instantiate QC columns lgfile$Mpass <- c(TRUE) lgfile$Fpass <- c(TRUE) -outfile_base <- paste(path, "4_OrderMarkers", "best.trim", filename_trunc, sep = "/") -outfile_log_base <- paste(path, "4_OrderMarkers", "logs/trimming", filename_trunc, sep = "/") +outfile_base <- paste(path, "5_Trim", filename_trunc, sep = "/") +outfile_log_base <- paste(path, "5_Trim", "logs", filename_trunc, sep = "/") #========= PDF instantiation ========# PDFPath <- paste(outfile_log_base, "trim.pdf", sep = ".")