title: Is it possible to add a conditional statement in snakemake's rule all?
body: <p>I want to run multiple snakefiles called <code>qc.smk </code>, <code>dada2.smk</code>, <code>picrust2.smk</code>using singularity. Then there is one snakefile called <code>longitudinal.smk</code> I would like to run conditionally. For example, if longitudinal data is
  being used.</p>
  <pre><code># set vars
  
  LONGITUDINAL = config['perform_longitudinal']
  
  rule all:
    input:
      # fastqc output before trimming
      raw_html = expand(&quot;{scratch}/fastqc/{sample}_{num}_fastqc.html&quot;, scratch = SCRATCH, sample=SAMPLE_SET, num=SET_NUMS),
      raw_zip = expand(&quot;{scratch}/fastqc/{sample}_{num}_fastqc.zip&quot;, scratch = SCRATCH, sample=SAMPLE_SET, num=SET_NUMS),
      raw_multi_html = SCRATCH + &quot;/fastqc/raw_multiqc.html&quot;,
      raw_multi_stats = SCRATCH + &quot;/fastqc/raw_multiqc_general_stats.txt&quot;
  
  # there are many more files in rule all
  
  ##### setup singularity #####
  
  singularity: &quot;docker://continuumio/miniconda3&quot;
  
  ##### load rules #####
  
  include: &quot;rules/qc.smk&quot;
  include: &quot;rules/dada2.smk&quot;
  include: &quot;rules/phylogeny.smk&quot;
  include: &quot;rules/picrust2.smk&quot;
  
  if LONGITUDINAL == 'yes':
      include: 'rules/longitudinal.smk'
      print(&quot;Will perform a longitudinal analysis&quot;)
  else:
      print(&quot;no longitudinal analysis&quot;)
  </code></pre>
  <p>The code above works only if I am running a longitudinal dataset. However, when I am not running the longitudinal analysis snakemake fails and says something like:</p>
  <pre><code>MissingInputException in line 70 of /mnt/c/Users/noahs/projects/tagseq-qiime2-snakemake-1/Snakefile:
  Missing input files for rule all:
  </code></pre>
  <p>I think if I was able to add a similar conditional statement like the one I have for my external snakefile snakemake would not freak out about me not including the longitudinal snakefile.</p>