<p>Hello,</p>

<p>Which tool can perform downsampling for RNAseq dataset with more than 60 million paired reads in fastq? I have used seqtk but it has issues with large memory consumptions.</p>

<p>Thanks</p>

The <a href="https://github.com/lh3/seqtk">seqtk</a> downsampling.

# 1. Downsample a fraction of reads (useful when you know the total number):

    seqtk sample read1.fa.gz 0.2 &gt; sub1.fa
    seqtk sample read2.fa.gz 0.2 &gt; sub2.fa

It takes little memory.

# 2. Downsample a fixed number (streaming mode):

    seqtk sample read1.fa 20000 &gt; sub1.fa
    seqtk sample read2.fa 20000 &gt; sub2.fa

It uses the reservoir sampling on a stream. The peak RAM equals the size of output, independent of the input.

# 3. Downsample a fixed number (2-pass mode):

    seqtk sample -2 read1.fa.gz 20000 &gt; sub1.fa
    seqtk sample -2 read2.fa.gz 20000 &gt; sub2.fa

It reads the input twice (so twice as slow). In the first pass, it finds the sampled read indices. In the second pass, it outputs reads at the stored indices. The peak RAM is about the number of sampled reads multiplied by 24, again independent of the input. You need the latest seqtk for this 2-pass mode.
