How to downsample some of the samples in RNA-seq data? I have 40 samples and these are into two groups. I would like to perform a differential analysis between two groups. The library size of the samples is very low. But there are two samples (GroupA_12 and GroupB_2) in which the number of counts is too large compared to other samples. Please check the library sizes below:



I wanted to downsample these two cases and then would like to perform differential analysis. May I know how to downsample those two samples. 

Any help is appreciated. thanq.
You have a few options:


Downsample the fastq files and rerun the entire analysis. You can do this with seqtk sample.
Downsample the BAM files, which you can do with samtools view -s.
Divide all of the counts in the counts files by some factor and round that to an integer.


I personally prefer option 2, since it's quick and doesn't usually have any side-effects unless you use two-pass alignment or did the quantification with something like salmon. Option 3 is always tempting, but I have to say I've never been convinced that this consistently produces similar enough results to options 1 or 2.