[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CVGFX32JPRXE8YHNB3CKPF":3,"skill-same:01M7CVGFX32JPRXE8YHNB3CKPF":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7CVGFX32JPRXE8YHNB3CKPF","bio-proteomics-quantification",null,"Quantifies protein abundance from mass spectrometry using label-free (LFQ\u002FMaxLFQ, DIA fragment-level), isobaric (TMT\u002FiTRAQ reporter ions, MS2 vs SPS-MS3), and metabolic (SILAC) approaches, including peptide-to-protein summarization (Tukey median polish, MaxLFQ, msqrob), sample-loading and IRS cross-plex normalization, and isotopic impurity correction. Use when turning peptide\u002FPSM\u002Freporter signal into a protein-by-sample abundance matrix for downstream analysis. Statistical testing of that matrix is differential-abundance; DIA quant mechanics and DIA-NN runs are dia-analysis; reading search-engine outputs is data-import; razor\u002Fshared-peptide group assignment is protein-inference.","mrsonord2240\u002Fopenscience-specialists","mrsonord2240","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F76487430?v=4","01M7CTEM40S43GSJZ9A3YCCXZK","Samuel Nord","01M7CTEM4K69JD1GBYNHVJ9ZP4",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmass-spec-proteomics-analyst\u002Fversions\u002F1.0.1\u002Fpackage\u002Fskills\u002Fbio-proteomics-quantification\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-proteomics-quantification\ndescription: Quantifies protein abundance from mass spectrometry using label-free (LFQ\u002FMaxLFQ, DIA fragment-level), isobaric (TMT\u002FiTRAQ reporter ions, MS2 vs SPS-MS3), and metabolic (SILAC) approaches, including peptide-to-protein summarization (Tukey median polish, MaxLFQ, msqrob), sample-loading and IRS cross-plex normalization, and isotopic impurity correction. Use when turning peptide\u002FPSM\u002Freporter signal into a protein-by-sample abundance matrix for downstream analysis. Statistical testing of that matrix is differential-abundance; DIA quant mechanics and DIA-NN runs are dia-analysis; reading search-engine outputs is data-import; razor\u002Fshared-peptide group assignment is protein-inference.\ntool_type: mixed\nprimary_tool: MSstats\n---\n\n## Version Compatibility\n\nReference examples tested with: MSstats 4.14.2, MSnbase 2.32.0, iq 2.0.1, numpy 2.5.3, pandas 3.0.5 (checked 2026-09-15)\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\n# Protein Quantification -- Reconstructing Protein Abundance from Ions Whose Physical Origin Dictates the Irreducible Error\n\n**\"Quantify proteins from my mass spec data\"** -> Reconstruct a protein-by-sample abundance matrix from peptide\u002Freporter ion signals, choosing a summarizer and normalizer that match where the signal physically came from -- because the measurement's physical origin sets an error that no normalization can remove.\n- R: `MSstats::dataProcess()` (Tukey median polish summarization) for label-free feature-to-protein\n- R: `iq::maxLFQ()` for MaxLFQ maximal peptide-ratio least-squares (normalize runs first; it does no delayed normalization)\n- R: `MSnbase::quantify(reporters=TMT10)` + `purityCorrect()` for isobaric reporter extraction\n- R\u002FPython: sample-loading + IRS scaling to bridge TMT plexes; per-sample median centering for LFQ\n\nScope: this skill OWNS converting peptide\u002FPSM\u002Freporter signal into a normalized protein abundance matrix (LFQ, TMT\u002FiTRAQ, SILAC; summarization; normalization; IRS). Statistical testing of the matrix -> differential-abundance. DIA quant mechanics and DIA-NN execution -> dia-analysis. Parsing MaxQuant\u002FDIA-NN outputs -> data-import. Razor\u002Fshared-peptide group assignment -> protein-inference. OUT OF SCOPE: missing-value imputation and the downshift false-positive trap (modeled in differential-abundance), and absolute copy-number calibration beyond a one-line pointer. Research quantification must not be used to classify individual patients or choose treatment; route those questions to validated clinical assays.\n\n## The Single Most Important Modern Insight\n\n1. **Every quant method answers \"where does the signal physically come from?\" differently, and that physical origin dictates the error structure no normalization can remove.** LFQ measures MS1 precursor area (or DIA fragment area) in SEPARATE runs -> the irreducible error is run-to-run variation plus stochastic, left-censored (MNAR) missingness. Isobaric TMT\u002FiTRAQ measures low-m\u002Fz reporter ions from CO-ISOLATED, co-eluting peptides in ONE spectrum -> the irreducible error is RATIO COMPRESSION toward 1:1, a PHYSICAL co-isolation effect (interloper reporters add roughly equally to every channel), attacked at the instrument by SPS-MS3 and never fully undone in software. SILAC measures a heavy\u002Flight MS1 pair in the SAME scan -> lowest per-ratio variance, but its irreducible vulnerabilities are incomplete labeling and Arg->Pro label scrambling, which bias every ratio and cannot be corrected post hoc because channels are combined before any MS (a correctly mixed sample carries no inherent mixing error). Teach the signal origin and every threshold and failure mode below follows from it.\n\n2. **The peptide-to-protein SUMMARIZATION choice is the highest-leverage decision in the pipeline, and it is invisible in the output.** In log space a peptide intensity is protein abundance + a peptide effect (ionization efficiency, flyability, missed cleavages, modifications) that spans orders of magnitude and is partly context-dependent, plus a run effect. Sum is dominated by the highest-flying peptide (dropout collapses it -> a fold change driven by detectability, not biology); mean is unbiased only if the detected peptide SET is identical across runs (it is not under MNAR); median discards relative-intensity information. Benchmarks confirm the quantification method is a dominant driver of which proteins are called differential (Lin 2022). Report the summarizer as prominently as the test, and run a sensitivity analysis across >=2 summarizers -- that is where the answer is most likely to move.\n\n## Tool Taxonomy\n\n| Tool \u002F method | Citation | Mechanism \u002F role | When |\n|---|---|---|---|\n| MaxLFQ | Cox 2014 | delayed normalization + maximal shared-peptide log-ratio least-squares; peptide scale cancels in pairwise ratios | label-free DDA\u002FDIA relative quant across many samples |\n| `iq::maxLFQ()` | Cox 2014; Pham 2020 | R implementation of MaxLFQ ratio extraction (no delayed normalization; give it run-normalized log2 input); call it, do NOT reimplement | running MaxLFQ outside MaxQuant\u002FDIA-NN |\n| MSstats Tukey median polish | Choi 2014 | iteratively subtract peptide-medians + run-medians in log space; column effects = per-sample abundance; 50% breakdown | robust label-free default summarizer |\n| msqrob (peptide-level) | Sticker 2020; Goeminne 2016 | treats the peptide effect as a covariate not noise; ridge + empirical Bayes + Huber | accuracy-critical small-n, unbalanced coverage (route OUT to differential-abundance) |\n| iBAQ | -- | sum(peptide intensities) \u002F number of theoretically observable tryptic peptides | rank \u002F order-of-magnitude within-sample abundance |\n| Top3 \u002F Hi3 | Silva 2006 | sum\u002Favg of top-3 peptide intensities, calibrate with one spiked standard | absolute amount, ~2 orders linear |\n| Proteomic ruler | Wisniewski 2014 | histone signal as internal molar reference, no spike-in | absolute copies\u002Fcell without standards |\n| Spectral counting \u002F NSAF | Zybailov 2006 | count PSMs per protein, divide by protein LENGTH then total | largely OBSOLETE; niche AP-MS only |\n| TMT\u002FiTRAQ reporter | Ting 2011; McAlister 2014 | isobaric tag; reporter ratios at MS2 or SPS-MS3 | high multiplexing, zero run-to-run variation within a plex |\n| SILAC | Ong 2002 | heavy\u002Flight precursor pair co-elute in the SAME MS1 scan | lowest-variance ratios, cell culture that can be labeled |\n| DIA fragment-level | Demichev 2020 | MaxLFQ at the FRAGMENT level then roll up (route OUT to dia-analysis) | low-missingness label-free cohorts |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|---|---|---|\n| Label-free DDA, MaxQuant evidence.txt | `MSstats::dataProcess` (TMP) | robust summarization, the workhorse; censored (AFT) imputation only with `MBimpute = TRUE` |\n| Label-free, need MaxLFQ outside MaxQuant | `iq::maxLFQ()` | the real algorithm; median centering is NOT MaxLFQ |\n| Label-free DIA matrix | -> dia-analysis | DIA-NN MaxLFQ at fragment level is owned there |\n| TMT, accuracy critical | SPS-MS3 acquisition + reporter extraction | co-isolation rejected at the instrument; software cannot fully undo compression |\n| TMT, single plex only | MS2 reporters + sample-loading normalization | within-plex ratios are stable |\n| TMT, multiple plexes | sample-loading THEN IRS bridge (Plubell 2017) | absolute reporter intensities are NOT comparable across runs without a reference channel |\n| SILAC ratios | verify labeling efficiency + Arg->Pro first | unchecked, both bias every ratio invisibly |\n| Absolute copy number | proteomic ruler or Top3 + standard | iBAQ is within-sample rank only |\n| AP-MS \u002F affinity-enrichment pulldown | do NOT median\u002FSL\u002FIRS-normalize; control subtraction (SAINT\u002FCompPASS\u002FCRAPome) | an enrichment is not a balanced proteome; data-internal normalization erases the bait signal |\n| Which summarizer? | run >=2 (TMP and MaxLFQ) and compare | this is the highest-leverage, invisible choice |\n\nDefault when uncertain: label-free DDA -> `MSstats::dataProcess` with `summaryMethod='TMP'`, `normalization='equalizeMedians'`; report the summarizer alongside results and sanity-check against `iq::maxLFQ()`.\n\n## Label-Free Summarization and Normalization\n\n### Summarize peptides to proteins with MSstats\n\n**Goal:** Turn MaxQuant feature-level evidence into a normalized protein-level abundance matrix.\n\n**Approach:** Read the MaxQuant tables with quoting off (protein names contain apostrophes), reformat to MSstats input, then `dataProcess` applies median equalization and Tukey median polish (robust to outlier peptides, 50% breakdown). With `MBimpute = FALSE` there is no censored-value model; `MBimpute = TRUE` is MSstats' AFT imputation of censored features (the only censoring route in MSstats; `groupComparison` has none). Otherwise model missingness downstream (proDA\u002Fmsqrob2 in differential-abundance).\n\n```r\nlibrary(MSstats)\n\n# quote = '' and comment.char = '': MaxQuant text fields contain apostrophes (5'-nucleotidase); default\n# quoting silently truncates the table with only an 'EOF within quoted string' warning\nevidence \u003C- read.table('evidence.txt', sep = '\\t', header = TRUE, quote = '', comment.char = '')\nprotein_groups \u003C- read.table('proteinGroups.txt', sep = '\\t', header = TRUE, quote = '', comment.char = '')\nstopifnot(nrow(evidence) == length(readLines('evidence.txt')) - 1)  # every data line was read\n\nmaxquant_input \u003C- MaxQtoMSstatsFormat(\n    evidence = evidence,\n    proteinGroups = protein_groups,\n    annotation = read.csv('annotation.csv')\n)\n\n# TMP = Tukey median polish. MBimpute = FALSE: no censoring model (censoredInt has no effect), and on\u002Foff\n# proteins later come out of groupComparison as log2FC -Inf \u002F issue 'oneConditionMissing'.\n# MBimpute = TRUE is the AFT censored-imputation route (censoredInt = 'NA' marks NA intensities as censored).\nprocessed \u003C- dataProcess(maxquant_input, normalization = 'equalizeMedians',\n                         summaryMethod = 'TMP', censoredInt = 'NA', MBimpute = FALSE)\n\nprotein_abundance \u003C- processed$ProteinLevelData\n```\n\n### Run the real MaxLFQ (not median centering)\n\n**Goal:** Produce MaxLFQ protein intensities from a peptide quant matrix.\n\n**Approach:** Call `iq::maxLFQ()`, which implements the Cox 2014 maximal peptide-ratio least-squares step. It does NOT perform delayed normalization, so run-level loading offsets pass straight into the estimates: median-normalize each run's peptide log2 intensities first. `maxLFQ()` takes ONE protein's matrix, so a whole table goes through `preprocess` -> `create_protein_list` -> `create_protein_table`. Per-sample median centering of the protein matrix shares only the name and silently gives a different answer.\n\n```r\nlibrary(iq)\n\n# peptide_long: one row per peptide ion per run, RAW intensities (protein, ion, run, intensity)\nnorm \u003C- preprocess(peptide_long, primary_id = 'protein', secondary_id = 'ion', sample_id = 'run',\n                   intensity_col = 'intensity', median_normalization = TRUE, pdf_out = NULL)\nprotein_list  \u003C- create_protein_list(norm)    # one run-normalized log2 matrix per protein\nprotein_table \u003C- create_protein_table(protein_list, method = 'maxLFQ')\nprotein_matrix \u003C- protein_table$estimate      # proteins x samples\n\n# maxLFQ solves per-protein least squares only within CONNECTED sample sets; a non-empty annotation\n# marks proteins whose samples split into groups that are NOT on one common scale\ndisconnected \u003C- rownames(protein_matrix)[nzchar(protein_table$annotation)]\n\n# one protein at a time: rows = peptide ions, columns = samples, values = RUN-NORMALIZED log2 intensities\nresult \u003C- maxLFQ(protein_list[[1]])\n# $estimate is an UNNAMED vector in the input column order; name it or samples silently transpose\nprotein_estimate \u003C- setNames(result$estimate, colnames(protein_list[[1]]))\n```\n\n### Median-center label-free intensities (a normalizer, not a summarizer)\n\n**Goal:** Correct per-sample loading differences before testing.\n\n**Approach:** Subtract each sample's median log2 intensity (corrects LOCATION only and cannot manufacture variance). It assumes most proteins are unchanged and changes are roughly symmetric: an up-heavy quantified set shifts every fold change, so check the median fold change of presumed-null proteins or normalize on a stable subset. Median centering normalizes; it does NOT summarize peptides to proteins.\n\n```python\nimport numpy as np\nimport pandas as pd\n\nlog_int = np.log2(intensities.replace(0, np.nan))    # MaxQuant writes 0 for missing; log2(0) = -inf\nsample_medians = log_int.median(axis=0)\nnormalized = log_int - sample_medians + sample_medians.median()\n```\n\n## Isobaric (TMT\u002FiTRAQ) Quantification\n\n### Extract and impurity-correct reporter ions\n\n**Goal:** Pull TMT reporter intensities from spectra and correct cross-channel isotope bleed.\n\n**Approach:** Read spectra on disk, `quantify` the reporter region, then `purityCorrect` with a LOT-SPECIFIC impurity matrix from the reagent Certificate of Analysis. `readMSnSet` reads an already-quantified text matrix and does NOT extract reporters.\n\n```r\nlibrary(MSnbase)\n\nraw \u003C- readMSData('experiment.mzML', mode = 'onDisk')\n# method='max' for centroided spectra; reporters=TMT10 defines the 126-131 reporter m\u002Fz.\n# TMTpro 16plex uses reporters = TMT16 (126..134N); MSnbase 2.32.0 has no TMT18 set.\nquant \u003C- quantify(raw, reporters = TMT10, method = 'max')\n\n# edit = FALSE: the default edit = TRUE calls edit(M) and blocks under Rscript \u002F on a cluster.\n# x = is a MANUFACTURER TEMPLATE and MSnbase ships templates only for x = 4, 6, 8, 10; any other x\n# (TMTpro 16) falls through to an unnamed diag(x) and stops with \"length of 'dimnames' [1] not equal\n# to array extent\". REPLACE with lot-specific Certificate of Analysis values -- for TMTpro the only route:\n# imp \u003C- makeImpuritiesMatrix(filename = 'lot_coa.csv', edit = FALSE)  # layout as MSnbase extdata\n#   TMT6plexPurityCorrections.csv: one row per channel, one column per neighbour OFFSET\n#   (-n\u002F2..-1, +1..+n\u002F2) in percent, so a 16plex CoA needs 16 offset columns\nimp \u003C- makeImpuritiesMatrix(x = 10, edit = FALSE)\nquant \u003C- purityCorrect(quant, imp)\n```\n\n### Bridge multiple TMT plexes with IRS\n\n**Goal:** Make reporter intensities comparable across separate TMT runs.\n\n**Approach:** Absolute reporter intensities for the same protein differ 2-5x between plexes because each plex samples a random point on the elution profile. Sample-loading normalization fixes within-run loading; the Internal Reference Scaling bridge (Plubell 2017) then pins each plex's pooled reference channel to a common per-protein value. Order: SL, then IRS. A protein whose reference is 0 or missing in any plex cannot be bridged: mask and report it rather than letting it become Inf\u002FNaN. Check the bridge on the NON-reference channels (IRS forces the reference channels equal by construction).\n\n```python\nimport numpy as np\nimport pandas as pd\n\n# protein_psm_sums: protein x channel, summed PSM reporter ions; one reference channel per plex\ndef sample_loading_normalize(plex):\n    target = plex.sum(axis=0).mean()    # common target = mean column sum within the plex\n    return plex * (target \u002F plex.sum(axis=0))\n\ndef irs_scale(plexes, ref_cols):\n    refs = pd.concat([p[ref] for p, ref in zip(plexes, ref_cols)], axis=1)\n    refs = refs.where(refs > 0)    # a 0 or missing reference cannot anchor the bridge\n    unbridged = refs.index[refs.isna().any(axis=1)]\n    if len(unbridged):\n        print(f'IRS: {len(unbridged)} proteins lack a reference in >=1 plex; set to NaN: {list(unbridged[:10])}')\n    geomean = np.exp(np.log(refs).mean(axis=1, skipna=False))    # per-protein geometric mean of references\n    out = []\n    for i, p in enumerate(plexes):\n        factor = geomean \u002F refs.iloc[:, i]    # per-protein per-plex scaling factor\n        out.append(p.mul(factor, axis=0))\n    return out\n```\n\n## SILAC Quantification\n\n**Goal:** Compute heavy\u002Flight ratios while preserving on\u002Foff biology and flagging label artifacts.\n\n**Approach:** A protein present only in the heavy channel may be the interesting biology (or a detection-limit dropout), so do not discard it -- but keep it in a presence flag, not as +\u002F-Inf inside the ratio matrix, where it turns pandas SDs into NaN and stops `eBayes(trend=TRUE, robust=TRUE)`. Verify labeling efficiency (>=95%, target 97-98%) on a heavy-only pilot and assess Arg->Pro conversion before trusting any ratio -- both bias every ratio in the same direction, so neither shows up as extra scatter.\n\n### Check labeling efficiency and Arg->Pro first\n```python\nimport numpy as np, pandas as pd\n\ndef silac_labeling_efficiency(pilot, heavy='Intensity H', light='Intensity L'):\n    '''Incorporation on a HEAVY-ONLY pilot (cells grown in heavy medium, NOTHING mixed in): every\n    light ion there is unlabeled protein. pilot = the pilot's peptide table (MaxQuant evidence.txt).'''\n    h = pd.to_numeric(pilot[heavy], errors='coerce').fillna(0.0)\n    l = pd.to_numeric(pilot[light], errors='coerce').fillna(0.0)\n    ok = (h + l) > 0\n    if not ok.any():\n        raise ValueError('no peptide has signal in either channel -- wrong columns or wrong file')\n    per_pep = h[ok] \u002F (h[ok] + l[ok])\n    eff = float(h[ok].sum() \u002F (h[ok] + l[ok]).sum())    # intensity-weighted = the number to report\n    # A 1:1 forward mix of these cells does NOT read log2 H\u002FL = 0: the unincorporated (1 - eff) of\n    # the heavy sample is counted in the LIGHT channel, so H\u002FL = eff \u002F (2 - eff) -- -0.20 at 93%.\n    return {'n_peptides': int(ok.sum()), 'incorporation': round(eff, 4),\n            'median_peptide_incorporation': round(float(per_pep.median()), 4),\n            'peptides_below_95pct': int((per_pep \u003C 0.95).sum()),\n            'expected_log2_HL_bias_at_1to1': round(float(np.log2(eff \u002F (2 - eff))), 4),\n            'pass_95pct': bool(eff >= 0.95)}\n\ndef arg_to_pro_shift(peptides, seq='Sequence', ratio='Ratio H\u002FL'):\n    '''Arg->Pro drains the heavy channel once per proline, so log2 H\u002FL falls with PROLINE COUNT.\n    The dose slope is what makes this specific -- a flat offset is incomplete labeling instead.\n    Direct route: re-search the pilot with Pro6 variable and take I(Pro6)\u002F(I(Pro6)+I(Pro0)).'''\n    r = np.log2(pd.to_numeric(peptides[ratio], errors='coerce'))\n    npro = peptides[seq].astype(str).str.count('P')\n    ok = np.isfinite(r)\n    r, npro = r[ok], npro[ok]\n    slope = float(np.polyfit(npro, r, 1)[0]) if npro.nunique() > 1 else float('nan')\n    return {'n_pro_free': int((npro == 0).sum()), 'n_pro_containing': int((npro > 0).sum()),\n            'median_log2_HL_pro_free': round(float(r[npro == 0].median()), 4),\n            'log2_HL_slope_per_proline': round(slope, 4),\n            'conversion_per_proline': round(float(1 - 2 ** slope), 4)}\n```\n\n### Ratios that keep on\u002Foff biology\n```python\nimport numpy as np\n\n# Arg10\u002FLys8 is the common pairing (avoids overlap with the +6 isotope envelope)\nSILAC_SHIFTS = {'Arg10': 10.008269, 'Lys8': 8.014199, 'Arg6': 6.020129, 'Lys6': 6.020129}\n\ndef silac_log2_ratio(heavy, light):\n    '''Vectorized over arrays\u002FSeries: log2 H\u002FL (NaN unless both channels quantified) plus a presence flag.'''\n    heavy, light = np.asarray(heavy, dtype=float), np.asarray(light, dtype=float)\n    h, l = heavy > 0, light > 0    # NaN compares False\n    with np.errstate(divide='ignore', invalid='ignore'):\n        ratio = np.where(h & l, np.log2(heavy \u002F light), np.nan)\n    presence = np.select([h & l, h, l], ['both', 'H-only', 'L-only'], default='none')    # report H-only\u002FL-only separately\n    return ratio, presence\n```\n\n## AP-MS \u002F Affinity-Enrichment Scoring\n\n**Goal:** Rank prey in a pulldown by enrichment over NEGATIVE-CONTROL IPs, not by abundance or by ratio to the input lysate.\n\n**Approach:** A pulldown is deliberately non-representative, so no data-internal normalization (median, sample-loading, IRS) applies, and the input lysate is not a control -- sticky background (ribosome, chaperones, tubulin, keratin) binds the beads in the pulldown and is diluted in the input, so \"top N over input\" returns background. The control IP is the only thing that separates a bead binder from an interactor. Require reproducible detection across bait replicates and enrichment over control, and floor absent controls at the run's detection limit so bait-only prey score finitely instead of `+Inf`.\n\n```python\nimport numpy as np, pandas as pd\n\ndef score_vs_control_ips(ip, bait_cols, ctrl_cols, fc_cutoff=2.0, min_bait_reps=None):\n    '''ip: prey x replicate RAW intensities or spectral counts; 0\u002FNaN = not detected. Prey never\n    seen in any bait IP get a NaN enrichment (nothing was measured) and are never called.'''\n    L = np.log2(ip[list(bait_cols) + list(ctrl_cols)].replace(0, np.nan).astype(float))\n    if min_bait_reps is None:\n        min_bait_reps = len(bait_cols)          # default: every bait replicate, reproducibility first\n    n_bait, n_ctrl = L[bait_cols].notna().sum(axis=1), L[ctrl_cols].notna().sum(axis=1)\n    Lf = L.copy()\n    Lf[ctrl_cols] = Lf[ctrl_cols].fillna(L[ctrl_cols].min())      # per-control-run detection floor\n    enrich = Lf[bait_cols].mean(axis=1) - Lf[ctrl_cols].mean(axis=1)\n    worst = Lf[bait_cols].min(axis=1) - Lf[ctrl_cols].max(axis=1)  # weakest bait rep vs best control\n    out = pd.DataFrame({'n_bait': n_bait, 'n_ctrl': n_ctrl,\n                        'log2_enrichment': enrich, 'worst_case_log2': worst})\n    out['interactor'] = (n_bait >= min_bait_reps) & ((n_ctrl == 0) | (enrich >= fc_cutoff))\n    return out.sort_values('log2_enrichment', ascending=False)\n```\n\nThis fold-change\u002Fpresence score is the honest ceiling for ONE bait with a few controls. For a\nprobability rather than a cutoff use SAINTexpress (spectral counts, `interaction`\u002F`prey`\u002F`bait`\nfiles -> AvgP, report BFDR \u003C= 0.01-0.05) or CompPASS WD scores across a bait MATRIX; both need\nseveral independent baits, or the CRAPome as an external control set, before their statistics mean\nanything. Feed them counts or raw intensities -- never a median\u002FSL\u002FIRS-normalized matrix.\n\n## Per-Method Failure Modes\n\n### MaxLFQ reimplemented as median centering\n**Trigger:** A homebrew function named `maxlfq` that only subtracts per-sample medians.\n**Mechanism:** Real MaxLFQ is delayed normalization plus a maximal peptide-ratio least-squares solve; median centering shares only the name.\n**Symptom:** Plausible-looking but systematically different intensities; unbalanced peptide sets handled wrongly.\n**Fix:** Call `iq::maxLFQ()` on run-normalized input, DIA-NN, or MaxQuant.\n\n### TMT ratio compression\n**Trigger:** MS2-only reporter quant on a complex sample.\n**Mechanism:** Co-isolated interloper peptides add reporters roughly equally to every channel, pulling large true ratios toward 1:1; PHYSICAL, not removable by normalization.\n**Symptom:** \"Nothing is significant\"; attenuated fold changes, inflated false negatives.\n**Fix:** SPS-MS3 acquisition, narrower isolation windows, FAIMS\u002Fion mobility, or complement-reporter methods; a PIF filter helps but MS1 purity underestimates true interference (Savitski 2013).\n\n### TMT plexes concatenated without IRS\n**Trigger:** Stacking reporter intensities from multiple plexes directly.\n**Mechanism:** Absolute reporter intensities for one protein differ 2-5x across runs from random elution-profile sampling, unrelated to abundance.\n**Symptom:** Plex appears as the dominant axis of variation; spurious cross-plex differences.\n**Fix:** Include a pooled reference channel in EVERY plex; apply sample-loading then IRS (Plubell 2017).\n\n### Isotopic impurity matrix mis-applied\n**Trigger:** Using the default\u002Fexample impurity matrix, the wrong lot, or a transposed\u002Fmis-ordered (127N vs 127C) matrix.\n**Mechanism:** A few percent of each channel bleeds to +\u002F-1 Da neighbors; wrong values mis-subtract, negative corrected intensities get clipped. In TMT10 order (126, 127N, 127C, ...) N and C channels interleave, so the 13C +1 Da neighbour of 126 is 127C, two positions away -- a CoA sheet laid out as adjacent columns is misplaced.\n**Symptom:** Adjacent channels silently biased; extreme contrasts placed in adjacent channels confounded.\n**Fix:** Use the lot-specific Certificate of Analysis values; randomize channel-to-condition assignment.\n\n### SILAC Arg->Pro conversion \u002F incomplete labeling\n**Trigger:** Pro-containing peptides or a labeling efficiency below ~95%.\n**Mechanism:** Cells convert heavy Arg to heavy Pro (+6 Da), splitting Pro-peptide signal and underestimating the heavy channel; residual light masquerades as down-regulation.\n**Symptom:** Ratios biased toward light, worse for Pro-rich proteins; invisible without a check.\n**Fix:** Proline supplementation, measure conversion per cell line, verify >=95% incorporation on a heavy-only pilot -- `silac_labeling_efficiency` and `arg_to_pro_shift` above compute both.\n\n### SILAC on\u002Foff proteins discarded as NaN\n**Trigger:** Returning NaN whenever either channel is zero.\n**Mechanism:** A protein present only in heavy (or only light) is the interesting biology, thrown away.\n**Symptom:** Largest true changes silently dropped before analysis.\n**Fix:** Flag present-in-one-channel cases (H-only \u002F L-only) in a separate column and report them as a presence table; do not put +\u002F-Inf into the matrix handed to limma. Route honest absence handling to differential-abundance.\n\n### Spectral counting \u002F NSAF used for fold changes\n**Trigger:** Reaching for PSM counts for quantitative comparison.\n**Mechanism:** Count statistics are catastrophic at low abundance and saturate; dynamic exclusion deliberately breaks count-abundance proportionality. NSAF divides intensity by protein LENGTH then total -- a count divided by total spectra is not NSAF.\n**Symptom:** Noisy, biased estimates; the wrong normalization labeled NSAF.\n**Fix:** Use MS1\u002FMS2 intensity (LFQ\u002FDIA); keep spectral counting as historical context only.\n\n### AP-MS \u002F enrichment pulldown normalized as a balanced proteome\n**Trigger:** Median\u002Fsample-loading\u002FIRS normalization applied to an affinity-purification or biotin-enrichment pulldown.\n**Mechanism:** Data-internal normalization assumes most signal is an unchanging background; a successful pulldown is deliberately non-representative (bait plus a few interactors over background), so equalizing medians or loading rescales away the enrichment being measured.\n**Symptom:** Real interactors flattened toward background; bait abundance dominates the axis of variation.\n**Fix:** Do not data-internal-normalize an enrichment; score against negative-control pulldowns with `score_vs_control_ips` above (SAINTexpress\u002FCompPASS\u002FCRAPome for a probability) or normalize to bait abundance.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|---|---|---|\n| MaxLFQ min. ratio count = 2 | Cox 2014 (default) | a single shared peptide gives a ratio with no outlier rejection; >=2 lets the median start rejecting interference; setting 1 admits unguarded single-peptide ratios |\n| PIF >= 0.75 | community filter | rejects spectra with too much interloper signal; but MS1 purity UNDERESTIMATES true reporter interference (Savitski 2013), so PIF ~0.9 can still be compressed |\n| TMT N\u002FC reporter spacing = 6.3 mDa | Thompson 2019 | 13C-vs-15N mass defect; needs high-res MS2 (>=30-50k) to resolve N from C channels |\n| Reporter match tolerance ~0.002-0.003 Da | -- | tight enough to separate 6.3 mDa N\u002FC channels at high resolution |\n| SILAC labeling efficiency >= 95% (target 97-98%) | -- | residual light contaminates the heavy channel -> false down-regulation; needs ~5-6 doublings |\n| Min peptides per protein for quant >= 2 | -- | single-peptide (one-hit) proteins are quant-unreliable |\n| Top3 uses exactly the top 3 peptides | Silva 2006 | most intense peptides are most reproducibly detected, closest to uniform per-mole response |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|---|---|---|\n| `readMSnSet` does not extract reporters | it reads an already-quantified text matrix | use `readMSData(mode='onDisk')` then `quantify(reporters=TMT10, method='max')` |\n| `log2(0) = -inf` in the matrix | MaxQuant writes 0 for \"not quantified\" | replace 0 -> NaN before any transform |\n| Reading `Intensity` when ratios needed | `Intensity` is raw, not normalized; `iBAQ` is within-sample only | use `LFQ intensity` for between-sample LFQ ratios (see data-import) |\n| Median centering called MaxLFQ | homebrew shares only the name | call `iq::maxLFQ()` \u002F DIA-NN \u002F MaxQuant |\n| `maxLFQ()` returns 8 numbers with no sample names; columns end up scrambled | `$estimate` is an unnamed vector in the input column order, and `maxLFQ()` handles ONE protein | `setNames(result$estimate, colnames(m))`; for a whole table use `preprocess` -> `create_protein_list` -> `create_protein_table` |\n| On\u002Foff proteins get `log2FC = -Inf`, `issue = oneConditionMissing`; no censored handling | `MBimpute=FALSE` means no censoring model; MSstats' AFT exists only in `dataProcess(MBimpute=TRUE)` | keep `MBimpute=TRUE` for the MSstats AFT route, or keep `FALSE` and model missingness with proDA\u002Fmsqrob2 (differential-abundance) |\n| `EOF within quoted string` and far fewer rows than the file | default `read.table` quoting on MaxQuant tables with apostrophes | `read.table(..., quote = '', comment.char = '')` or `data.table::fread`; check the row count |\n| Script hangs at `makeImpuritiesMatrix` under Rscript | default `edit = TRUE` opens an editor | `makeImpuritiesMatrix(x = 10, edit = FALSE)` or `filename = 'lot_coa.csv', edit = FALSE` |\n| `makeImpuritiesMatrix(x = 16)`: `length of 'dimnames' [1] not equal to array extent` | MSnbase templates exist only for x = 4, 6, 8, 10; TMTpro falls through to an unnamed `diag(x)` | supply the lot CoA: `makeImpuritiesMatrix(filename = 'lot_coa.csv', edit = FALSE)` with 16 offset columns; quantify with `reporters = TMT16` (there is no `TMT18`) |\n| Whole plex rows become Inf\u002FNaN after IRS | reference channel 0 or missing for that protein | mask references `\u003C= 0`\u002FNaN and report the unbridged proteins |\n| `eBayes`: `prior.weights contain NA values` on SILAC ratios | +\u002F-Inf on\u002Foff codes inside the ratio matrix | NaN ratio plus a presence flag column; drop rows with no finite ratio before `lmFit` |\n| Cross-plex TMT comparison is invalid | no reference channel \u002F no IRS | add a pooled reference channel per plex, apply SL then IRS |\n| Every unchanged protein sits below 0 in log2 H\u002FL | incomplete heavy incorporation: the unlabeled (1 - e) fraction is counted as light | measure e on a heavy-only pilot (`silac_labeling_efficiency`); a 1:1 mix then reads log2 H\u002FL = log2(e \u002F (2 - e)), -0.20 at e = 0.93 |\n| Pro-rich proteins look systematically down in SILAC | Arg->Pro conversion, once per proline | `arg_to_pro_shift`: a slope in log2 H\u002FL per proline (a flat offset is labeling, not scrambling); supplement proline |\n| AP-MS \"top N by fold change over the input lysate\" is all ribosome\u002Fchaperone\u002Ftubulin | the input is not a negative control; bead background is enriched in the IP and diluted in the input | score against control IPs (`score_vs_control_ips`) and require detection in every bait replicate |\n| MSnbase deprecation warnings | MSnbase is in maintenance mode | current pipelines use Spectra + QFeatures (`readQFeatures`, `aggregateFeatures`) |\n\n## References\n\n- Cox J, Hein MY, Luber CA, Paron I, Nagaraj N, Mann M. 2014. Accurate proteome-wide label-free quantification by delayed normalization and maximal peptide ratio extraction, termed MaxLFQ. *Mol Cell Proteomics* 13(9):2513-2526.\n- Silva JC, Gorenstein MV, Li GZ, Vissers JPC, Geromanos SJ. 2006. Absolute quantification of proteins by LCMSE: a virtue of parallel MS acquisition. *Mol Cell Proteomics* 5(1):144-156.\n- Wisniewski JR, Hein MY, Cox J, Mann M. 2014. A \"proteomic ruler\" for protein copy number and concentration estimation without spike-in standards. *Mol Cell Proteomics* 13(12):3497-3506.\n- Zybailov B, Mosley AL, Sardiu ME, et al. 2006. Statistical analysis of membrane proteome expression changes in Saccharomyces cerevisiae. *J Proteome Res* 5(9):2339-2347.\n- Ong SE, Blagoev B, Kratchmarova I, et al. 2002. Stable isotope labeling by amino acids in cell culture, SILAC, as a simple and accurate approach to expression proteomics. *Mol Cell Proteomics* 1(5):376-386.\n- Ting L, Rad R, Gygi SP, Haas W. 2011. MS3 eliminates ratio distortion in isobaric multiplexed quantitative proteomics. *Nat Methods* 8(11):937-940.\n- McAlister GC, Nusinow DP, Jedrychowski MP, Wuhr M, et al. 2014. MultiNotch MS3 enables accurate, sensitive, and multiplexed detection of differential expression across cancer cell line proteomes. *Anal Chem* 86(14):7150-7158.\n- Savitski MM, Mathieson T, Zinn N, et al. 2013. Measuring and managing ratio compression for accurate iTRAQ\u002FTMT quantification. *J Proteome Res* 12(8):3586-3598.\n- Thompson A, Wolmer N, Koncarevic S, et al. 2019. TMTpro: design, synthesis, and initial evaluation of a proline-based isobaric 16-plex tandem mass tag reagent set. *Anal Chem* 91(24):15941-15950.\n- Plubell DL, Wilmarth PA, Zhao Y, et al. 2017. Extended multiplexing of tandem mass tags (TMT) labeling reveals age and high fat diet specific proteome changes in mouse epididymal adipose tissue. *Mol Cell Proteomics* 16(5):873-890.\n- Choi M, Chang CY, Clough T, et al. 2014. MSstats: an R package for statistical analysis of quantitative mass spectrometry-based proteomic experiments. *Bioinformatics* 30(17):2524-2526.\n- Goeminne LJE, Gevaert K, Clement L. 2016. Peptide-level robust ridge regression improves estimation, sensitivity, and specificity in data-dependent quantitative label-free shotgun proteomics. *Mol Cell Proteomics* 15(2):657-668.\n- Sticker A, Goeminne L, Martens L, Clement L. 2020. Robust summarization and inference in proteome-wide label-free quantification. *Mol Cell Proteomics* 19(7):1209-1219.\n- Demichev V, Messner CB, Vernardis SI, Lilley KS, Ralser M. 2020. DIA-NN: neural networks and interference correction enable deep proteome coverage in high throughput. *Nat Methods* 17(1):41-44.\n- Pham TV, Henneman AA, Jimenez CR. 2020. iq: an R package to estimate relative protein abundances from ion quantification in DIA-MS-based proteomics. *Bioinformatics* 36(8):2611-2613.\n- Ong SE, Mann M. 2006. A practical recipe for stable isotope labeling by amino acids in cell culture (SILAC). *Nat Protoc* 1(6):2650-2660. (Incorporation check and Arg->Pro.)\n- Sowa ME, Bennett EJ, Gygi SP, Harper JW. 2009. Defining the human deubiquitinating enzyme interaction landscape. *Cell* 138(2):389-403. (CompPASS.)\n- Teo G, Liu G, Zhang J, Nesvizhskii AI, Gingras AC, Choi H. 2014. SAINTexpress: improvements and additional features in Significance Analysis of INTeractome software. *J Proteomics* 100:37-43.\n- Mellacheruvu D, Wright Z, Couzens AL, et al. 2013. The CRAPome: a contaminant repository for affinity purification mass spectrometry data. *Nat Methods* 10(8):730-736.\n- Lin MH, Wu PS, Wong TH, Lin IY, Lin J, Cox J, Yu SH. 2022. Benchmarking differential expression, imputation and quantification methods for proteomics data. *Brief Bioinform* 23(3):bbac138.\n\n## Related Skills\n\n- data-import - Parse MaxQuant\u002FDIA-NN outputs and pick the right intensity column before quantifying\n- protein-inference - Razor\u002Fshared-peptide group assignment that determines which protein a peptide counts toward\n- differential-abundance - Statistical testing, missing-value modeling, and the downshift false-positive trap\n- proteomics-qc - CV, correlation, and PCA checks that confirm normalization worked\n- dia-analysis - DIA fragment-level MaxLFQ and DIA-NN execution\n- differential-expression\u002Fde-results - Shared empirical-Bayes and FDR conventions for expression matrices\n- data-visualization\u002Fheatmaps-clustering - Visualize the normalized abundance matrix\n- workflows\u002Fproteomics-pipeline - End-to-end pipeline that calls this skill for the quant step\n","## Version Compatibility\n\nReference examples tested with: MSstats 4.14.2, MSnbase 2.32.0, iq 2.0.1, numpy 2.5.3, pandas 3.0.5 (checked 2026-09-15)\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\n# Protein Quantification -- Reconstructing Protein Abundance from Ions Whose Physical Origin Dictates the Irreducible Error\n\n**\"Quantify proteins from my mass spec data\"** -> Reconstruct a protein-by-sample abundance matrix from peptide\u002Freporter ion signals, choosing a summarizer and normalizer that match where the signal physically came from -- because the measurement's physical origin sets an error that no normalization can remove.\n- R: `MSstats::dataProcess()` (Tukey median polish summarization) for label-free feature-to-protein\n- R: `iq::maxLFQ()` for MaxLFQ maximal peptide-ratio least-squares (normalize runs first; it does no delayed normalization)\n- R: `MSnbase::quantify(reporters=TMT10)` + `purityCorrect()` for isobaric reporter extraction\n- R\u002FPython: sample-loading + IRS scaling to bridge TMT plexes; per-sample median centering for LFQ\n\nScope: this skill OWNS converting peptide\u002FPSM\u002Freporter signal into a normalized protein abundance matrix (LFQ, TMT\u002FiTRAQ, SILAC; summarization; normalization; IRS). Statistical testing of the matrix -> differential-abundance. DIA quant mechanics and DIA-NN execution -> dia-analysis. Parsing MaxQuant\u002FDIA-NN outputs -> data-import. Razor\u002Fshared-peptide group assignment -> protein-inference. OUT OF SCOPE: missing-value imputation and the downshift false-positive trap (modeled in differential-abundance), and absolute copy-number calibration beyond a one-line pointer. Research quantification must not be used to classify individual patients or choose treatment; route those questions to validated clinical assays.\n\n## The Single Most Important Modern Insight\n\n1. **Every quant method answers \"where does the signal physically come from?\" differently, and that physical origin dictates the error structure no normalization can remove.** LFQ measures MS1 precursor area (or DIA fragment area) in SEPARATE runs -> the irreducible error is run-to-run variation plus stochastic, left-censored (MNAR) missingness. Isobaric TMT\u002FiTRAQ measures low-m\u002Fz reporter ions from CO-ISOLATED, co-eluting peptides in ONE spectrum -> the irreducible error is RATIO COMPRESSION toward 1:1, a PHYSICAL co-isolation effect (interloper reporters add roughly equally to every channel), attacked at the instrument by SPS-MS3 and never fully undone in software. SILAC measures a heavy\u002Flight MS1 pair in the SAME scan -> lowest per-ratio variance, but its irreducible vulnerabilities are incomplete labeling and Arg->Pro label scrambling, which bias every ratio and cannot be corrected post hoc because channels are combined before any MS (a correctly mixed sample carries no inherent mixing error). Teach the signal origin and every threshold and failure mode below follows from it.\n\n2. **The peptide-to-protein SUMMARIZATION choice is the highest-leverage decision in the pipeline, and it is invisible in the output.** In log space a peptide intensity is protein abundance + a peptide effect (ionization efficiency, flyability, missed cleavages, modifications) that spans orders of magnitude and is partly context-dependent, plus a run effect. Sum is dominated by the highest-flying peptide (dropout collapses it -> a fold change driven by detectability, not biology); mean is unbiased only if the detected peptide SET is identical across runs (it is not under MNAR); median discards relative-intensity information. Benchmarks confirm the quantification method is a dominant driver of which proteins are called differential (Lin 2022). Report the summarizer as prominently as the test, and run a sensitivity analysis across >=2 summarizers -- that is where the answer is most likely to move.\n\n## Tool Taxonomy\n\n| Tool \u002F method | Citation | Mechanism \u002F role | When |\n|---|---|---|---|\n| MaxLFQ | Cox 2014 | delayed normalization + maximal shared-peptide log-ratio least-squares; peptide scale cancels in pairwise ratios | label-free DDA\u002FDIA relative quant across many samples |\n| `iq::maxLFQ()` | Cox 2014; Pham 2020 | R implementation of MaxLFQ ratio extraction (no delayed normalization; give it run-normalized log2 input); call it, do NOT reimplement | running MaxLFQ outside MaxQuant\u002FDIA-NN |\n| MSstats Tukey median polish | Choi 2014 | iteratively subtract peptide-medians + run-medians in log space; column effects = per-sample abundance; 50% breakdown | robust label-free default summarizer |\n| msqrob (peptide-level) | Sticker 2020; Goeminne 2016 | treats the peptide effect as a covariate not noise; ridge + empirical Bayes + Huber | accuracy-critical small-n, unbalanced coverage (route OUT to differential-abundance) |\n| iBAQ | -- | sum(peptide intensities) \u002F number of theoretically observable tryptic peptides | rank \u002F order-of-magnitude within-sample abundance |\n| Top3 \u002F Hi3 | Silva 2006 | sum\u002Favg of top-3 peptide intensities, calibrate with one spiked standard | absolute amount, ~2 orders linear |\n| Proteomic ruler | Wisniewski 2014 | histone signal as internal molar reference, no spike-in | absolute copies\u002Fcell without standards |\n| Spectral counting \u002F NSAF | Zybailov 2006 | count PSMs per protein, divide by protein LENGTH then total | largely OBSOLETE; niche AP-MS only |\n| TMT\u002FiTRAQ reporter | Ting 2011; McAlister 2014 | isobaric tag; reporter ratios at MS2 or SPS-MS3 | high multiplexing, zero run-to-run variation within a plex |\n| SILAC | Ong 2002 | heavy\u002Flight precursor pair co-elute in the SAME MS1 scan | lowest-variance ratios, cell culture that can be labeled |\n| DIA fragment-level | Demichev 2020 | MaxLFQ at the FRAGMENT level then roll up (route OUT to dia-analysis) | low-missingness label-free cohorts |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|---|---|---|\n| Label-free DDA, MaxQuant evidence.txt | `MSstats::dataProcess` (TMP) | robust summarization, the workhorse; censored (AFT) imputation only with `MBimpute = TRUE` |\n| Label-free, need MaxLFQ outside MaxQuant | `iq::maxLFQ()` | the real algorithm; median centering is NOT MaxLFQ |\n| Label-free DIA matrix | -> dia-analysis | DIA-NN MaxLFQ at fragment level is owned there |\n| TMT, accuracy critical | SPS-MS3 acquisition + reporter extraction | co-isolation rejected at the instrument; software cannot fully undo compression |\n| TMT, single plex only | MS2 reporters + sample-loading normalization | within-plex ratios are stable |\n| TMT, multiple plexes | sample-loading THEN IRS bridge (Plubell 2017) | absolute reporter intensities are NOT comparable across runs without a reference channel |\n| SILAC ratios | verify labeling efficiency + Arg->Pro first | unchecked, both bias every ratio invisibly |\n| Absolute copy number | proteomic ruler or Top3 + standard | iBAQ is within-sample rank only |\n| AP-MS \u002F affinity-enrichment pulldown | do NOT median\u002FSL\u002FIRS-normalize; control subtraction (SAINT\u002FCompPASS\u002FCRAPome) | an enrichment is not a balanced proteome; data-internal normalization erases the bait signal |\n| Which summarizer? | run >=2 (TMP and MaxLFQ) and compare | this is the highest-leverage, invisible choice |\n\nDefault when uncertain: label-free DDA -> `MSstats::dataProcess` with `summaryMethod='TMP'`, `normalization='equalizeMedians'`; report the summarizer alongside results and sanity-check against `iq::maxLFQ()`.\n\n## Label-Free Summarization and Normalization\n\n### Summarize peptides to proteins with MSstats\n\n**Goal:** Turn MaxQuant feature-level evidence into a normalized protein-level abundance matrix.\n\n**Approach:** Read the MaxQuant tables with quoting off (protein names contain apostrophes), reformat to MSstats input, then `dataProcess` applies median equalization and Tukey median polish (robust to outlier peptides, 50% breakdown). With `MBimpute = FALSE` there is no censored-value model; `MBimpute = TRUE` is MSstats' AFT imputation of censored features (the only censoring route in MSstats; `groupComparison` has none). Otherwise model missingness downstream (proDA\u002Fmsqrob2 in differential-abundance).\n\n```r\nlibrary(MSstats)\n\n# quote = '' and comment.char = '': MaxQuant text fields contain apostrophes (5'-nucleotidase); default\n# quoting silently truncates the table with only an 'EOF within quoted string' warning\nevidence \u003C- read.table('evidence.txt', sep = '\\t', header = TRUE, quote = '', comment.char = '')\nprotein_groups \u003C- read.table('proteinGroups.txt', sep = '\\t', header = TRUE, quote = '', comment.char = '')\nstopifnot(nrow(evidence) == length(readLines('evidence.txt')) - 1)  # every data line was read\n\nmaxquant_input \u003C- MaxQtoMSstatsFormat(\n    evidence = evidence,\n    proteinGroups = protein_groups,\n    annotation = read.csv('annotation.csv')\n)\n\n# TMP = Tukey median polish. MBimpute = FALSE: no censoring model (censoredInt has no effect), and on\u002Foff\n# proteins later come out of groupComparison as log2FC -Inf \u002F issue 'oneConditionMissing'.\n# MBimpute = TRUE is the AFT censored-imputation route (censoredInt = 'NA' marks NA intensities as censored).\nprocessed \u003C- dataProcess(maxquant_input, normalization = 'equalizeMedians',\n                         summaryMethod = 'TMP', censoredInt = 'NA', MBimpute = FALSE)\n\nprotein_abundance \u003C- processed$ProteinLevelData\n```\n\n### Run the real MaxLFQ (not median centering)\n\n**Goal:** Produce MaxLFQ protein intensities from a peptide quant matrix.\n\n**Approach:** Call `iq::maxLFQ()`, which implements the Cox 2014 maximal peptide-ratio least-squares step. It does NOT perform delayed normalization, so run-level loading offsets pass straight into the estimates: median-normalize each run's peptide log2 intensities first. `maxLFQ()` takes ONE protein's matrix, so a whole table goes through `preprocess` -> `create_protein_list` -> `create_protein_table`. Per-sample median centering of the protein matrix shares only the name and silently gives a different answer.\n\n```r\nlibrary(iq)\n\n# peptide_long: one row per peptide ion per run, RAW intensities (protein, ion, run, intensity)\nnorm \u003C- preprocess(peptide_long, primary_id = 'protein', secondary_id = 'ion', sample_id = 'run',\n                   intensity_col = 'intensity', median_normalization = TRUE, pdf_out = NULL)\nprotein_list  \u003C- create_protein_list(norm)    # one run-normalized log2 matrix per protein\nprotein_table \u003C- create_protein_table(protein_list, method = 'maxLFQ')\nprotein_matrix \u003C- protein_table$estimate      # proteins x samples\n\n# maxLFQ solves per-protein least squares only within CONNECTED sample sets; a non-empty annotation\n# marks proteins whose samples split into groups that are NOT on one common scale\ndisconnected \u003C- rownames(protein_matrix)[nzchar(protein_table$annotation)]\n\n# one protein at a time: rows = peptide ions, columns = samples, values = RUN-NORMALIZED log2 intensities\nresult \u003C- maxLFQ(protein_list[[1]])\n# $estimate is an UNNAMED vector in the input column order; name it or samples silently transpose\nprotein_estimate \u003C- setNames(result$estimate, colnames(protein_list[[1]]))\n```\n\n### Median-center label-free intensities (a normalizer, not a summarizer)\n\n**Goal:** Correct per-sample loading differences before testing.\n\n**Approach:** Subtract each sample's median log2 intensity (corrects LOCATION only and cannot manufacture variance). It assumes most proteins are unchanged and changes are roughly symmetric: an up-heavy quantified set shifts every fold change, so check the median fold change of presumed-null proteins or normalize on a stable subset. Median centering normalizes; it does NOT summarize peptides to proteins.\n\n```python\nimport numpy as np\nimport pandas as pd\n\nlog_int = np.log2(intensities.replace(0, np.nan))    # MaxQuant writes 0 for missing; log2(0) = -inf\nsample_medians = log_int.median(axis=0)\nnormalized = log_int - sample_medians + sample_medians.median()\n```\n\n## Isobaric (TMT\u002FiTRAQ) Quantification\n\n### Extract and impurity-correct reporter ions\n\n**Goal:** Pull TMT reporter intensities from spectra and correct cross-channel isotope bleed.\n\n**Approach:** Read spectra on disk, `quantify` the reporter region, then `purityCorrect` with a LOT-SPECIFIC impurity matrix from the reagent Certificate of Analysis. `readMSnSet` reads an already-quantified text matrix and does NOT extract reporters.\n\n```r\nlibrary(MSnbase)\n\nraw \u003C- readMSData('experiment.mzML', mode = 'onDisk')\n# method='max' for centroided spectra; reporters=TMT10 defines the 126-131 reporter m\u002Fz.\n# TMTpro 16plex uses reporters = TMT16 (126..134N); MSnbase 2.32.0 has no TMT18 set.\nquant \u003C- quantify(raw, reporters = TMT10, method = 'max')\n\n# edit = FALSE: the default edit = TRUE calls edit(M) and blocks under Rscript \u002F on a cluster.\n# x = is a MANUFACTURER TEMPLATE and MSnbase ships templates only for x = 4, 6, 8, 10; any other x\n# (TMTpro 16) falls through to an unnamed diag(x) and stops with \"length of 'dimnames' [1] not equal\n# to array extent\". REPLACE with lot-specific Certificate of Analysis values -- for TMTpro the only route:\n# imp \u003C- makeImpuritiesMatrix(filename = 'lot_coa.csv', edit = FALSE)  # layout as MSnbase extdata\n#   TMT6plexPurityCorrections.csv: one row per channel, one column per neighbour OFFSET\n#   (-n\u002F2..-1, +1..+n\u002F2) in percent, so a 16plex CoA needs 16 offset columns\nimp \u003C- makeImpuritiesMatrix(x = 10, edit = FALSE)\nquant \u003C- purityCorrect(quant, imp)\n```\n\n### Bridge multiple TMT plexes with IRS\n\n**Goal:** Make reporter intensities comparable across separate TMT runs.\n\n**Approach:** Absolute reporter intensities for the same protein differ 2-5x between plexes because each plex samples a random point on the elution profile. Sample-loading normalization fixes within-run loading; the Internal Reference Scaling bridge (Plubell 2017) then pins each plex's pooled reference channel to a common per-protein value. Order: SL, then IRS. A protein whose reference is 0 or missing in any plex cannot be bridged: mask and report it rather than letting it become Inf\u002FNaN. Check the bridge on the NON-reference channels (IRS forces the reference channels equal by construction).\n\n```python\nimport numpy as np\nimport pandas as pd\n\n# protein_psm_sums: protein x channel, summed PSM reporter ions; one reference channel per plex\ndef sample_loading_normalize(plex):\n    target = plex.sum(axis=0).mean()    # common target = mean column sum within the plex\n    return plex * (target \u002F plex.sum(axis=0))\n\ndef irs_scale(plexes, ref_cols):\n    refs = pd.concat([p[ref] for p, ref in zip(plexes, ref_cols)], axis=1)\n    refs = refs.where(refs > 0)    # a 0 or missing reference cannot anchor the bridge\n    unbridged = refs.index[refs.isna().any(axis=1)]\n    if len(unbridged):\n        print(f'IRS: {len(unbridged)} proteins lack a reference in >=1 plex; set to NaN: {list(unbridged[:10])}')\n    geomean = np.exp(np.log(refs).mean(axis=1, skipna=False))    # per-protein geometric mean of references\n    out = []\n    for i, p in enumerate(plexes):\n        factor = geomean \u002F refs.iloc[:, i]    # per-protein per-plex scaling factor\n        out.append(p.mul(factor, axis=0))\n    return out\n```\n\n## SILAC Quantification\n\n**Goal:** Compute heavy\u002Flight ratios while preserving on\u002Foff biology and flagging label artifacts.\n\n**Approach:** A protein present only in the heavy channel may be the interesting biology (or a detection-limit dropout), so do not discard it -- but keep it in a presence flag, not as +\u002F-Inf inside the ratio matrix, where it turns pandas SDs into NaN and stops `eBayes(trend=TRUE, robust=TRUE)`. Verify labeling efficiency (>=95%, target 97-98%) on a heavy-only pilot and assess Arg->Pro conversion before trusting any ratio -- both bias every ratio in the same direction, so neither shows up as extra scatter.\n\n### Check labeling efficiency and Arg->Pro first\n```python\nimport numpy as np, pandas as pd\n\ndef silac_labeling_efficiency(pilot, heavy='Intensity H', light='Intensity L'):\n    '''Incorporation on a HEAVY-ONLY pilot (cells grown in heavy medium, NOTHING mixed in): every\n    light ion there is unlabeled protein. pilot = the pilot's peptide table (MaxQuant evidence.txt).'''\n    h = pd.to_numeric(pilot[heavy], errors='coerce').fillna(0.0)\n    l = pd.to_numeric(pilot[light], errors='coerce').fillna(0.0)\n    ok = (h + l) > 0\n    if not ok.any():\n        raise ValueError('no peptide has signal in either channel -- wrong columns or wrong file')\n    per_pep = h[ok] \u002F (h[ok] + l[ok])\n    eff = float(h[ok].sum() \u002F (h[ok] + l[ok]).sum())    # intensity-weighted = the number to report\n    # A 1:1 forward mix of these cells does NOT read log2 H\u002FL = 0: the unincorporated (1 - eff) of\n    # the heavy sample is counted in the LIGHT channel, so H\u002FL = eff \u002F (2 - eff) -- -0.20 at 93%.\n    return {'n_peptides': int(ok.sum()), 'incorporation': round(eff, 4),\n            'median_peptide_incorporation': round(float(per_pep.median()), 4),\n            'peptides_below_95pct': int((per_pep \u003C 0.95).sum()),\n            'expected_log2_HL_bias_at_1to1': round(float(np.log2(eff \u002F (2 - eff))), 4),\n            'pass_95pct': bool(eff >= 0.95)}\n\ndef arg_to_pro_shift(peptides, seq='Sequence', ratio='Ratio H\u002FL'):\n    '''Arg->Pro drains the heavy channel once per proline, so log2 H\u002FL falls with PROLINE COUNT.\n    The dose slope is what makes this specific -- a flat offset is incomplete labeling instead.\n    Direct route: re-search the pilot with Pro6 variable and take I(Pro6)\u002F(I(Pro6)+I(Pro0)).'''\n    r = np.log2(pd.to_numeric(peptides[ratio], errors='coerce'))\n    npro = peptides[seq].astype(str).str.count('P')\n    ok = np.isfinite(r)\n    r, npro = r[ok], npro[ok]\n    slope = float(np.polyfit(npro, r, 1)[0]) if npro.nunique() > 1 else float('nan')\n    return {'n_pro_free': int((npro == 0).sum()), 'n_pro_containing': int((npro > 0).sum()),\n            'median_log2_HL_pro_free': round(float(r[npro == 0].median()), 4),\n            'log2_HL_slope_per_proline': round(slope, 4),\n            'conversion_per_proline': round(float(1 - 2 ** slope), 4)}\n```\n\n### Ratios that keep on\u002Foff biology\n```python\nimport numpy as np\n\n# Arg10\u002FLys8 is the common pairing (avoids overlap with the +6 isotope envelope)\nSILAC_SHIFTS = {'Arg10': 10.008269, 'Lys8': 8.014199, 'Arg6': 6.020129, 'Lys6': 6.020129}\n\ndef silac_log2_ratio(heavy, light):\n    '''Vectorized over arrays\u002FSeries: log2 H\u002FL (NaN unless both channels quantified) plus a presence flag.'''\n    heavy, light = np.asarray(heavy, dtype=float), np.asarray(light, dtype=float)\n    h, l = heavy > 0, light > 0    # NaN compares False\n    with np.errstate(divide='ignore', invalid='ignore'):\n        ratio = np.where(h & l, np.log2(heavy \u002F light), np.nan)\n    presence = np.select([h & l, h, l], ['both', 'H-only', 'L-only'], default='none')    # report H-only\u002FL-only separately\n    return ratio, presence\n```\n\n## AP-MS \u002F Affinity-Enrichment Scoring\n\n**Goal:** Rank prey in a pulldown by enrichment over NEGATIVE-CONTROL IPs, not by abundance or by ratio to the input lysate.\n\n**Approach:** A pulldown is deliberately non-representative, so no data-internal normalization (median, sample-loading, IRS) applies, and the input lysate is not a control -- sticky background (ribosome, chaperones, tubulin, keratin) binds the beads in the pulldown and is diluted in the input, so \"top N over input\" returns background. The control IP is the only thing that separates a bead binder from an interactor. Require reproducible detection across bait replicates and enrichment over control, and floor absent controls at the run's detection limit so bait-only prey score finitely instead of `+Inf`.\n\n```python\nimport numpy as np, pandas as pd\n\ndef score_vs_control_ips(ip, bait_cols, ctrl_cols, fc_cutoff=2.0, min_bait_reps=None):\n    '''ip: prey x replicate RAW intensities or spectral counts; 0\u002FNaN = not detected. Prey never\n    seen in any bait IP get a NaN enrichment (nothing was measured) and are never called.'''\n    L = np.log2(ip[list(bait_cols) + list(ctrl_cols)].replace(0, np.nan).astype(float))\n    if min_bait_reps is None:\n        min_bait_reps = len(bait_cols)          # default: every bait replicate, reproducibility first\n    n_bait, n_ctrl = L[bait_cols].notna().sum(axis=1), L[ctrl_cols].notna().sum(axis=1)\n    Lf = L.copy()\n    Lf[ctrl_cols] = Lf[ctrl_cols].fillna(L[ctrl_cols].min())      # per-control-run detection floor\n    enrich = Lf[bait_cols].mean(axis=1) - Lf[ctrl_cols].mean(axis=1)\n    worst = Lf[bait_cols].min(axis=1) - Lf[ctrl_cols].max(axis=1)  # weakest bait rep vs best control\n    out = pd.DataFrame({'n_bait': n_bait, 'n_ctrl': n_ctrl,\n                        'log2_enrichment': enrich, 'worst_case_log2': worst})\n    out['interactor'] = (n_bait >= min_bait_reps) & ((n_ctrl == 0) | (enrich >= fc_cutoff))\n    return out.sort_values('log2_enrichment', ascending=False)\n```\n\nThis fold-change\u002Fpresence score is the honest ceiling for ONE bait with a few controls. For a\nprobability rather than a cutoff use SAINTexpress (spectral counts, `interaction`\u002F`prey`\u002F`bait`\nfiles -> AvgP, report BFDR \u003C= 0.01-0.05) or CompPASS WD scores across a bait MATRIX; both need\nseveral independent baits, or the CRAPome as an external control set, before their statistics mean\nanything. Feed them counts or raw intensities -- never a median\u002FSL\u002FIRS-normalized matrix.\n\n## Per-Method Failure Modes\n\n### MaxLFQ reimplemented as median centering\n**Trigger:** A homebrew function named `maxlfq` that only subtracts per-sample medians.\n**Mechanism:** Real MaxLFQ is delayed normalization plus a maximal peptide-ratio least-squares solve; median centering shares only the name.\n**Symptom:** Plausible-looking but systematically different intensities; unbalanced peptide sets handled wrongly.\n**Fix:** Call `iq::maxLFQ()` on run-normalized input, DIA-NN, or MaxQuant.\n\n### TMT ratio compression\n**Trigger:** MS2-only reporter quant on a complex sample.\n**Mechanism:** Co-isolated interloper peptides add reporters roughly equally to every channel, pulling large true ratios toward 1:1; PHYSICAL, not removable by normalization.\n**Symptom:** \"Nothing is significant\"; attenuated fold changes, inflated false negatives.\n**Fix:** SPS-MS3 acquisition, narrower isolation windows, FAIMS\u002Fion mobility, or complement-reporter methods; a PIF filter helps but MS1 purity underestimates true interference (Savitski 2013).\n\n### TMT plexes concatenated without IRS\n**Trigger:** Stacking reporter intensities from multiple plexes directly.\n**Mechanism:** Absolute reporter intensities for one protein differ 2-5x across runs from random elution-profile sampling, unrelated to abundance.\n**Symptom:** Plex appears as the dominant axis of variation; spurious cross-plex differences.\n**Fix:** Include a pooled reference channel in EVERY plex; apply sample-loading then IRS (Plubell 2017).\n\n### Isotopic impurity matrix mis-applied\n**Trigger:** Using the default\u002Fexample impurity matrix, the wrong lot, or a transposed\u002Fmis-ordered (127N vs 127C) matrix.\n**Mechanism:** A few percent of each channel bleeds to +\u002F-1 Da neighbors; wrong values mis-subtract, negative corrected intensities get clipped. In TMT10 order (126, 127N, 127C, ...) N and C channels interleave, so the 13C +1 Da neighbour of 126 is 127C, two positions away -- a CoA sheet laid out as adjacent columns is misplaced.\n**Symptom:** Adjacent channels silently biased; extreme contrasts placed in adjacent channels confounded.\n**Fix:** Use the lot-specific Certificate of Analysis values; randomize channel-to-condition assignment.\n\n### SILAC Arg->Pro conversion \u002F incomplete labeling\n**Trigger:** Pro-containing peptides or a labeling efficiency below ~95%.\n**Mechanism:** Cells convert heavy Arg to heavy Pro (+6 Da), splitting Pro-peptide signal and underestimating the heavy channel; residual light masquerades as down-regulation.\n**Symptom:** Ratios biased toward light, worse for Pro-rich proteins; invisible without a check.\n**Fix:** Proline supplementation, measure conversion per cell line, verify >=95% incorporation on a heavy-only pilot -- `silac_labeling_efficiency` and `arg_to_pro_shift` above compute both.\n\n### SILAC on\u002Foff proteins discarded as NaN\n**Trigger:** Returning NaN whenever either channel is zero.\n**Mechanism:** A protein present only in heavy (or only light) is the interesting biology, thrown away.\n**Symptom:** Largest true changes silently dropped before analysis.\n**Fix:** Flag present-in-one-channel cases (H-only \u002F L-only) in a separate column and report them as a presence table; do not put +\u002F-Inf into the matrix handed to limma. Route honest absence handling to differential-abundance.\n\n### Spectral counting \u002F NSAF used for fold changes\n**Trigger:** Reaching for PSM counts for quantitative comparison.\n**Mechanism:** Count statistics are catastrophic at low abundance and saturate; dynamic exclusion deliberately breaks count-abundance proportionality. NSAF divides intensity by protein LENGTH then total -- a count divided by total spectra is not NSAF.\n**Symptom:** Noisy, biased estimates; the wrong normalization labeled NSAF.\n**Fix:** Use MS1\u002FMS2 intensity (LFQ\u002FDIA); keep spectral counting as historical context only.\n\n### AP-MS \u002F enrichment pulldown normalized as a balanced proteome\n**Trigger:** Median\u002Fsample-loading\u002FIRS normalization applied to an affinity-purification or biotin-enrichment pulldown.\n**Mechanism:** Data-internal normalization assumes most signal is an unchanging background; a successful pulldown is deliberately non-representative (bait plus a few interactors over background), so equalizing medians or loading rescales away the enrichment being measured.\n**Symptom:** Real interactors flattened toward background; bait abundance dominates the axis of variation.\n**Fix:** Do not data-internal-normalize an enrichment; score against negative-control pulldowns with `score_vs_control_ips` above (SAINTexpress\u002FCompPASS\u002FCRAPome for a probability) or normalize to bait abundance.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|---|---|---|\n| MaxLFQ min. ratio count = 2 | Cox 2014 (default) | a single shared peptide gives a ratio with no outlier rejection; >=2 lets the median start rejecting interference; setting 1 admits unguarded single-peptide ratios |\n| PIF >= 0.75 | community filter | rejects spectra with too much interloper signal; but MS1 purity UNDERESTIMATES true reporter interference (Savitski 2013), so PIF ~0.9 can still be compressed |\n| TMT N\u002FC reporter spacing = 6.3 mDa | Thompson 2019 | 13C-vs-15N mass defect; needs high-res MS2 (>=30-50k) to resolve N from C channels |\n| Reporter match tolerance ~0.002-0.003 Da | -- | tight enough to separate 6.3 mDa N\u002FC channels at high resolution |\n| SILAC labeling efficiency >= 95% (target 97-98%) | -- | residual light contaminates the heavy channel -> false down-regulation; needs ~5-6 doublings |\n| Min peptides per protein for quant >= 2 | -- | single-peptide (one-hit) proteins are quant-unreliable |\n| Top3 uses exactly the top 3 peptides | Silva 2006 | most intense peptides are most reproducibly detected, closest to uniform per-mole response |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|---|---|---|\n| `readMSnSet` does not extract reporters | it reads an already-quantified text matrix | use `readMSData(mode='onDisk')` then `quantify(reporters=TMT10, method='max')` |\n| `log2(0) = -inf` in the matrix | MaxQuant writes 0 for \"not quantified\" | replace 0 -> NaN before any transform |\n| Reading `Intensity` when ratios needed | `Intensity` is raw, not normalized; `iBAQ` is within-sample only | use `LFQ intensity` for between-sample LFQ ratios (see data-import) |\n| Median centering called MaxLFQ | homebrew shares only the name | call `iq::maxLFQ()` \u002F DIA-NN \u002F MaxQuant |\n| `maxLFQ()` returns 8 numbers with no sample names; columns end up scrambled | `$estimate` is an unnamed vector in the input column order, and `maxLFQ()` handles ONE protein | `setNames(result$estimate, colnames(m))`; for a whole table use `preprocess` -> `create_protein_list` -> `create_protein_table` |\n| On\u002Foff proteins get `log2FC = -Inf`, `issue = oneConditionMissing`; no censored handling | `MBimpute=FALSE` means no censoring model; MSstats' AFT exists only in `dataProcess(MBimpute=TRUE)` | keep `MBimpute=TRUE` for the MSstats AFT route, or keep `FALSE` and model missingness with proDA\u002Fmsqrob2 (differential-abundance) |\n| `EOF within quoted string` and far fewer rows than the file | default `read.table` quoting on MaxQuant tables with apostrophes | `read.table(..., quote = '', comment.char = '')` or `data.table::fread`; check the row count |\n| Script hangs at `makeImpuritiesMatrix` under Rscript | default `edit = TRUE` opens an editor | `makeImpuritiesMatrix(x = 10, edit = FALSE)` or `filename = 'lot_coa.csv', edit = FALSE` |\n| `makeImpuritiesMatrix(x = 16)`: `length of 'dimnames' [1] not equal to array extent` | MSnbase templates exist only for x = 4, 6, 8, 10; TMTpro falls through to an unnamed `diag(x)` | supply the lot CoA: `makeImpuritiesMatrix(filename = 'lot_coa.csv', edit = FALSE)` with 16 offset columns; quantify with `reporters = TMT16` (there is no `TMT18`) |\n| Whole plex rows become Inf\u002FNaN after IRS | reference channel 0 or missing for that protein | mask references `\u003C= 0`\u002FNaN and report the unbridged proteins |\n| `eBayes`: `prior.weights contain NA values` on SILAC ratios | +\u002F-Inf on\u002Foff codes inside the ratio matrix | NaN ratio plus a presence flag column; drop rows with no finite ratio before `lmFit` |\n| Cross-plex TMT comparison is invalid | no reference channel \u002F no IRS | add a pooled reference channel per plex, apply SL then IRS |\n| Every unchanged protein sits below 0 in log2 H\u002FL | incomplete heavy incorporation: the unlabeled (1 - e) fraction is counted as light | measure e on a heavy-only pilot (`silac_labeling_efficiency`); a 1:1 mix then reads log2 H\u002FL = log2(e \u002F (2 - e)), -0.20 at e = 0.93 |\n| Pro-rich proteins look systematically down in SILAC | Arg->Pro conversion, once per proline | `arg_to_pro_shift`: a slope in log2 H\u002FL per proline (a flat offset is labeling, not scrambling); supplement proline |\n| AP-MS \"top N by fold change over the input lysate\" is all ribosome\u002Fchaperone\u002Ftubulin | the input is not a negative control; bead background is enriched in the IP and diluted in the input | score against control IPs (`score_vs_control_ips`) and require detection in every bait replicate |\n| MSnbase deprecation warnings | MSnbase is in maintenance mode | current pipelines use Spectra + QFeatures (`readQFeatures`, `aggregateFeatures`) |\n\n## References\n\n- Cox J, Hein MY, Luber CA, Paron I, Nagaraj N, Mann M. 2014. Accurate proteome-wide label-free quantification by delayed normalization and maximal peptide ratio extraction, termed MaxLFQ. *Mol Cell Proteomics* 13(9):2513-2526.\n- Silva JC, Gorenstein MV, Li GZ, Vissers JPC, Geromanos SJ. 2006. Absolute quantification of proteins by LCMSE: a virtue of parallel MS acquisition. *Mol Cell Proteomics* 5(1):144-156.\n- Wisniewski JR, Hein MY, Cox J, Mann M. 2014. A \"proteomic ruler\" for protein copy number and concentration estimation without spike-in standards. *Mol Cell Proteomics* 13(12):3497-3506.\n- Zybailov B, Mosley AL, Sardiu ME, et al. 2006. Statistical analysis of membrane proteome expression changes in Saccharomyces cerevisiae. *J Proteome Res* 5(9):2339-2347.\n- Ong SE, Blagoev B, Kratchmarova I, et al. 2002. Stable isotope labeling by amino acids in cell culture, SILAC, as a simple and accurate approach to expression proteomics. *Mol Cell Proteomics* 1(5):376-386.\n- Ting L, Rad R, Gygi SP, Haas W. 2011. MS3 eliminates ratio distortion in isobaric multiplexed quantitative proteomics. *Nat Methods* 8(11):937-940.\n- McAlister GC, Nusinow DP, Jedrychowski MP, Wuhr M, et al. 2014. MultiNotch MS3 enables accurate, sensitive, and multiplexed detection of differential expression across cancer cell line proteomes. *Anal Chem* 86(14):7150-7158.\n- Savitski MM, Mathieson T, Zinn N, et al. 2013. Measuring and managing ratio compression for accurate iTRAQ\u002FTMT quantification. *J Proteome Res* 12(8):3586-3598.\n- Thompson A, Wolmer N, Koncarevic S, et al. 2019. TMTpro: design, synthesis, and initial evaluation of a proline-based isobaric 16-plex tandem mass tag reagent set. *Anal Chem* 91(24):15941-15950.\n- Plubell DL, Wilmarth PA, Zhao Y, et al. 2017. Extended multiplexing of tandem mass tags (TMT) labeling reveals age and high fat diet specific proteome changes in mouse epididymal adipose tissue. *Mol Cell Proteomics* 16(5):873-890.\n- Choi M, Chang CY, Clough T, et al. 2014. MSstats: an R package for statistical analysis of quantitative mass spectrometry-based proteomic experiments. *Bioinformatics* 30(17):2524-2526.\n- Goeminne LJE, Gevaert K, Clement L. 2016. Peptide-level robust ridge regression improves estimation, sensitivity, and specificity in data-dependent quantitative label-free shotgun proteomics. *Mol Cell Proteomics* 15(2):657-668.\n- Sticker A, Goeminne L, Martens L, Clement L. 2020. Robust summarization and inference in proteome-wide label-free quantification. *Mol Cell Proteomics* 19(7):1209-1219.\n- Demichev V, Messner CB, Vernardis SI, Lilley KS, Ralser M. 2020. DIA-NN: neural networks and interference correction enable deep proteome coverage in high throughput. *Nat Methods* 17(1):41-44.\n- Pham TV, Henneman AA, Jimenez CR. 2020. iq: an R package to estimate relative protein abundances from ion quantification in DIA-MS-based proteomics. *Bioinformatics* 36(8):2611-2613.\n- Ong SE, Mann M. 2006. A practical recipe for stable isotope labeling by amino acids in cell culture (SILAC). *Nat Protoc* 1(6):2650-2660. (Incorporation check and Arg->Pro.)\n- Sowa ME, Bennett EJ, Gygi SP, Harper JW. 2009. Defining the human deubiquitinating enzyme interaction landscape. *Cell* 138(2):389-403. (CompPASS.)\n- Teo G, Liu G, Zhang J, Nesvizhskii AI, Gingras AC, Choi H. 2014. SAINTexpress: improvements and additional features in Significance Analysis of INTeractome software. *J Proteomics* 100:37-43.\n- Mellacheruvu D, Wright Z, Couzens AL, et al. 2013. The CRAPome: a contaminant repository for affinity purification mass spectrometry data. *Nat Methods* 10(8):730-736.\n- Lin MH, Wu PS, Wong TH, Lin IY, Lin J, Cox J, Yu SH. 2022. Benchmarking differential expression, imputation and quantification methods for proteomics data. *Brief Bioinform* 23(3):bbac138.\n\n## Related Skills\n\n- data-import - Parse MaxQuant\u002FDIA-NN outputs and pick the right intensity column before quantifying\n- protein-inference - Razor\u002Fshared-peptide group assignment that determines which protein a peptide counts toward\n- differential-abundance - Statistical testing, missing-value modeling, and the downshift false-positive trap\n- proteomics-qc - CV, correlation, and PCA checks that confirm normalization worked\n- dia-analysis - DIA fragment-level MaxLFQ and DIA-NN execution\n- differential-expression\u002Fde-results - Shared empirical-Bayes and FDR conventions for expression matrices\n- data-visualization\u002Fheatmaps-clustering - Visualize the normalized abundance matrix\n- workflows\u002Fproteomics-pipeline - End-to-end pipeline that calls this skill for the quant step\n",{"name":5,"tool_type":24,"description":7,"primary_tool":25},"mixed","MSstats","main","e0956dc9606356ab78468936b502e55a365282e2","specialists\u002Fmass-spec-proteomics-analyst\u002Fversions\u002F1.0.1\u002Fpackage\u002Fskills\u002Fbio-proteomics-quantification",0,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists","https:\u002F\u002Fgithub.com\u002Fmrsonord2240","2026-10-12 03:19:04",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-proteomics-quantification",{"tool":39,"command":40},"bunx","bunx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-proteomics-quantification",{"tool":42,"command":43},"pnpm","pnpm dlx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-proteomics-quantification","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmass-spec-proteomics-analyst\u002Fversions\u002F1.0.1\u002Fpackage\u002Fskills\u002Fbio-proteomics-quantification\u002FSKILL.md",true,[47,53],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"examples\u002Flfq_normalization.py","SCRIPT","脚本",4038,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmass-spec-proteomics-analyst\u002Fversions\u002F1.0.1\u002Fpackage\u002Fskills\u002Fbio-proteomics-quantification\u002Fexamples\u002Flfq_normalization.py",{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"usage-guide.md","REFERENCE","参考文档",4152,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmass-spec-proteomics-analyst\u002Fversions\u002F1.0.1\u002Fpackage\u002Fskills\u002Fbio-proteomics-quantification\u002Fusage-guide.md",[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7CW36A6QAGWFE2C008M1XPG","bio-workflows-metabolomics-pipeline","Orchestrates the untargeted LC-MS metabolomics pipeline end-to-end (xcms 4.x feature extraction, QC\u002Fdrift\u002Fnormalization, confidence-stratified annotation, permutation-validated statistics, background-aware pathway mapping), naming what each stage decides and where it silently fails. Use when running a full LC-MS metabolomics study from raw mzML to enriched pathways and needing the honest handoffs between stages. Each stage defers to its component skill for parameters and traps; for stable-isotope flux (a separate branch, not this untargeted flow) see metabolomics\u002Fisotope-tracing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-workflows-metabolomics-pipeline\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7CW2Y18623NA2S1Y30FRQW1","bio-metabolomics-xcms-preprocessing","Programmatic untargeted LC-MS feature extraction in R with the modern xcms 4.x MsExperiment\u002FXcmsExperiment API, taking raw mzML to a feature table via CentWave peak detection, retention-time alignment, peak-density correspondence, gap-filling, CAMERA redundancy collapse, and built-in QC feature filtering. Use when converting centroided LC-MS runs into a features-by-samples matrix and deciding centWave\u002Fgrouping\u002Falignment parameters. For drift correction and QC\u002FCV filtering execution see metabolomics\u002Fnormalization-qc; for metabolite identification see metabolomics\u002Fmetabolite-annotation; for the MS-DIAL GUI alternative with MS2Dec deconvolution see metabolomics\u002Fmsdial-preprocessing; for downstream statistics see metabolomics\u002Fstatistical-analysis.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-xcms-preprocessing\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7CW2M364HVWPNQEKE2WP4PP","bio-metabolomics-statistical-analysis","Decision-grade statistical analysis for metabolomics intensity tables. Covers transformation and scaling (Pareto vs unit-variance as a hidden hypothesis), unsupervised structure (PCA\u002FHCA for QC), permutation-validated PLS-DA\u002FOPLS-DA (R2 vs Q2, double CV, VIP as heuristic), univariate testing (Welch\u002FMann-Whitney\u002FANOVA\u002FLMM with covariate adjustment), and dependence-aware multiple testing. Use when testing which metabolites differ, building or validating a discriminant model, choosing a scaling, or correcting many correlated tests. For sample-wise normalization\u002Fdrift correction see metabolomics\u002Fnormalization-qc; for ML classifiers and selection-inside-CV leakage see machine-learning\u002Fbiomarker-discovery and machine-learning\u002Fmodel-validation; for pathway interpretation see metabolomics\u002Fpathway-mapping; for design\u002Fpower\u002Fmultiplicity regime see experimental-design\u002Fmultiple-testing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-statistical-analysis\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7CW2BCBF851WYE03Z8XPEDQ","bio-metabolomics-pathway-mapping","Maps metabolomics results to biological pathways via over-representation (ORA), metabolite-set enrichment (MSEA\u002FQEA), mummichog\u002FPSEA on raw m\u002Fz peaks, and network-diffusion enrichment (FELLA), with correct background-set construction and honest interpretive ceilings. Use when interpreting differential metabolites or an untargeted LC-MS feature table in pathway context, choosing ORA vs MSEA vs mummichog vs topology, or setting the reference\u002Fbackground set. For annotation confidence levels feeding ORA see metabolomics\u002Fmetabolite-annotation; for gene-set concepts see pathway-analysis\u002Fgo-enrichment and pathway-analysis\u002Fgsea; for joint gene+metabolite pathways see multi-omics-integration\u002Fmofa-integration.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-pathway-mapping\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7CW21NSZMCPMF7D9CHJM718","bio-metabolomics-normalization-qc","Designs QC, corrects signal drift, removes batch effects, filters features, normalizes samples, and imputes missing values for untargeted LC-MS\u002FGC-MS metabolomics, framing each step as a measurement model that can create or erase biological signal. Use when processing a peak\u002Ffeature table before statistical analysis, choosing a drift-correction or sample-normalization method, deciding QC RSD vs D-ratio filtering, or handling left-censored missing values. The feature table is produced by metabolomics\u002Fxcms-preprocessing or metabolomics\u002Fmsdial-preprocessing; transformation\u002Fscaling for modeling defers to metabolomics\u002Fstatistical-analysis; cross-study design issues link to experimental-design\u002Fbatch-design.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7CW1SWVM0NYHVE6Q7MA3G7R","bio-metabolomics-msdial-preprocessing","Runs the MS-DIAL preprocessing workflow (peak picking, MS2Dec spectral deconvolution, alignment, gap-filling) and imports the alignment-result table into R or Python with honest filtering. Use when preprocessing LC-MS DDA\u002FDIA (SWATH) or GC-MS raw data with MS-DIAL, deciding MS-DIAL vs XCMS, configuring the MSDIALCUI console run, or parsing an MS-DIAL export into a clean feature matrix. For programmatic R peak detection and the feature-table-as-artifact framing see metabolomics\u002Fxcms-preprocessing; for lipid annotation mode see metabolomics\u002Flipidomics; for MSI-level confidence honesty see metabolomics\u002Fmetabolite-annotation; for drift correction and QC see metabolomics\u002Fnormalization-qc.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-msdial-preprocessing\u002FSKILL.md",[],[]]