text: user57: 10x Genomics data are stored in three FASTQ files, besides the standard R1 and R2 reads, there is also a I1 file with some metadata. Sometimes however they are shipped in a single bam/cram file (e.g. the data from the Darwin Tree of Life). How can I convert the BAM or CRAM files to FASTQ?
  -- edit --
  Apparently, the I3 file is not 10x specific thing. It is an index generated when demultiplexing any Illumina data. See this question for a nice explanation.
  
  user57: All can be done with samtools. This is how the Darwin Tree of Life folks convert it:
  samtools fastq -@4 -i \
    -1 ${sample}_S${tag}_L%03s_R1_001.fastq.gz \
    -2 ${sample}_S${tag}_L%03s_R2_001.fastq.gz \
    --i1 ${sample}_S${tag}_L%03s_I1_001.fastq.gz \
    --index-format i8 ${lane}.cram
  
  
  user74: You'll want to use the 10x provided bamtofastq tool to preserve the indices properly: https://github.com/10XGenomics/bamtofastq
  
original_text: 57: <p><a href="https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/fastq-input" rel="nofollow noreferrer">10x Genomics</a> data are stored in three FASTQ files, besides the standard R1 and R2 reads, there is also a I1 file with some metadata. Sometimes however they are shipped in a single bam/cram file (e.g. the data from the Darwin Tree of Life). How can I convert the BAM or CRAM files to FASTQ?</p>
  <p>-- edit --</p>
  <p>Apparently, the I3 file is not 10x specific thing. It is an index generated when demultiplexing any Illumina data. See <a href="https://bioinformatics.stackexchange.com/questions/5178/what-is-the-index-fastq-file-sample-i-fastq-gz-generated-when-demultiplexing">this question</a> for a nice explanation.</p>
   57: <p>All can be done with <a href="http://www.htslib.org/" rel="nofollow noreferrer">samtools</a>. This is how <a href="https://github.com/darwintreeoflife/darwintreeoflife.data/issues/2#event-4859159249" rel="nofollow noreferrer">the Darwin Tree of Life folks convert it</a>:</p>
  <pre><code>samtools fastq -@4 -i \
    -1 <span class="math-container">${sample}_S$</span>{tag}_L%03s_R1_001.fastq.gz \
    -2 <span class="math-container">${sample}_S$</span>{tag}_L%03s_R2_001.fastq.gz \
    --i1 <span class="math-container">${sample}_S$</span>{tag}_L%03s_I1_001.fastq.gz \
    --index-format i8 ${lane}.cram
  </code></pre>
   74: <p>You'll want to use the 10x provided bamtofastq tool to preserve the indices properly: <a href="https://github.com/10XGenomics/bamtofastq" rel="nofollow noreferrer">https://github.com/10XGenomics/bamtofastq</a></p>
  