I am fairly new to Snakemake and am building an NGS data processing pipeline to align ChIP-seq data and call peaks on it, plus some other analyses. The data can be single-end or paired-end, depending on the experiment.
Originally, I was intending to handle single-end and paired-end data using a sample_sp
wildcard for the tools that require different paramters, and impose a regex constraint on it. That way, all my paired-end data files could bear a _pe
suffix, and would only be processed by the paired-end rules in the pipeline like so:
rule bowtie2_map_se:
input:
"DATA/FASTQ/{sample_sp}.filtered.fq.gz"
output:
temp("DATA/BAM/UNSORTED/{sample_sp}.sam")
...
rule bowtie2_map_pe:
input:
fq1="DATA/FASTQ/{sample_sp}_fw.filtered.fq.gz",
fq2="DATA/FASTQ/{sample_sp}_rv.filtered.fq.gz"
output:
temp("DATA/BAM/UNSORTED/{sample_sp}_pe.sam")
...
By constraining sample_sp
to not end with {"_fw", "_rv", "_pe"}
, then snakemake will not attempt to use those data files for single-end specific rules.
However, I encountered issues when trying to implement these regex constraints.
What are the best practices for handling single-end and paired-end data in your snakemake pipelines? Are there ways to implement these regex constraints, or am I approaching the issue from the wrong point of view?