Skip to content
lfu46Public

About

Shared R helpers for Wu lab proteomics analysis: TMT normalization (SL + TMM), limma differential expression, and figure theming. Verified against published OGlycoTM output.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wu-lab-r

Shared R helpers for Wu lab proteomics analysis.

Created 2026-08-04 while reorganizing OGlycoTM, which had normalize_intensity() / filter_zero_na() copy-pasted into four scripts and run_limma_DE() into three. There was no shared R code anywhere in the lab tree — all shared code was Python (mzml_utils, spectrum_annotator_ddzby, the oglyco_* modules) — so the same TMT normalization and limma pattern was being re-derived per project. NGlycoMM/data_analysis/limma_glycoprotein_diff.R is another instance.

Use

# once:  git clone https://github.com/lfu46/wu-lab-r.git
source("path/to/wu-lab-r/wulab.R")   # wulab.R sources everything under R/ relative to itself

intensity_cols <- c("Intensity.Tuni_1", "Intensity.Tuni_2", "Intensity.Tuni_3",
                    "Intensity.Ctrl_4", "Intensity.Ctrl_5", "Intensity.Ctrl_6")

norm <- quant |>
  filter_zero_na(intensity_cols) |>
  normalize_intensity(intensity_cols)     # adds _sl and _sl_tmm columns

de <- run_limma_DE(
  data           = norm,
  id_col         = "Protein.ID",
  metadata_cols  = c("Entry.Name", "Gene", "Protein.Description"),
  intensity_cols = paste0(intensity_cols, "_sl_tmm"),   # limma runs on the normalized columns
  design_matrix  = Experiment_Model,
  contrast_matrix = Contrast_Matrix
)

It is a plain sourceable module, not a package — every consumer is an analysis script, and a package would add a build/install step for no benefit. The R/ layout is package-shaped if that ever changes.

Contents

File Provides
R/tmt_normalize.R filter_zero_na(), normalize_intensity() — SL then edgeR TMM
R/limma_de.R run_limma_DE(), summarize_DE(), classify_DE()
R/theme_wulab.R theme_wulab(), save_figure(), wulab_palette, colors_cell, colors_glycan, colors_plddt

Requires tidyverse, edgeR, limma, ggplot2.

Verification

tests/test_against_oglycotm.R re-runs normalization and limma against the published OGlycoTM outputs. Byte-equivalent output is the bar before any caller is switched over.

$ Rscript tests/test_against_oglycotm.R
  HEK293T  rows 773 vs 773   max|diff| = 2.2e-16    PASS
  HepG2    rows 673 vs 673   max|diff| = 2.22e-16   PASS
  Jurkat   rows 671 vs 671   max|diff| = 2.2e-16    PASS
  limma    matched 773/773 rows  max|dlogFC| = 1.78e-14  max|dadjP| = 2.35e-13   PASS
  R MODULE GATE: PASS

The test reads from the Expansion working copy if mounted, else the network share.

Two intentional API changes from the OGlycoTM originals

Both make the helpers safe to share; neither changes the numbers.

  • normalize_intensity() requires intensity_cols. The original defaulted to OGlycoTM's six TMT channels; a shared helper must not assume an experimental design, so omitting it now errors instead of silently normalizing the wrong columns.
  • classify_DE() takes an id_col argument. The original hard-coded Protein.ID, which made it unusable for site-level tables.

Not yet extracted

Worth lifting from OGlycoTM when a second consumer appears — noted so the candidates are not lost:

  • circlize_plot() / find_link_indices() (Figure4.R) — circular heatmap with cross-sector intralinks; already copied once into NSequon_filter_comparison.R.
  • write_protein_id_sheet() / write_de_sheet() / save_table() (fix_all_tables.R) — the Supporting-Information XLSX house style.
  • wilcox_across_locations() / prepare_stat_annotations() (Figure5.R) — stacked significance brackets; the panel was cut from the paper but the helpers are the best in that repo.
  • A cached enrichGO / gseGO wrapper (ac1c05438_si_004_GO_analysis.R, OGalNAc_GSEA.R) — caching to enrichment/*.csv is what lets figure scripts re-render in seconds instead of minutes.

About

Shared R helpers for Wu lab proteomics analysis: TMT normalization (SL + TMM), limma differential expression, and figure theming. Verified against published OGlycoTM output.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages