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:

enter image description here

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:

  1. Downsample the fastq files and rerun the entire analysis. You can do this with seqtk sample.
  2. Downsample the BAM files, which you can do with samtools view -s.
  3. 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.

  • $\begingroup$ thanks for the reply @Devon Ryan, Yes, I feel that the 3rd option is much easier. To use the 2nd option, I have to mention that the raw read counts of the transcripts were extracted from the stringtie step using prepDE.py python script [ccb.jhu.edu/software/stringtie/index.shtml?t=manual] Will there be any problem? $\endgroup$ – stack_learner Apr 24 '20 at 9:32
  • $\begingroup$ I don't use stringTie, so I can't comment with certainty. $\endgroup$ – Devon Ryan Apr 24 '20 at 9:34
  • $\begingroup$ ok. And if I have to use the 2nd option, Is this right? samtools view -s number GroupA_12.bam > GroupA_12_new.bam What I should give the fixed number for downsampling? $\endgroup$ – stack_learner Apr 24 '20 at 9:49
  • 1
    $\begingroup$ If you need 20% then 1234.2. 1234 is just a seed for reproducibility, .2 is the fraction to keep. $\endgroup$ – Devon Ryan Apr 24 '20 at 9:51
  • $\begingroup$ Small question. How to decide the fraction of reads to keep? I mean 0.2 or 0.5 or something else? On what basis I should give the fraction? $\endgroup$ – stack_learner Apr 25 '20 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.