forked from deto/Snakemake_Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
48 lines (43 loc) · 1.24 KB
/
Snakefile
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
rule fastqc:
input:
read1="raw_data/{id}_R1.fastq.gz",
read2="raw_data/{id}_R2.fastq.gz"
output:
"{id}/fastqc/results.html"
shell:
"""
mkdir -p {wildcards.id}/fastqc
fastqc --outdir="{wildcards.id}/fastqc" {input.read1} {input.read2}
"""
rule align_reads:
input:
read1="raw_data/{id}_R1.fastq.gz",
read2="raw_data/{id}_R2.fastq.gz"
output:
"{id}/STAR/results.bam"
shell:
"""
STAR --genomeDir "/some/directory/to/reference" \
--outFileNamePrefix "{wildcards.id}/STAR/results" \
--readFilesIn {input.read1} {input.read2}
"""
rule quantify_transcripts:
input:
bam=rules.align_reads.output
output:
isoforms="{id}/rsem/sample.isoforms.results"
shell:
"""
rsem-calculate-expression --alignments {input.bam} {wildcards.id}/rsem/sample
"""
IDs, = glob_wildcards("raw_data/{id}_R1.fastq.gz")
rule gather_results:
input:
expand(rules.quantify_transcripts.output.isoforms, id=IDs)
output:
expression="expression.txt"
script: "scripts/gather.R"
rule all:
input:
rules.gather_results.output,
expand(rules.fastqc.output, id=IDs)