SKILL.md
Version Compatibility
Reference examples tested with: MSnbase 2.28+, numpy 1.26+, pandas 2.2+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures - R:
packageVersion('<pkg>')then?function_nameto verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Protein Quantification
"Quantify proteins from my mass spec data" → Extract protein abundances from MS data using label-free (LFQ, spectral counting), isobaric labeling (TMT, iTRAQ), or metabolic labeling (SILAC) approaches.
- R:
MSstats::dataProcess()for feature-to-protein summarization - Python:
pandasfor MaxLFQ-style normalization and ratio calculation - R:
MSnbasefor isobaric tag reporter ion extraction
Label-Free Quantification (LFQ)
Intensity-Based (MaxLFQ Algorithm)
import pandas as pd
import numpy as np
def maxlfq_normalize(intensities):
'''Simplified MaxLFQ normalization'''
log_int = np.log2(intensities.replace(0, np.nan))
# Median centering per sample
sample_medians = log_int.median(axis=0)
global_median = sample_medians.median()
normalized = log_int - sample_medians + global_median
return normalized
Spectral Counting
def spectral_count_normalize(counts, total_spectra):
'''Normalized spectral abundance factor (NSAF)'''
# Divide by protein length, then by total
nsaf = counts / total_spectra
return nsaf / nsaf.sum()
TMT/iTRAQ Quantification
library(MSnbase)
# Load reporter ion data
tmt_data <- readMSnSet('tmt_data.txt')
# Normalize with reference channel
tmt_normalized <- normalize(tmt_data, method = 'center.median')
# Summarize to protein level
protein_data <- combineFeatures(tmt_normalized, groupBy = fData(tmt_data)$protein,
fun = 'median')
