Kristy
Kristy

Reputation: 53

running metabat2 with snakemake but not getting the bin files

I have been trying to run metabat2 with snakemake. I can run it but the output files in metabat2/ are missing. The checkM that works after it does use the data and can work I just cant find the files later. There should be files created with numbers but it is imposible to predict how many files will be created. Is there a way I can specify it to make sure that the files are created in that file?

rule all:
    [f"metabat2/" for sample in samples],
    [f"checkm/" for sample in samples]
rule metabat2:
    input:
        "input/consensus.fasta"
    output:
        directory("metabat2/")
    conda:
        "envs/metabat2.yaml"
    shell:
        "metabat2 -i {input} -o {output} -v"

rule checkM:
    input:
        "metabat2/"
    output:
        c = "bacteria/CheckM.txt",
    d = directory("checkm/")
    conda:
        "envs/metabat2.yaml"
    shell:
        "checkm lineage_wf -f {output.c} -t 10 -x fa {input} {output.d}"

the normal code to run metabat2 would be

 metabat2 -i path/to/consensus.fasta -o /outputdir/bin -v 

this will create in outputdir files with bin.[number].fa

Upvotes: 0

Views: 167

Answers (1)

dariober
dariober

Reputation: 9062

I can't tell what the problem is but I have a couple of suggestions...

  • [f"metabat2/" for sample in samples]: I doubt this will do what you expect as it will simply create a list with the string metabat2/ repeat len(samples) times. Maybe you want [f"metabat2/{sample}" for sample in samples]? The same for [f"checkm/" for sample in samples]

  • The samples variable is not used anywhere in the rules following all. I suspect somewhere it should be used and/or you should use something like output: directory("metabat2/{sample}")

  • Execute snakemake with -p option to see what commands are executed. It may be useful to post the stdout from it.

Upvotes: 1

Related Questions