Hello community, 

I am using snakemake to make a pipeline. I want to add the bowtie2-build from bowtie2 to my current snakefile as follow:

    rule bowtie2Build:
    	input: "refgenome/infected_consensus.fasta"
    	output: "output/reference"
    	shell: "bowtie2-build {input} {output}"

So I should be expecting the following files:
reference.1.bt2 
reference.2.bt2
reference.3.bt2
reference.4.bt2 
reference.rev.1.bt2 
reference.rev.2.bt2

But it seems the problem lies in the output. How can I write the output? 
You wrote this:

    rule bowtie2Build:
        input: "refgenome/infected_consensus.fasta"
        output: "output/reference"
        shell: "bowtie2-build {input} {output}"

What snakemake is going to do is to check if the file output ( in this case  "output/reference" ) exist after executing the rule. Which doesn't since it is the basename for bowtie

What you can do is to pass the basename for the index as a parameter to snakemake function. Something like the following:

     rule bowtie2Build:
        input: "refgenome/infected_consensus.fasta"
        params:
            basename="output/reference"
       output:
            output1="output/reference.1.bt2",
            output2="output/reference.2.bt2",
            output3="output/reference.3.bt2",
            output4="output/reference.4.bt2",
            outputrev1="output/reference.rev1.bt2",
            outputrev2="output/reference.rev2.bt2"
        shell: "bowtie2-build {input} {params.basename}"
