From c5b8c8977c2889b02f887f6f297722b606529f2d Mon Sep 17 00:00:00 2001 From: riasc Date: Wed, 13 Mar 2024 17:41:53 -0500 Subject: [PATCH] added different handling for single- and paired-end --- workflow/rules/quantification.smk | 72 +++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/workflow/rules/quantification.smk b/workflow/rules/quantification.smk index ff02393..4339c46 100644 --- a/workflow/rules/quantification.smk +++ b/workflow/rules/quantification.smk @@ -11,21 +11,35 @@ rule countfeatures_dnaseq: conda: "../envs/subread.yml" params: - mapq=f"""{config['mapq']}""" - + mapq=f"""{config['mapq']}""", + readtype=f"""{config["data"]["dnaseq_readtype"]}""" shell: """ - featureCounts \ - -F GTF \ - -a {input.annotation_file} \ - -t gene \ - -g gene_id \ - --fracOverlap 0.2 \ - -Q {params.mapq} \ - -T {threads} \ - -o {output} {input.sample} > {log} 2>&1 + if [ "{params.readtype}" == "PE" ]; then + featureCounts \ + -p \ + -F GTF \ + -a {input.annotation_file} \ + -t gene \ + -g gene_id \ + --fracOverlap 0.2 \ + -Q {params.mapq} \ + -T {threads} \ + -o {output} {input.sample} > {log} 2>&1 + elif [ "{params.readtype}" == "SE" ]; then + featureCounts \ + -F GTF \ + -a {input.annotation_file} \ + -t gene \ + -g gene_id \ + --fracOverlap 0.2 \ + -Q {params.mapq} \ + -T {threads} \ + -o {output} {input.sample} > {log} 2>&1 + fi """ + # TODO: add support for PE reads (BWA stores reads as single-end?) rule countfeatures_rnaseq: @@ -42,20 +56,32 @@ rule countfeatures_rnaseq: conda: "../envs/subread.yml" params: - readtype=f"""{config["data"]["rnaseq_readtype"]}""", - mapq=f"""{config['mapq']}""" + mapq=f"""{config['mapq']}""", + readtype=f"""{config["data"]["rnaseq_readtype"]}""" shell: """ - featureCounts \ - -p \ - -F GTF \ - -a {input.annotation_file} \ - -t gene \ - -g gene_id \ - --fracOverlap 0.2 \ - -Q {params.mapq} \ - -T {threads} \ - -o {output.table} {input.sample} > {log} 2>&1 + if [ "{params.readtype}" == "PE" ]; then + featureCounts \ + -p \ + -F GTF \ + -a {input.annotation_file} \ + -t gene \ + -g gene_id \ + --fracOverlap 0.2 \ + -Q {params.mapq} \ + -T {threads} \ + -o {output} {input.sample} > {log} 2>&1 + elif [ "{params.readtype}" == "SE" ]; then + featureCounts \ + -F GTF \ + -a {input.annotation_file} \ + -t gene \ + -g gene_id \ + --fracOverlap 0.2 \ + -Q {params.mapq} \ + -T {threads} \ + -o {output} {input.sample} > {log} 2>&1 + fi """ # merges the count tables from all samples into single table (calculates TPM)