My snakefile won't run because of wildcards-please help!
1
0
Entering edit mode
4.0 years ago

I've been having issues getting snakemake to work. Here is the first rule that will not run. I want to take protein annotation files and make blast databases out of them.

STRAINS = ["A", "B", "C"]

rule make_db:
    input:
        "prokka_faa/{strain}.faa"
    output:
        "dbs/{strain}-db"
    conda:
        "envs/finding.yaml"
    shell:
        "makeblastdb -input_type prot -dbtype prot -in {input} -out {output}"

But when I run this:

$ snakemake -n --snakefile snakefile.txt --cores 2 -p

I get the output

"Building DAG of jobs... WorkflowError: Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards."

I can get this to run with just one strain, but I need to run this on 185 files. This may be a simple fix but I have tried everything I can think of to fix this and I'm not great with python syntax.

Any help is greatly appreciated, thank you!

snakemake snakefile • 1.9k views
ADD COMMENT
4
Entering edit mode
4.0 years ago

Snakemake doesn't know what strains you want it to make dbs/*-db for. You could tell it on the command line, i.e., specify the targets concretely:

$ snakemake -n --snakefile snakefile.txt --cores 2 -p dbs/A-db dbs/B-db dbs/C-db

or you can add an umbrella rule that fans out to all the strains. Make it the first rule in the snakefile as that is the default target rule used when you don't specify any on the command line:

rule make_db_all:
input:
    expand("dbs/{strain}-db", strain = STRAINS)
ADD COMMENT
0
Entering edit mode

Thank you!! This got the command to run! Do I need to make a rule like that before every rule that uses wildcards?

ADD REPLY

Login before adding your answer.

Traffic: 2021 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6