-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile1
58 lines (50 loc) · 1.93 KB
/
Snakefile1
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
52
53
54
55
56
57
58
# Snakefile
from read_accessions import read_txt_file
accession_list = read_txt_file("accessions.txt")
print("Accession list:", accession_list)
rule all:
input:
expand("snakemake/{sample}/{sample}_fastqc.html", sample=accession_list),
"multiqc_report.html"
rule download_sra:
output:
"snakemake/{sample}/{sample}.sra"
params:
sra_id=lambda wildcards: wildcards.sample
shell:
"""
echo 'Running download_sra for {wildcards.sample}' &&
prefetch --output-directory snakemake/{params.sra_id} --output-file snakemake/{params.sra_id}/{params.sra_id}.sra {params.sra_id} &&
[ ! -e snakemake/{params.sra_id}/{params.sra_id}.sra ] || [ "snakemake/{params.sra_id}/{params.sra_id}.sra" -ef "{output}" ] || mv snakemake/{params.sra_id}/{params.sra_id}.sra {output} ||
(echo 'Error in download_sra' && exit 1)
"""
rule fastq_dump:
input:
"snakemake/{sample}/{sample}.sra"
output:
"snakemake/{sample}/{sample}.fastq"
shell:
"""
echo 'Running fastq_dump for {wildcards.sample}' &&
fastq-dump --outdir snakemake/{wildcards.sample} {input} &&
[ ! -e snakemake/{wildcards.sample}/{wildcards.sample}.fastq ] || [ "snakemake/{wildcards.sample}/{wildcards.sample}.fastq" -ef "{output}" ] || mv snakemake/{wildcards.sample}/{wildcards.sample}.fastq {output} ||
(echo 'Error in fastq_dump' && exit 1)
"""
rule fastqc_raw:
input:
"snakemake/{sample}/{sample}.fastq"
output:
html="snakemake/{sample}/{sample}_fastqc.html",
zip="snakemake/{sample}/{sample}_fastqc.zip"
shell:
"""
echo "Processing sample: {wildcards.sample}"
fastqc {input}
"""
rule multiqc:
input:
expand("snakemake/{sample}/{sample}_fastqc.html", sample=reversed(accession_list))
output:
"multiqc_report.html"
shell:
"multiqc . --filename {output} -f"