Commit 7b2b4cd1 authored by Cedric Midoux's avatar Cedric Midoux
Browse files

binning.smk

parent 225253ad
checkpoint metabat:
input:
unpack(contigs_input)
output:
clusters = directory("work/metabat/{sample}")
params:
#output = "{output}/{sample}",
output = "work/metabat/{sample}/{sample}",
clustrsize = 200000
threads:
8
shell:
"conda activate metabat2-2.12.1 "
"&& "
"metabat2 "
"--inFile {input} "
"--outFile {params.output} "
"--minContig 5000 "
"--minClsSize {params.clustrsize} "
"--numThreads {threads} "
"--unbinned "
"--verbose "
"&& "
"conda deactivate "
rule metabat_kaiju:
input:
clustr = "work/metabat/{sample}/{sample}.{num}.fa",
kaiju = "report/contigs_{sample}-taxNames.tsv"
output:
"work/metabat/{sample}/{sample}.{num}_kaiju.tsv"
shell:
"grep "
"'>' "
"--file {input.clustr} "
" | "
"grep "
"--no-messages "
"--word-regexp "
"--file - "
"{input.kaiju} "
"> "
"{output} "
def aggregate_metabat(wildcards):
checkpoint_output = checkpoints.metabat.get(**wildcards).output.clusters
return expand("work/metabat/{sample}/{sample}.{i}_kaiju.tsv", sample=wildcards.sample, i=glob_wildcards(os.path.join(checkpoint_output, "{sample}.{i}")).i)
rule resume_metabat:
input:
aggregate_metabat
output:
done = temp("work/metabat/{sample}.done")
shell:
"touch {output.done} "
rule checkm:
input:
"work/metabat/{sample}/{sample}.unbinned.fa"
output:
"work/checkm/{sample}/lineage.ms"
threads:
4
params:
input = lambda wildcards, input: os.path.dirname(str(input)),
output = lambda wildcards, output: os.path.dirname(str(output))
shell:
"conda activate checkm-genome-1.0.18 "
"&& "
"checkm "
"lineage_wf "
"-t {threads} "
"-x fa "
"{params.input} "
"{params.output} "
"&& "
"conda deactivate "
......@@ -114,81 +114,3 @@ rule faa_catalogue:
"{input.faa} "
"&& "
"conda deactivate "
checkpoint metabat:
input:
unpack(contigs_input)
output:
clusters = directory("work/metabat/{sample}")
params:
#output = "{output}/{sample}",
output = "work/metabat/{sample}/{sample}",
clustrsize = 200000
threads:
8
shell:
"conda activate metabat2-2.12.1 "
"&& "
"metabat2 "
"--inFile {input} "
"--outFile {params.output} "
"--minContig 5000 "
"--minClsSize {params.clustrsize} "
"--numThreads {threads} "
"--unbinned "
"--verbose "
"&& "
"conda deactivate "
rule metabat_kaiju:
input:
clustr = "work/metabat/{sample}/{sample}.{num}.fa",
kaiju = "report/contigs_{sample}-taxNames.tsv"
output:
"work/metabat/{sample}/{sample}.{num}_kaiju.tsv"
shell:
"grep "
"'>' "
"--file {input.clustr} "
" | "
"grep "
"--no-messages "
"--word-regexp "
"--file - "
"{input.kaiju} "
"> "
"{output} "
def aggregate_metabat(wildcards):
checkpoint_output = checkpoints.metabat.get(**wildcards).output.clusters
return expand("work/metabat/{sample}/{sample}.{i}_kaiju.tsv", sample=wildcards.sample, i=glob_wildcards(os.path.join(checkpoint_output, "{sample}.{i}")).i)
rule resume_metabat:
input:
aggregate_metabat
output:
done = temp("work/metabat/{sample}.done")
shell:
"touch {output.done} "
rule checkm:
input:
"work/metabat/{sample}/{sample}.unbinned.fa"
output:
"work/checkm/{sample}/lineage.ms"
threads:
4
params:
input = lambda wildcards, input: os.path.dirname(str(input)),
output = lambda wildcards, output: os.path.dirname(str(output))
shell:
"conda activate checkm-genome-1.0.18 "
"&& "
"checkm "
"lineage_wf "
"-t {threads} "
"-x fa "
"{params.input} "
"{params.output} "
"&& "
"conda deactivate "
......@@ -39,5 +39,6 @@ include: "../workflow_metagenomics/assembly.smk"
include: "../workflow_metagenomics/annotation.smk"
include: "../workflow_metagenomics/count.smk"
include: "../workflow_metagenomics/catalogue.smk"
include: "../workflow_metagenomics/binning.smk"
include: "../workflow_metagenomics/add-on.smk"
include: "../workflow_metagenomics/virome.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