add-on.smk 1.94 KB
Newer Older
1
2
3
4
5
6
7
8
rule select_small:
	input:
		"work/metaSPADES/{reads}/contigs.fasta"
	output:
		contigs = "work/addon/{reads}.small_contigs.fasta"
	params:
		min_len = config["CONTIGS_LEN"]
	shell:
Midoux Cedric's avatar
Midoux Cedric committed
9
10
		"conda activate seqkit-0.11.0 "
		"&& "
11
12
13
14
15
		"seqkit "
		"seq "
		"--max-len {params.min_len} "
		"--out-file {output.contigs} "
		"{input} "
Midoux Cedric's avatar
Midoux Cedric committed
16
		"&& "
17
18
19
20
21
22
23
24
25
26
		"conda deactivate"

rule kaiju_small:
	input:
		"work/addon/{sample}.small_contigs.fasta"
	output:
		"work/addon/{sample}.small_contigs.kaijuNR"
	threads:
		8
	shell:
Midoux Cedric's avatar
Midoux Cedric committed
27
28
		"conda activate kaiju-1.7.3 "
		"&& "
29
30
31
32
33
		"kaiju "
		"-t /db/outils/kaiju/nr/nodes.dmp "
		"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
		"-i {input} "
		"-o {output} "
Midoux Cedric's avatar
Midoux Cedric committed
34
35
36
37
		"-z {threads} "
		"&& "
		"conda deactivate"

38
39
40
41
42
43
44
45

rule select_unmapped:
	input:
		"work/bowtie/align-{sample}-{reads}.bam"
	output:
		bam = temp("work/addon/unmapped-{sample}-{reads}.bam"),
		fastq = "work/addon/unmapped-{sample}-{reads}.fastq"
	shell:
Midoux Cedric's avatar
Midoux Cedric committed
46
47
		"conda activate samtools-1.9 "
		"&& "
48
49
50
51
52
		"samtools "
		"view "
		"-f 4 "
		"-o {output.bam} "
		"{input} "
Midoux Cedric's avatar
Midoux Cedric committed
53
54
55
56
57
		"&& "
		"conda deactivate "
		"&& "
		"conda activate bedtools-2.29.0 "
		"&& "
58
59
60
61
		"bedtools "
		"bamtofastq "
		"-i {output.bam} "
		"-fq {output.fastq} "
Midoux Cedric's avatar
Midoux Cedric committed
62
63
		"&& "
		"conda deactivate "
64
65
66
67
68
69
70
71
72

rule kaiju_unmapped:
	input:
		"work/addon/unmapped-{sample}-{reads}.fastq"
	output:
		"work/addon/{sample}-{reads}.unmapped.kaijuNR"
	threads:
		8
	shell:
Midoux Cedric's avatar
Midoux Cedric committed
73
74
		"conda activate kaiju-1.7.3 "
		"&& "
75
76
77
78
79
		"kaiju "
		"-t /db/outils/kaiju/nr/nodes.dmp "
		"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
		"-i {input} "
		"-o {output} "
Midoux Cedric's avatar
Midoux Cedric committed
80
81
82
83
		"-z {threads} "
		"&& "
		"conda deactivate"

84
85
86
87
88
89
90

rule kronaNames_addon:
	input:
		"work/addon/{sample}.{addon}.kaijuNR"
	output:
		"work/addon/{sample}.{addon}.taxNames.tsv"
	shell:
Midoux Cedric's avatar
Midoux Cedric committed
91
92
		"conda activate kaiju-1.7.3 "
		"&& "
93
94
95
96
97
		"kaiju-addTaxonNames "
		"-t /db/outils/kaiju/nr/nodes.dmp "
		"-n /db/outils/kaiju/nr/names.dmp "
		"-i {input} "
		"-o {output} "
Midoux Cedric's avatar
Midoux Cedric committed
98
99
100
		"-r superkingdom,phylum,order,class,family,genus,species "
		"&& "
		"conda deactivate"