text: user10271: I am learning to use snakemake. I am following the tutorial (https://snakemake.readthedocs.io/en/stable/tutorial/tutorial.html). In the section called "Basics", steps 1  to 4 worked well, processing one sample at a time, from mapping reads until indexing alignments.
  snakemake --cores 2 sorted_reads/{A,B,C}.bam.bai
  
  However, when I add the rule for joint variant calling (step 5):
  snakemake --cores 2
  
  I get the following error:
  "WorkflowError:
  Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards at the command line, or have a rule without wildcards at the very top of your workflow (e.g. the typical "rule all" which just collects all results you want to generate in the end)."
  
  It looks like I need to do this "rule all" step, any idea how to set this up?
  This is how the snakemake file looks like:
  SAMPLES = ["A", "B", "C"]
  
  rule bwa_map:
      input:
          "data/genome.fa",
          "data/samples/{sample}.fastq"
      output:
          "mapped_reads/{sample}.bam"
      shell:
          "bwa mem {input} | samtools view -Sb - > {output}"
  
  rule samtools_sort:
      input:
          "mapped_reads/{sample}.bam"
      output:
          "sorted_reads/{sample}.bam"
      shell:
          "samtools sort -T sorted_reads/{wildcards.sample} "
          "-O bam {input} > {output}"
  
  rule samtools_index:
      input:
          "sorted_reads/{sample}.bam"
      output:
          "sorted_reads/{sample}.bam.bai"
      shell:
          "samtools index {input}"
  
  rule bcftools_call:
      input:
          fa="data/genome.fa",
          bam=expand("sorted_reads/{sample}.bam", sample=SAMPLES),
          bai=expand("sorted_reads/{sample}.bam.bai", sample=SAMPLES)
      output:
          "calls/all.vcf"
      shell:
          "bcftools mpileup -f {input.fa} {input.bam} | "
          "bcftools call -mv - > {output}"
  
  
  user650: Read the snakemake documentation. all is a pseudo-rule that accepts a set of one or more final output files as input and does nothing with them.
  
original_text: 10271: <p>I am learning to use snakemake. I am following the tutorial (<a href="https://snakemake.readthedocs.io/en/stable/tutorial/tutorial.html" rel="nofollow noreferrer">https://snakemake.readthedocs.io/en/stable/tutorial/tutorial.html</a>). In the section called &quot;Basics&quot;, steps 1  to 4 worked well, processing one sample at a time, from mapping reads until indexing alignments.</p>
  <pre><code>snakemake --cores 2 sorted_reads/{A,B,C}.bam.bai
  </code></pre>
  <p>However, when I add the rule for joint variant calling (step 5):</p>
  <pre><code>snakemake --cores 2
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>&quot;WorkflowError:
  Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards at the command line, or have a rule without wildcards at the very top of your workflow (e.g. the typical &quot;rule all&quot; which just collects all results you want to generate in the end).&quot;
  </code></pre>
  <p>It looks like I need to do this &quot;rule all&quot; step, any idea how to set this up?</p>
  <p>This is how the snakemake file looks like:</p>
  <pre><code>SAMPLES = [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;]
  
  rule bwa_map:
      input:
          &quot;data/genome.fa&quot;,
          &quot;data/samples/{sample}.fastq&quot;
      output:
          &quot;mapped_reads/{sample}.bam&quot;
      shell:
          &quot;bwa mem {input} | samtools view -Sb - &gt; {output}&quot;
  
  rule samtools_sort:
      input:
          &quot;mapped_reads/{sample}.bam&quot;
      output:
          &quot;sorted_reads/{sample}.bam&quot;
      shell:
          &quot;samtools sort -T sorted_reads/{wildcards.sample} &quot;
          &quot;-O bam {input} &gt; {output}&quot;
  
  rule samtools_index:
      input:
          &quot;sorted_reads/{sample}.bam&quot;
      output:
          &quot;sorted_reads/{sample}.bam.bai&quot;
      shell:
          &quot;samtools index {input}&quot;
  
  rule bcftools_call:
      input:
          fa=&quot;data/genome.fa&quot;,
          bam=expand(&quot;sorted_reads/{sample}.bam&quot;, sample=SAMPLES),
          bai=expand(&quot;sorted_reads/{sample}.bam.bai&quot;, sample=SAMPLES)
      output:
          &quot;calls/all.vcf&quot;
      shell:
          &quot;bcftools mpileup -f {input.fa} {input.bam} | &quot;
          &quot;bcftools call -mv - &gt; {output}&quot;
  </code></pre>
   650: <p>Read <a href="https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#targets-and-aggregation" rel="nofollow noreferrer">the snakemake documentation</a>. <code>all</code> is a pseudo-rule that accepts a set of one or more final output files as input and does nothing with them.</p>
  