-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile2
51 lines (38 loc) · 1.82 KB
/
Snakefile2
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
from read_accessions import read_txt_file
from snakemake.io import glob_wildcards
# Read sample names from the txt file
trimmed_accession_list = read_txt_file("trimmed_accessions.txt")
rule all:
input:
expand("trimmed_snakemake/{sample}/{sample}_trimmed_fastqc.html", sample=trimmed_accession_list),
"trimmed_snakemake/trimmed_multiqc_report.html"
rule trim_fastq:
input:
"snakemake/{sample}/{sample}.fastq"
output:
"trimmed_snakemake/{sample}/{sample}_trimmed.fastq"
shell:
"""
echo 'Running trimming for {wildcards.sample}' &&
trimmomatic SE -phred33 {input} trimmed_snakemake/{wildcards.sample}/{wildcards.sample}_trimmed_temp.fastq LEADING:20 TRAILING:20 SLIDINGWINDOW:10:20 HEADCROP:20 &&
[ ! -e trimmed_snakemake/{wildcards.sample}/{wildcards.sample}_trimmed_temp.fastq ] || [ "{output}" -ef "trimmed_snakemake/{wildcards.sample}/{wildcards.sample}_trimmed_temp.fastq" ] || mv trimmed_snakemake/{wildcards.sample}/{wildcards.sample}_trimmed_temp.fastq "{output}" ||
(echo 'Error in trimming' && exit 1)
"""
rule fastqc_trimmed:
input:
"trimmed_snakemake/{sample}/{sample}_trimmed.fastq"
output:
html="trimmed_snakemake/{sample}/{sample}_trimmed_fastqc.html",
zip="trimmed_snakemake/{sample}/{sample}_trimmed_fastqc.zip"
shell:
"""
echo "Processing trimmed sample: {wildcards.sample}"
fastqc {input}
"""
rule trimmed_multiqc:
input:
expand("trimmed_snakemake/{sample}/{sample}_trimmed_fastqc.zip", sample=trimmed_accession_list)
output:
"trimmed_snakemake/trimmed_multiqc_report.html"
shell:
"multiqc trimmed_snakemake/ --outdir trimmed_snakemake/ --filename trimmed_multiqc_report -f"