# How to convert CRAM file with 10x data in three fastq files

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.

• What is "10x data"? Jun 8 at 17:28
• Isn't I1 the index read not unique to 10x data? But normally demultiplexing Illumina data with bcl2fastq does not generate these reads with default arguments Jun 8 at 20:12
• @Chris_Rands (after a bit of googling) you are right. I just not aware of its existence before I run into this question on the tDToL GitHub. And then I thought I might as well put it here so it's easier to google it. Jun 8 at 22:44
• @terdon it's a type of library prep that allows long range sequencing of mate pairs. The name is weird, I fixed the link, that will hopefully help. Jun 8 at 22:50

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 \