forked from Lufpa/TM3Seq-Pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnakefile
More file actions
51 lines (37 loc) · 1.81 KB
/
Snakefile
File metadata and controls
51 lines (37 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# The main entry point of your workflow for Tn5 RNA-Seq Pipeline
# After configuring, running snakemake -n in a clone of this repository should
# successfully execute a dry-run of the workflow.
import pandas as pd
shell.executable("bash")
from snakemake.utils import min_version
min_version("5.2.0")
configfile: "config.defaults.yml"
sample_files = snakemake.utils.listfiles(config["fastq_file_pattern"]+"/{sample}.fastq.gz")
samples = dict((y[0], x) for x, y in sample_files)
assert len(samples) > 0, "ERROR: No fastq files were found using pattern '{}' (set in configfile)".format(config["fastq_file_pattern"])
SAMPLES_ALL = glob_wildcards(config['fastq_file_pattern']+"/{sample}.fastq.gz").sample
SAMPLES_PAIRED = glob_wildcards(config['fastq_file_pattern']+"/{sample}_R1_001.fastq.gz").sample
log_dir = config["results_dir"] + "/logs"
def get_fastq(wildcards):
return samples[wildcards.sample]
if_SE = (all("R1" not in name for name in samples.keys()) or all("R2" not in name for name in samples.keys())) if config['if_SE'] == "None" else config['if_SE']
def get_matched_fastq(wildcards):
paired_files = [samples[i] for i in samples.keys() if f'{wildcards.sample}_R' in i]
if len(paired_files) == 2 :
return sorted(paired_files)
else:
raise ValueError(f"Error in matched pairs {wildcards.sample}")
def get_paired_fastq(wildcards):
return get_matched_fastq(wildcards)
rule all:
input:
config["results_dir"] + "/multiqc.html",
config["results_dir"] + "/combined_gene_counts.tsv",
config['results_dir']+"/QC_table.csv"
#expand("working/trimmed/{sample}.fastq.gz", sample=samples.keys())
include: "rules/fastqc.smk"
include: "rules/trim.smk"
include: "rules/align.smk"
include: "rules/dedup.smk"
include: "rules/count.smk"
include: "rules/summary.smk"