-
Notifications
You must be signed in to change notification settings - Fork 1
/
Snakefile_IonTorrent
46 lines (40 loc) · 1.26 KB
/
Snakefile_IonTorrent
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
workdir: "."
(SAMPLES,) = glob_wildcards("/path/to/IonTorrent/bam-files/{sample}.bam") #enter path to IonTorrent bam-files
rule all:
input:
expand("kraken_report_Ion/{sample}_kraken_report.txt", sample=SAMPLES)
rule samtools_sort:
input:
"/path/to/IonTorrent/bam-files/{sample}.bam" #enter path to IonTorrent bam-files
output:
"sorted_bam_Ion/{sample}_sorted.bam"
shell:
"""
samtools sort -o {output} {input.bam_file}
"""
rule extract_unmapped:
input:
"sorted_bam_Ion/{sample}_sorted.bam"
output:
"unmapped_Ion/{sample}_unmapped.bam"
shell:
"samtools view -f 4 {input} > {output}"
rule bam_to_fastq:
input:
"unmapped_Ion/{sample}_unmapped.bam"
output:
"fastq_Ion/{sample}_unmapped.fastq"
shell:
"samtools fastq {input} > {output}"
rule kraken:
input:
fastq="fastq_Ion/{sample}_unmapped.fastq",
db="/path/to/kraken2_db" #enter path to db
output:
report = "kraken_report_Ion/{sample}_kraken_report.txt",
out = "kraken_output_Ion/{sample}_kraken_output.txt"
shell:
"""
kraken2 --db {input.db} --output {output.out} \
--report {output.report} --confidence 0.60 {input.fastq}
"""