From a2ec8359e798ecc9713dfd1bb3f836168dd6fb09 Mon Sep 17 00:00:00 2001 From: Austin Gillen <4809242+agillen@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:38:41 -0600 Subject: [PATCH 1/2] Update cutadapt_star.snake correct interpretation of basename in _get_fq_paths --- rules/cutadapt_star.snake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/cutadapt_star.snake b/rules/cutadapt_star.snake index 44956f8..6cc1e56 100644 --- a/rules/cutadapt_star.snake +++ b/rules/cutadapt_star.snake @@ -7,7 +7,7 @@ import pandas as pd """ Extract per-sample fastq paths """ def _get_fq_paths(wildcards): - fqs = map(lambda x: os.path.join(DATA, x + "*R1*"), SAMPLES[wildcards.sample]["basename"]) + fqs = map(lambda x: os.path.join(DATA, x + "*R1*"), [SAMPLES[wildcards.sample]["basename"]]) fqs = map(lambda x: glob.glob(x), fqs) fqs = list(chain.from_iterable(fqs)) From 8a4c01d62b3e65731f11773bbefab89adf7c3a24 Mon Sep 17 00:00:00 2001 From: Austin Gillen <4809242+agillen@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:31:58 -0600 Subject: [PATCH 2/2] Update count.snake add bam indexing to filter rules --- rules/count.snake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules/count.snake b/rules/count.snake index 12156b2..8f24f0a 100644 --- a/rules/count.snake +++ b/rules/count.snake @@ -150,6 +150,7 @@ rule filter_R1: if [[ {params.length} == 'False') ]]; then ln -s {input} {output} else + samtools index {input} samtools view -h {input} | grep -v 'CB:Z:-\|UB:Z:-' | samtools view -b - > {params.temp} set +e python3 inst/scripts/filter_bam_correct.py -i {params.temp} -o {params.temp2} -l {params.length} -s -c 20 @@ -183,6 +184,7 @@ rule filter_R2: mem_mb = 8000 shell: """ + samtools index {input} samtools view -h {input} | grep -v 'CB:Z:-\|UB:Z:-' | samtools view -b - > {params.temp} samtools index {params.temp} python3 inst/scripts/filter_bam.py -i {params.temp} -o {output} @@ -213,6 +215,7 @@ rule filter_paired: if [[ {params.length} == 'False') ]]; then ln -s {input} {output} else + samtools index {input} samtools view -h {input} | grep -v 'CB:Z:-\|UB:Z:-' | samtools view -b - > {params.temp} set +e python3 inst/scripts/filter_bam_correct.py -i {params.temp} -o {params.temp2} -l {params.length}