Commit 1ab91ebc authored by Midoux Cedric's avatar Midoux Cedric
Browse files

Merge branch 'addon_kaiju'

parents efef592d 80f53fb9
rule select_small:
input:
"work/metaSPADES/{reads}/contigs.fasta"
output:
contigs = "work/addon/{reads}.small_contigs.fasta"
params:
min_len = config["CONTIGS_LEN"]
shell:
"conda activate seqkit-0.10.1 "
" ; "
"seqkit "
"seq "
"--max-len {params.min_len} "
"--out-file {output.contigs} "
"{input} "
" ; "
"conda deactivate"
rule kaiju_small:
input:
"work/addon/{sample}.small_contigs.fasta"
output:
"work/addon/{sample}.small_contigs.kaijuNR"
threads:
8
shell:
"kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"-i {input} "
"-o {output} "
"-z {threads}"
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:
"samtools "
"view "
"-f 4 "
"-o {output.bam} "
"{input} "
" ; "
"bedtools "
"bamtofastq "
"-i {output.bam} "
"-fq {output.fastq} "
rule kaiju_unmapped:
input:
"work/addon/unmapped-{sample}-{reads}.fastq"
output:
"work/addon/{sample}-{reads}.unmapped.kaijuNR"
threads:
8
shell:
"kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"-i {input} "
"-o {output} "
"-z {threads}"
rule kronaNames_addon:
input:
"work/addon/{sample}.{addon}.kaijuNR"
output:
"work/addon/{sample}.{addon}.taxNames.tsv"
shell:
"kaiju-addTaxonNames "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-n /db/outils/kaiju/nr/names.dmp "
"-i {input} "
"-o {output} "
"-r superkingdom,phylum,order,class,family,genus,species"
...@@ -76,12 +76,13 @@ rule metaspades: ...@@ -76,12 +76,13 @@ rule metaspades:
unpack(assembly_input) unpack(assembly_input)
output: output:
contigs = "work/metaSPADES/{reads}/{reads}.contigs.fasta", contigs = "work/metaSPADES/{reads}/{reads}.contigs.fasta",
all_contigs = "work/metaSPADES/{reads}/contigs.fasta",
done = "work/metaSPADES/{reads}/done" done = "work/metaSPADES/{reads}/done"
threads: threads:
20 20
params: params:
min_len = config["CONTIGS_LEN"], min_len = config["CONTIGS_LEN"],
mem_tot = 250, mem_tot = 500,
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:
...@@ -101,7 +102,7 @@ rule metaspades: ...@@ -101,7 +102,7 @@ rule metaspades:
"seq " "seq "
"--min-len {params.min_len} " "--min-len {params.min_len} "
"--out-file {output.contigs} " "--out-file {output.contigs} "
"work/metaSPADES/{wildcards.reads}/contigs.fasta " "{output.all_contigs} "
" ; " " ; "
"conda deactivate" "conda deactivate"
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
}, },
"metaspades" : "metaspades" :
{ {
"queue" : "highmem.q,maiage.q", "queue" : "highmem.q",
"cluster" : "-l h_vmem=12G" "cluster" : "-l h_vmem=25G"
}, },
"diamond" : "diamond" :
{ {
......
...@@ -23,6 +23,9 @@ rule all: ...@@ -23,6 +23,9 @@ rule all:
expand("report/count-contigs-catalogue-{sample}.tsv", sample=config["SAMPLES"]), expand("report/count-contigs-catalogue-{sample}.tsv", sample=config["SAMPLES"]),
"report/diamond_nr_catalogue.tsv", "report/diamond_nr_catalogue.tsv",
"report/contigs_catalogue-taxNames.tsv", "report/contigs_catalogue-taxNames.tsv",
#add-on
expand("work/addon/{sample}.small_contigs.taxNames.tsv", sample=config["SAMPLES"]),
#expand("work/addon/catalogue.{sample}.unmapped.taxNames.tsv", sample=config["SAMPLES"]),
include: "../workflow_metagenomics/quality.smk" include: "../workflow_metagenomics/quality.smk"
...@@ -32,3 +35,4 @@ include: "../workflow_metagenomics/assembly.smk" ...@@ -32,3 +35,4 @@ include: "../workflow_metagenomics/assembly.smk"
include: "../workflow_metagenomics/annotation.smk" include: "../workflow_metagenomics/annotation.smk"
include: "../workflow_metagenomics/count.smk" include: "../workflow_metagenomics/count.smk"
include: "../workflow_metagenomics/catalogue.smk" include: "../workflow_metagenomics/catalogue.smk"
include: "../workflow_metagenomics/add-on.smk"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment