AI summary by TwinMind

StatQuest: DESeq2, part 1, Library Normalization

StatQuest with Josh Starmer

12m 41s

Introduction to DESeq2

  • StatQuest presentation from UNC Chapel Hill Genetics Department
  • Focus: DESeq2 differential gene expression analysis program
  • Complex program broken into parts - this is Part 1: Library normalization
  • DESeq2 doesn't use RPKM, FPKM, TPM methods (neither does EdgeR)

Two Main Problems in Library Normalization

Problem 1: Library Size Differences

  • Example: 6-gene genome simulation
  • Sample 1: 635 total reads mapped
  • Sample 2: 1,270 reads mapped (exactly double)
  • Read counts per gene in Sample 2 = 2x Sample 1 counts
  • Difference due to sequencing depth, not biology
  • RPKM/FPKM/TPM/CPM handle this adequately

Problem 2: Library Composition Differences

  • RNA-seq compares different tissue types (liver vs spleen)
  • Liver-specific genes transcribed in liver but not spleen
  • Same tissue comparisons: knockout transcription factors
  • Specific example: both libraries 635 reads
    • Sample 1: gene A2M highly expressed (563/635 reads)
    • Sample 2: A2M not transcribed (0 reads)
    • A2M's 563 reads redistributed to other genes in Sample 2
    • Makes other genes appear highly expressed in Sample 2
    • Only true differentially expressed gene: A2M

DESeq2 Normalization Method (7 Steps)

Step 1: Take Log of All Values

  • Uses natural log (log base e) - R programming default
  • Log(0) = negative infinity in R
  • Could use log base 2 or 10, but chose base e

Step 2: Calculate Row Averages

  • Average each gene's log values across samples
  • Adding numbers to infinity = infinity
  • Genes with zero counts have negative infinity averages
  • Log averages = geometric averages
  • Geometric averages less swayed by outliers
  • Example: Gene 3 raw average = 96, geometric average = 73.7

Step 3: Filter Genes with Infinity

  • Remove genes with infinity averages
  • Eliminates genes with zero counts in ≥1 sample
  • Liver vs spleen: removes tissue-specific genes
  • Focuses scaling on housekeeping genes

Step 4: Subtract Average from Log Counts

  • For each gene/sample: subtract average log from individual log
  • Mathematically equivalent to log(ratio)
  • Shows ratio of sample reads to average across samples
  • Identifies genes expressed above/below/at average levels

Step 5: Calculate Median Ratios per Sample

  • Calculate median of log ratios for each sample
  • Median avoids extreme gene influence
  • Huge expression differences don't sway median
  • Emphasizes moderate differences and housekeeping genes

Step 6: Convert Medians to Scaling Factors

  • Medians are log values (exponents for e)
  • Raise e to median power = scaling factor
  • Final scaling factors calculated for each sample

Step 7: Divide Original Counts by Scaling Factors

  • Apply scaling factors to original read counts
  • Include all genes (even those filtered during calculation)
  • Gene 1 example: still scaled despite zero count in Sample 1
  • Result: Sample 1 counts scaled up, Sample 3 scaled down

DESeq2 Method Summary

  • Logs eliminate tissue-specific genes, smooth outliers via geometric mean
  • Median downplays high-read genes, emphasizes moderate expression
  • Combined approach focuses scaling on housekeeping genes
  • Targets genes transcribed at similar levels across all samples

TwinMind

Get summaries like this for your own meetings

TwinMind takes notes in the background during meetings, lectures, and calls, then writes the summary for you.

Free plan to get started

No bot joins your calls

Phone, desktop & Chrome apps

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome