text: user96: I'm about to run samtools sort (version 1.6) and I'm reviewing the available configuration options.
  $ samtools sort
  Usage: samtools sort [options...] [in.bam]
  Options:
    -l INT     Set compression level, from 0 (uncompressed) to 9 (best)
    -m INT     Set maximum memory per thread; suffix K/M/G recognized [768M]
    -n         Sort by read name
    -t TAG     Sort by value of TAG. Uses position as secondary index (or read name if -n is set)
    -o FILE    Write final output to FILE rather than standard output
    -T PREFIX  Write temporary files to PREFIX.nnnn.bam
        --input-fmt-option OPT[=VAL]
                 Specify a single input file format option in the form
                 of OPTION or OPTION=VALUE
    -O, --output-fmt FORMAT[,OPT[=VAL]]...
                 Specify output format (SAM, BAM, CRAM)
        --output-fmt-option OPT[=VAL]
                 Specify a single output file format option in the form
                 of OPTION or OPTION=VALUE
        --reference FILE
                 Reference sequence FASTA FILE [null]
    -@, --threads INT
                 Number of additional threads to use [0]
  
  I'm curious about the --reference flag. I've never used it before with samtools sort and I'm wondering what behavior it invokes. The online documentation doesn't even mention the flag. Under what circumstances would I want/need to specify the reference genome?
  
  user77: You would only need to supply a reference when using CRAM output encoding. The CRAM format allows storing entries without explicitly encoding the base calls, since one can instead encode the differences to the reference genome.
  With BAM output the --reference option has no effect.
  
original_text: 96: <p>I'm about to run samtools sort (version 1.6) and I'm reviewing the available configuration options.</p>
  
  <pre><code>$ samtools sort
  Usage: samtools sort [options...] [in.bam]
  Options:
    -l INT     Set compression level, from 0 (uncompressed) to 9 (best)
    -m INT     Set maximum memory per thread; suffix K/M/G recognized [768M]
    -n         Sort by read name
    -t TAG     Sort by value of TAG. Uses position as secondary index (or read name if -n is set)
    -o FILE    Write final output to FILE rather than standard output
    -T PREFIX  Write temporary files to PREFIX.nnnn.bam
        --input-fmt-option OPT[=VAL]
                 Specify a single input file format option in the form
                 of OPTION or OPTION=VALUE
    -O, --output-fmt FORMAT[,OPT[=VAL]]...
                 Specify output format (SAM, BAM, CRAM)
        --output-fmt-option OPT[=VAL]
                 Specify a single output file format option in the form
                 of OPTION or OPTION=VALUE
        --reference FILE
                 Reference sequence FASTA FILE [null]
    -@, --threads INT
                 Number of additional threads to use [0]
  </code></pre>
  
  <p>I'm curious about the <code>--reference</code> flag. I've never used it before with <code>samtools sort</code> and I'm wondering what behavior it invokes. The <a href="http://www.htslib.org/doc/samtools.html" rel="noreferrer">online documentation</a> doesn't even mention the flag. <strong>Under what circumstances would I want/need to specify the reference genome?</strong></p>
   77: <p>You would only need to supply a reference when using CRAM output encoding. The CRAM format allows storing entries without explicitly encoding the base calls, since one can instead encode the differences to the reference genome.</p>
  
  <p>With BAM output the <code>--reference</code> option has no effect.</p>
  