Commit 4fd620b2 authored by Midoux Cedric's avatar Midoux Cedric
Browse files

conda activate

parent d48141a8
...@@ -6,14 +6,14 @@ rule select_small: ...@@ -6,14 +6,14 @@ rule select_small:
params: params:
min_len = config["CONTIGS_LEN"] min_len = config["CONTIGS_LEN"]
shell: shell:
"conda activate seqkit-0.10.1 " "conda activate seqkit-0.11.0 "
" ; " "&& "
"seqkit " "seqkit "
"seq " "seq "
"--max-len {params.min_len} " "--max-len {params.min_len} "
"--out-file {output.contigs} " "--out-file {output.contigs} "
"{input} " "{input} "
" ; " "&& "
"conda deactivate" "conda deactivate"
rule kaiju_small: rule kaiju_small:
...@@ -24,12 +24,17 @@ rule kaiju_small: ...@@ -24,12 +24,17 @@ rule kaiju_small:
threads: threads:
8 8
shell: shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju " "kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp " "-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi " "-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"-i {input} " "-i {input} "
"-o {output} " "-o {output} "
"-z {threads}" "-z {threads} "
"&& "
"conda deactivate"
rule select_unmapped: rule select_unmapped:
input: input:
...@@ -38,16 +43,24 @@ rule select_unmapped: ...@@ -38,16 +43,24 @@ rule select_unmapped:
bam = temp("work/addon/unmapped-{sample}-{reads}.bam"), bam = temp("work/addon/unmapped-{sample}-{reads}.bam"),
fastq = "work/addon/unmapped-{sample}-{reads}.fastq" fastq = "work/addon/unmapped-{sample}-{reads}.fastq"
shell: shell:
"conda activate samtools-1.9 "
"&& "
"samtools " "samtools "
"view " "view "
"-f 4 " "-f 4 "
"-o {output.bam} " "-o {output.bam} "
"{input} " "{input} "
" ; " "&& "
"conda deactivate "
"&& "
"conda activate bedtools-2.29.0 "
"&& "
"bedtools " "bedtools "
"bamtofastq " "bamtofastq "
"-i {output.bam} " "-i {output.bam} "
"-fq {output.fastq} " "-fq {output.fastq} "
"&& "
"conda deactivate "
rule kaiju_unmapped: rule kaiju_unmapped:
input: input:
...@@ -57,12 +70,17 @@ rule kaiju_unmapped: ...@@ -57,12 +70,17 @@ rule kaiju_unmapped:
threads: threads:
8 8
shell: shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju " "kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp " "-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi " "-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"-i {input} " "-i {input} "
"-o {output} " "-o {output} "
"-z {threads}" "-z {threads} "
"&& "
"conda deactivate"
rule kronaNames_addon: rule kronaNames_addon:
input: input:
...@@ -70,9 +88,13 @@ rule kronaNames_addon: ...@@ -70,9 +88,13 @@ rule kronaNames_addon:
output: output:
"work/addon/{sample}.{addon}.taxNames.tsv" "work/addon/{sample}.{addon}.taxNames.tsv"
shell: shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju-addTaxonNames " "kaiju-addTaxonNames "
"-t /db/outils/kaiju/nr/nodes.dmp " "-t /db/outils/kaiju/nr/nodes.dmp "
"-n /db/outils/kaiju/nr/names.dmp " "-n /db/outils/kaiju/nr/names.dmp "
"-i {input} " "-i {input} "
"-o {output} " "-o {output} "
"-r superkingdom,phylum,order,class,family,genus,species" "-r superkingdom,phylum,order,class,family,genus,species "
"&& "
"conda deactivate"
...@@ -11,14 +11,18 @@ rule FragGeneScan: ...@@ -11,14 +11,18 @@ rule FragGeneScan:
params: params:
output = lambda wildcards, output: os.path.splittext(str(output))[0] output = lambda wildcards, output: os.path.splittext(str(output))[0]
shell: shell:
"conda activate fraggenescan-1.31 "
"&& "
"run_FragGeneScan.pl " "run_FragGeneScan.pl "
"-genome={input} " "-genome={input} "
"-out={params.output} " "-out={params.output} "
"-complete=0 " #negative values with complete=1 "-complete=0 " #negative values with complete=1
"-train=complete " "-train=complete "
"-thread={threads} " "-thread={threads} "
" ; " "&& "
"sed --in-place 's/*/N/' {output.faa} " "sed --in-place 's/*/N/' {output.faa} "
"&& "
"conda deactivate "
rule prodigal: rule prodigal:
input: input:
...@@ -28,6 +32,8 @@ rule prodigal: ...@@ -28,6 +32,8 @@ rule prodigal:
ffn = "work/prodigal/{sample}/{sample}_prodigal.ffn", ffn = "work/prodigal/{sample}/{sample}_prodigal.ffn",
gff = "work/prodigal/{sample}/{sample}_prodigal.gff" gff = "work/prodigal/{sample}/{sample}_prodigal.gff"
shell: shell:
# "conda activate prodigal "
# "&& "
"prodigal " "prodigal "
"-f gff " "-f gff "
"-i {input} " "-i {input} "
...@@ -36,8 +42,10 @@ rule prodigal: ...@@ -36,8 +42,10 @@ rule prodigal:
"-o {output.gff} " "-o {output.gff} "
"-g 11 " "-g 11 "
"-p meta " "-p meta "
" ; " "&& "
"sed --in-place 's/*$//' {output.faa} " "sed --in-place 's/*$//' {output.faa} "
# "&& "
# "conda deactivate "
def faa_input(wildcards): def faa_input(wildcards):
if wildcards.sample == "catalogue": if wildcards.sample == "catalogue":
...@@ -78,6 +86,8 @@ rule diamond: ...@@ -78,6 +86,8 @@ rule diamond:
threads: threads:
20 20
shell: shell:
"conda activate diamond-0.9.26 "
"&& "
"diamond " "diamond "
"blastp " "blastp "
"--db {input.db} " "--db {input.db} "
...@@ -92,7 +102,8 @@ rule diamond: ...@@ -92,7 +102,8 @@ rule diamond:
"--un {output.unaligned} " "--un {output.unaligned} "
"--verbose " "--verbose "
"--tmpdir /projet/tmp/ " "--tmpdir /projet/tmp/ "
"&& "
"conda deactivate "
rule diamondView: rule diamondView:
input: input:
...@@ -102,12 +113,16 @@ rule diamondView: ...@@ -102,12 +113,16 @@ rule diamondView:
params: params:
keywords = "qseqid qlen sseqid sallseqid slen qstart qend sstart send qseq full_qseq sseq full_sseq evalue bitscore score length pident nident mismatch positive gapopen gaps ppos qframe btop stitle salltitles qcovhsp qtitle qqual" #staxids keywords = "qseqid qlen sseqid sallseqid slen qstart qend sstart send qseq full_qseq sseq full_sseq evalue bitscore score length pident nident mismatch positive gapopen gaps ppos qframe btop stitle salltitles qcovhsp qtitle qqual" #staxids
shell: shell:
"conda activate diamond-0.9.26 "
"&& "
"diamond " "diamond "
"view " "view "
"--daa {input.daa} " "--daa {input.daa} "
"--outfmt 6 {params.keywords} " "--outfmt 6 {params.keywords} "
"--out {output.tsv} " "--out {output.tsv} "
"--header " "--header "
"&& "
"conda deactivate "
rule prokka: rule prokka:
input: input:
...@@ -130,6 +145,8 @@ rule prokka: ...@@ -130,6 +145,8 @@ rule prokka:
threads: threads:
8 8
shell: shell:
"conda activate prokka-1.14.5 "
"&& "
"prokka " "prokka "
"--outdir {params.output} " "--outdir {params.output} "
"--force " "--force "
...@@ -139,6 +156,8 @@ rule prokka: ...@@ -139,6 +156,8 @@ rule prokka:
"--cpus {threads} " "--cpus {threads} "
"--compliant " "--compliant "
"{input} " "{input} "
"&& "
"conda deactivate "
rule interproscan: rule interproscan:
input: input:
...@@ -148,6 +167,8 @@ rule interproscan: ...@@ -148,6 +167,8 @@ rule interproscan:
threads: threads:
8 8
shell: shell:
# "conda activate interproscan "
"&& "
"interproscan.sh " "interproscan.sh "
"--cpu {threads} " "--cpu {threads} "
"--formats {wildcards.format} " "--formats {wildcards.format} "
...@@ -158,3 +179,5 @@ rule interproscan: ...@@ -158,3 +179,5 @@ rule interproscan:
"--outfile {output} " "--outfile {output} "
"--pathways " "--pathways "
"--seqtype p " "--seqtype p "
# "&& "
# "conda deactivate "
...@@ -17,6 +17,8 @@ rule khmer: ...@@ -17,6 +17,8 @@ rule khmer:
K = 32, K = 32,
C = 100 C = 100
shell: shell:
"conda activate khmer-3.0.0a3 "
"&& "
"normalize-by-median.py " "normalize-by-median.py "
"--ksize {params.K} " "--ksize {params.K} "
"--max-memory-usage {params.mem_tot} " "--max-memory-usage {params.mem_tot} "
...@@ -25,7 +27,9 @@ rule khmer: ...@@ -25,7 +27,9 @@ rule khmer:
"--report {output.log} " "--report {output.log} "
"--output {output.R1R2} " "--output {output.R1R2} "
"--gzip " "--gzip "
"{input.R1R2}" "{input.R1R2} "
"&& "
"conda deactivate "
def assembly_input(wildcards): def assembly_input(wildcards):
if wildcards.reads == "coassembly": if wildcards.reads == "coassembly":
...@@ -44,7 +48,6 @@ def assembly_input(wildcards): ...@@ -44,7 +48,6 @@ def assembly_input(wildcards):
else: else:
return {"R1": ["DATA/trim/{wildcards.reads}_R1.fastq.gz".format(wildcards=wildcards)], "R2": ["DATA/trim/{wildcards.reads}_R2.fastq.gz".format(wildcards=wildcards)]} return {"R1": ["DATA/trim/{wildcards.reads}_R1.fastq.gz".format(wildcards=wildcards)], "R2": ["DATA/trim/{wildcards.reads}_R2.fastq.gz".format(wildcards=wildcards)]}
rule megahit: rule megahit:
input: input:
unpack(assembly_input) unpack(assembly_input)
...@@ -59,6 +62,8 @@ rule megahit: ...@@ -59,6 +62,8 @@ rule megahit:
input = lambda wildcards, input: "-1 %s -2 %s"%(",".join(input.R1), ",".join(input.R2)) if set(['R1', 'R2']).issubset(input.keys()) else "--12 %s"%",".join(input.R1R2), input = lambda wildcards, input: "-1 %s -2 %s"%(",".join(input.R1), ",".join(input.R2)) if set(['R1', 'R2']).issubset(input.keys()) else "--12 %s"%",".join(input.R1R2),
output = lambda wildcards, output: os.path.dirname(str(output.contigs)) output = lambda wildcards, output: os.path.dirname(str(output.contigs))
shell: shell:
"conda activate megahit-1.2.8 "
"&& "
"megahit " "megahit "
"{params.input} " "{params.input} "
"--continue " "--continue "
...@@ -69,7 +74,9 @@ rule megahit: ...@@ -69,7 +74,9 @@ rule megahit:
"--out-dir {params.output} " "--out-dir {params.output} "
"--out-prefix {wildcards.reads} " "--out-prefix {wildcards.reads} "
"--min-contig-len {params.min_len} " "--min-contig-len {params.min_len} "
"--verbose" "--verbose "
"&& "
"conda deactivate "
rule metaspades: rule metaspades:
input: input:
...@@ -86,6 +93,8 @@ rule metaspades: ...@@ -86,6 +93,8 @@ rule metaspades:
input = lambda wildcards, input: "-1 %s -2 %s"%(" -1 ".join(input.R1), " -2 ".join(input.R2)) if set(['R1', 'R2']).issubset(input.keys()) else "--12 %s"%" --12 ".join(input.R1R2), input = lambda wildcards, input: "-1 %s -2 %s"%(" -1 ".join(input.R1), " -2 ".join(input.R2)) if set(['R1', 'R2']).issubset(input.keys()) else "--12 %s"%" --12 ".join(input.R1R2),
output = lambda wildcards, output: os.path.dirname(str(output.contigs)) output = lambda wildcards, output: os.path.dirname(str(output.contigs))
shell: shell:
"conda activate spades-3.14.0 "
"&& "
"spades.py " "spades.py "
"--threads {threads} " "--threads {threads} "
"--memory {params.mem_tot} " "--memory {params.mem_tot} "
...@@ -93,18 +102,20 @@ rule metaspades: ...@@ -93,18 +102,20 @@ rule metaspades:
"--meta " "--meta "
"{params.input} " "{params.input} "
"-o {params.output} " "-o {params.output} "
" ; " "&& "
" touch {output.done} " "conda deactivate "
" ; " "&& "
"conda activate seqkit-0.10.1 " "touch {output.done} "
" ; " "&& "
"conda activate seqkit-0.11.0 "
"&& "
"seqkit " "seqkit "
"seq " "seq "
"--min-len {params.min_len} " "--min-len {params.min_len} "
"--out-file {output.contigs} " "--out-file {output.contigs} "
"{output.all_contigs} " "{output.all_contigs} "
" ; " "&& "
"conda deactivate" "conda deactivate "
def contigs_input(wildcards): def contigs_input(wildcards):
if wildcards.sample == "catalogue": if wildcards.sample == "catalogue":
...@@ -137,12 +148,16 @@ rule quast: ...@@ -137,12 +148,16 @@ rule quast:
params: params:
output = lambda wildcards, output: os.path.dirname(str(output)) output = lambda wildcards, output: os.path.dirname(str(output))
shell: shell:
"conda activate quast-5.0.2 "
"&& "
"quast " "quast "
"--mgm " "--mgm "
"--output-dir {params.output} " "--output-dir {params.output} "
"-L " "-L "
"--threads {threads} " "--threads {threads} "
"{input} " "{input} "
"&& "
"conda deactivate "
rule coassembly_quast: rule coassembly_quast:
input: input:
...@@ -154,9 +169,12 @@ rule coassembly_quast: ...@@ -154,9 +169,12 @@ rule coassembly_quast:
params: params:
output = lambda wildcards, output: os.path.dirname(str(output)) output = lambda wildcards, output: os.path.dirname(str(output))
shell: shell:
"conda activate quast-5.0.2 "
"quast " "quast "
"--mgm " "--mgm "
"--output-dir {params.output} " "--output-dir {params.output} "
"-L " "-L "
"--threads {threads} " "--threads {threads} "
"{input} " "{input} "
"&& "
"conda deactivate "
...@@ -6,8 +6,8 @@ rule partial_genes: #fonctionne uniquement avec prodigal ...@@ -6,8 +6,8 @@ rule partial_genes: #fonctionne uniquement avec prodigal
threads: threads:
2 2
shell: shell:
"source activate seqkit-0.10.1 " "conda activate seqkit-0.11.0 "
" ; " "&& "
"seqkit " "seqkit "
"grep " "grep "
"--use-regexp " "--use-regexp "
...@@ -16,8 +16,8 @@ rule partial_genes: #fonctionne uniquement avec prodigal ...@@ -16,8 +16,8 @@ rule partial_genes: #fonctionne uniquement avec prodigal
"--threads {threads} " "--threads {threads} "
"--out-file {output} " "--out-file {output} "
"{input} " "{input} "
" ; " "&& "
"conda deactivate" "conda deactivate "
rule pool: rule pool:
input: input:
...@@ -27,8 +27,8 @@ rule pool: ...@@ -27,8 +27,8 @@ rule pool:
shell: shell:
"cat " "cat "
"{input} " "{input} "
" > " "> "
"{output}" "{output} "
rule pool_incomplet: rule pool_incomplet:
input: input:
...@@ -38,8 +38,8 @@ rule pool_incomplet: ...@@ -38,8 +38,8 @@ rule pool_incomplet:
shell: shell:
"cat " "cat "
"{input} " "{input} "
" > " "> "
"{output}" "{output} "
rule cd_hit: rule cd_hit:
input: input:
...@@ -50,6 +50,8 @@ rule cd_hit: ...@@ -50,6 +50,8 @@ rule cd_hit:
threads: threads:
8 8
shell: shell:
"conda activate cd-hit-4.8.1 "
"&& "
"cd-hit-est " "cd-hit-est "
"-i {input} " "-i {input} "
"-o {output.ffn} " "-o {output.ffn} "
...@@ -59,6 +61,8 @@ rule cd_hit: ...@@ -59,6 +61,8 @@ rule cd_hit:
"-d 0 " "-d 0 "
"-M 0 " "-M 0 "
"-T {threads} " "-T {threads} "
"&& "
"conda deactivate "
rule cd_hit_2D: rule cd_hit_2D:
input: input:
...@@ -70,6 +74,8 @@ rule cd_hit_2D: ...@@ -70,6 +74,8 @@ rule cd_hit_2D:
threads: threads:
8 8
shell: shell:
"conda activate cd-hit-4.8.1 "
"&& "
"cd-hit-est-2d " "cd-hit-est-2d "
"-i {input.complete} " "-i {input.complete} "
"-i2 {input.incomplete} " "-i2 {input.incomplete} "
...@@ -80,6 +86,8 @@ rule cd_hit_2D: ...@@ -80,6 +86,8 @@ rule cd_hit_2D:
"-d 0 " "-d 0 "
"-M 0 " "-M 0 "
"-T {threads} " "-T {threads} "
"&& "
"conda deactivate "
rule faa_catalogue: rule faa_catalogue:
input: input:
...@@ -92,11 +100,11 @@ rule faa_catalogue: ...@@ -92,11 +100,11 @@ rule faa_catalogue:
2 2
shell: shell:
"grep '>' {input.ffn} > {output.list} " "grep '>' {input.ffn} > {output.list} "
" ; " "&& "
"sed --in-place 's/>//' {output.list} " "sed --in-place 's/>//' {output.list} "
" ; " "&& "
"source activate seqkit-0.10.1 " "conda activate seqkit-0.11.0 "
" ; " "&& "
"seqkit " "seqkit "
"grep " "grep "
"--by-name " "--by-name "
...@@ -104,8 +112,8 @@ rule faa_catalogue: ...@@ -104,8 +112,8 @@ rule faa_catalogue:
"--threads {threads} " "--threads {threads} "
"--out-file {output.faa} " "--out-file {output.faa} "
"{input.faa} " "{input.faa} "
" ; " "&& "
"conda deactivate" "conda deactivate "
checkpoint metabat: checkpoint metabat:
input: input:
...@@ -120,7 +128,7 @@ checkpoint metabat: ...@@ -120,7 +128,7 @@ checkpoint metabat:
8 8
shell: shell:
"conda activate metabat2-2.12.1 " "conda activate metabat2-2.12.1 "
" ; " "&& "
"metabat2 " "metabat2 "
"--inFile {input} " "--inFile {input} "
"--outFile {params.output} " "--outFile {params.output} "
...@@ -129,7 +137,7 @@ checkpoint metabat: ...@@ -129,7 +137,7 @@ checkpoint metabat:
"--numThreads {threads} " "--numThreads {threads} "
"--unbinned " "--unbinned "
"--verbose " "--verbose "
" ; " "&& "
"conda deactivate " "conda deactivate "
rule metabat_kaiju: rule metabat_kaiju:
...@@ -148,7 +156,7 @@ rule metabat_kaiju: ...@@ -148,7 +156,7 @@ rule metabat_kaiju:
"--word-regexp " "--word-regexp "
"--file - " "--file - "
"{input.kaiju} " "{input.kaiju} "
" > " "> "
"{output} " "{output} "
def aggregate_metabat(wildcards): def aggregate_metabat(wildcards):
...@@ -175,12 +183,12 @@ rule checkm: ...@@ -175,12 +183,12 @@ rule checkm:
output = lambda wildcards, output: os.path.dirname(str(output)) output = lambda wildcards, output: os.path.dirname(str(output))
shell: shell:
"conda activate checkm-genome-1.0.18 " "conda activate checkm-genome-1.0.18 "
" ; " "&& "
"checkm " "checkm "
"lineage_wf " "lineage_wf "
"-t {threads} " "-t {threads} "
"-x fa " "-x fa "
"{params.input} " "{params.input} "
"{params.output} " "{params.output} "
" ; " "&& "
"conda deactivate" "conda deactivate "
...@@ -6,10 +6,15 @@ rule index : ...@@ -6,10 +6,15 @@ rule index :
params: params:
index = "work/index/{sample}" index = "work/index/{sample}"
shell: