Summary by TwinMind · 14m 16s

Summary by TwinMind · 14m 16s

StatQuest: edgeR, part 1, Library Normalization

StatQuest: edgeR, part 1, Library Normalization

StatQuest with Josh Starmer

StatQuest with Josh Starmer

Introduction and Background

  • StatQuest video on EdgeR library normalization part 1
  • Presented by genetics department at University of North Carolina Chapel Hill
  • EdgeR doesn't use standard normalization (RPKM, TPM)
  • Must adjust for sequencing depth AND library composition
  • Different samples contain different active genes affecting results

Step 1: Remove Untranscribed Genes

  • Remove all genes with 0 read counts across ALL samples
  • Example: 3 samples, 5 genes - gene 5 has 0 counts in all samples → removed

Step 2: Select Reference Sample

  • Pick one sample as reference for normalizing all others
  • Goal: identify most "average" sample to avoid extreme outliers
  • Bad reference example: sample with single noisy measurement

Reference Sample Selection Process:

  • Scale each sample by total read counts
    • Sum read counts per sample
    • Divide original counts by sample total
  • Calculate 75th quantile for each sample
    • Find value where 75% of scaled data ≤ that value
    • Example: Sample 1 = 0.26, Sample 2 = 0.36, Sample 3 = 0.13
  • Average the 75th quantiles
    • Example average = 0.25
  • Select sample with 75th quantile closest to average
    • Sample 1 selected (0.26 closest to 0.25)

Step 3: Gene Selection for Scaling Factors

  • Different gene sets used for each sample vs reference
  • Separate scaling factors calculated for each sample

Gene Type Categories (XY plot visualization):

  • Left side: genes primarily transcribed in reference
  • Right side: genes primarily transcribed in comparison sample
  • High: genes with many reads in both samples
  • Low: genes with few reads in both samples
  • Target: middle genes with moderate reads, minimal bias

Filtering Process:

  • Start with scaled read counts (counts ÷ sample total)
  • Calculate log2 fold differences
    • High reference vs sample → positive value
    • High sample vs reference → negative value
    • Set threshold ±6, remove extreme biases
  • Remove genes with infinite values (0 reads in either sample)

Bias Detection Tables:

  • Log ratio table: identifies biased genes
    • Example: gene 1 = log2(0/0.9) = -∞, gene 2 = log2(0.8/X) = -0.32
  • Mean of logs table: identifies high/low transcribed genes
    • Geometric mean calculation (average of log2 values)
    • Less influenced by outliers

Final Gene Filtering:

  • Sort both tables low to high
  • Remove top 30% and bottom 30% of biased genes
  • Remove top 5% and bottom 5% of highly/lowly transcribed genes
  • Use genes remaining in BOTH lists for scaling factor

Step 4: Calculate Weighted Average

  • Method: "weighted trimmed mean of log2 ratios"
  • Trimming removes extreme genes to avoid outlier effects
  • Weighting scheme: genes with more reads get higher weight
    • Log ratios have more variance with low read counts
    • Example: 4-read difference in high-count genes = small log difference
    • Same 4-read difference in low-count genes = large log difference

Step 5: Convert to Scaling Factors

  • Raise 2 to power of weighted average: 2^(weighted_average)
  • Calculate scaling factor for each sample relative to reference
  • Example actual scaling factors from RNA-seq experiment shown
  • WT2 used as reference sample

Step 6: Center Scaling Factors Around 1

  • Raw scaling factors typically centered around ~0.95
  • Centering process: divide each factor by geometric mean of all factors
  • Final factors centered on 1
  • Centering provides "nice mathematical properties" per method author Mark Robinson
  • Doesn't change results, described as "artistic signature on mathematical formula"