From d4aee0aa300fba32dbb5ec8a0583ded71b8e5fe3 Mon Sep 17 00:00:00 2001 From: pdimens Date: Tue, 30 Apr 2024 13:52:53 -0400 Subject: [PATCH] simplify rules --- src/harpy/rules/demultiplex.gen1.smk | 33 ++-------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/harpy/rules/demultiplex.gen1.smk b/src/harpy/rules/demultiplex.gen1.smk index 399d9ae52..b8c1ad2cb 100644 --- a/src/harpy/rules/demultiplex.gen1.smk +++ b/src/harpy/rules/demultiplex.gen1.smk @@ -121,19 +121,13 @@ rule split_samples_fw: ( zgrep -A3 "A..{params}B..D" {input} | grep -v "^--$" | gzip -q > {output} ) || touch {output} """ -rule split_samples_rv: +use rule split_samples_fw as split_samples_rv with: input: f"{outdir}/demux_R2_001.fastq.gz" output: outdir + "/{sample}.R.fq.gz" - params: - c_barcode = lambda wc: samples[wc.get("sample")] message: "Extracting reverse reads:\n sample: {wildcards.sample}\n barcode: {params}" - shell: - """ - ( zgrep -A3 "A..{params}B..D" {input} | grep -v "^--$" | gzip -q > {output} ) || touch {output} - """ rule fastqc_F: input: @@ -168,38 +162,15 @@ rule fastqc_F: fi """ -rule fastqc_R: +use rule fastqc_F as fastqc_R with: input: outdir + "/{sample}.R.fq.gz" output: temp(outdir + "/logs/{sample}_R/fastqc_data.txt") params: lambda wc: f"{outdir}/logs/" + wc.get("sample") + "_R" - threads: - 1 - conda: - os.getcwd() + "/.harpy_envs/qc.yaml" message: "Performing quality assessment: {wildcards.sample}.R.fq.gz" - shell: - """ - mkdir -p {params} - if [ -z $(gzip -cd {input} | head -c1) ]; then - echo "##Falco 1.2.1" > {output} - echo ">>Basic Statistics fail" >> {output} - echo "#Measure Value" >> {output} - echo "Filename {wildcards.sample}.F.fq.gz" >> {output} - echo "File type Conventional base calls" >> {output} - echo "Encoding Sanger / Illumina 1.9" >> {output} - echo "Total Sequences 0" >> {output} - echo "Sequences flagged as poor quality 0" >> {output} - echo "Sequence length 0" >> {output} - echo "%GC 0" >> {output} - echo ">>END_MODULE" >> {output} - else - falco -q --threads {threads} -skip-report -skip-summary -o {params} {input} - fi - """ rule qc_report: input: