This is a test version of Biostars. For the public version, visit https://www.biostars.org.
My snakefile won't run because of wildcards-please help!

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 answer

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)

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

Log in to answer this question.