Logo: Bioconductor Msnbase

Bioconductor Msnbase

Organisatioun
bioMate-AI
bioconductor-msnbase

MSnbase provides infrastructure for manipulation, processing and visualisation of mass spectrometry and proteomics data, ranging from raw to quantitative and annotated data.

Iwwersiicht

EditeurbioMate-AI
Repositorybiomate-bioconductor-kb
Skill-Nummbioconductor-msnbase
Stären
804
Forks
66
Matgeliwwert Dateien
Nëmmen Instruktiounen
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    bioMate-AI huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Bioconductor Msnbase an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/bioMate-AI/biomate-bioconductor-kb/tree/main/skills/proteomics/msnbase
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bioMate-AI/biomate-bioconductor-kb.git /tmp/biomate-bioconductor-kb
mkdir -p .claude/skills
cp -r /tmp/biomate-bioconductor-kb/skills/proteomics/msnbase .claude/skills/bioconductor-msnbase
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Bioconductor Msnbase an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Bioconductor Msnbase automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Bioconductor Msnbase net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

MSnbase — Comprehensive Skill Guide

Domain: Proteomics / Mass spectrometry Bioconductor: MSnbase Paper: Gatto L, Lilley KS (2012). Bioinformatics, 28(2):288-289.

Infrastructure for mass spectrometry data handling in R: reading mzML/mzXML/mzData files, spectral processing, quantification, and proteomics/metabolomics workflows.

Dependencies & Environment

Package-intrinsic requirements from the Bioconductor landing page — reproduce in any R environment.

  • Version: 2.37.0 · Bioconductor: 3.23 · R: ≥ 4.6
  • Depends: BiocGenerics, Biobase, mzR, S4Vectors, ProtGenerics
  • Imports: MsCoreUtils, PSMatch, BiocParallel, IRanges, plyr, vsn, affy, impute, pcaMethods, MALDIquant, mzID, digest, lattice, ggplot2, scales, MASS, Rcpp
  • Install: BiocManager::install("MSnbase")

When to Use

  • Read mzML/mzXML files into R for proteomics or metabolomics workflows
  • Process MS2 spectra: deisotoping, centroiding, filtering
  • TMT/iTRAQ isobaric quantification
  • Feature quantification from LC-MS data

Alternatives: Spectra (modern successor), openms (Python/C++), msqrob2 (DE protein)

Do NOT Use When

  • Large-scale DIA proteomics — use PyProphet/OpenSWATH or Spectronaut.
  • Metabolomics spectral matching — use Spectra + CompoundDb instead.
  • New projects — consider Spectra as the modern successor.

Data Requirements

RequirementDetails
Input FormatmzML, mzXML, mzData (open MS formats; convert with ProteoWizard)
NotesUse mode='onDisk' for files > 1GB to avoid memory issues

Installation

r
if (!require("BiocManager", quietly=TRUE))
    install.packages("BiocManager")
BiocManager::install("MSnbase")
library(MSnbase)

Workflows

Read and Process LC-MS Data for Proteomics

Load mzML files, filter spectra, and perform isobaric quantification

Read mzML files (on-disk mode)
r
library(MSnbase)
# on-disk mode: memory-efficient; reads spectra lazily
msdata <- readMSData(files=c("sample1.mzML","sample2.mzML"),
                     mode="onDisk",
                     msLevel.=c(1L, 2L))
msdata
Basic filtering
r
# Filter to MS2 spectra only
ms2 <- filterMsLevel(msdata, msLevel.=2L)

# Filter by retention time (RT in seconds)
ms2_rt <- filterRt(ms2, rt=c(600, 3600))

# Filter by m/z
ms2_mz <- filterMz(ms2, mz=c(400, 1400))
Centroiding profile data
r
# Smooth then pick peaks
ms2_smooth <- smooth(ms2, method="SavitzkyGolay", halfWindowSize=3)
ms2_peaks  <- pickPeaks(ms2_smooth, snr=3, method="MAD")
iTRAQ/TMT quantification
r
# Define reporter ions
reporters <- iTRAQ4  # or TMT6, TMT10, TMT11

# Quantify
msnset <- quantify(ms2_peaks,
                   method="trap",
                   reporters=reporters,
                   verbose=TRUE)
exprs(msnset)[1:5, ]  # reporter ion intensities

Key Functions & Parameters

readMSData()()

Read MS data files into an MSnExp object

ParameterDescription
filescharacter vector of mzML/mzXML file paths
mode'onDisk' (memory-efficient, recommended) | 'inMemory'
msLevel.MS levels to load (e.g. 1L, 2L, c(1L,2L))
centroided.logical: is data already centroided
verboseprint progress

filterMsLevel()()

Keep only spectra of specified MS level

ParameterDescription
objectMSnExp
msLevel.integer MS level (1L or 2L)

pickPeaks()()

Peak picking (centroiding) raw profile spectra

smooth()()

Smooth spectra with moving average or Savitzky-Golay

ParameterDescription
xMSnExp
method'SavitzkyGolay' | 'MovingAverage'
halfWindowSizewindow half-width (default 2)

combineSpectra()()

Aggregate spectra within a file/run

quantify()()

Quantify isobaric tags (TMT/iTRAQ)

ParameterDescription
objectMSnExp with MS2 spectra
method'trap' | 'max' | 'sum' | 'reporter'
reportersReporterIons object (e.g. TMT10, iTRAQ4)

Scientific Assumptions

The method assumes the following about your data and experiment:

  • Reporter ion intensities (TMT/iTRAQ) are proportional to protein abundance.
  • Missing values in quantification are missing-at-random or missing-not-at-random — treat accordingly.

Result Interpretation

  • Reporter ion intensities: normalize across samples (median or total intensity normalization).
  • MSnSet exprs(): rows = features (peptides/proteins), columns = samples; values = quantified intensities.
  • Missing values: impute with impute() function (MSnbase::impute); choose method based on missingness pattern.

Best Practices

  • Always use mode='onDisk' for large files — it avoids loading all spectra into memory.
  • Filter to required MS levels early: filterMsLevel(msdata, 2L).
  • For centroiding: smooth() then pickPeaks() in that order.
  • Use MSnbase + msqrob2 or DEP for statistical analysis after quantification.
  • MSnbase is the older package; consider Spectra for new projects.

When to Choose This vs Alternatives

AlternativePrefer this tool whenPrefer alternative when
SpectraNew projects; you need pluggable backends for large data; metabolomics spectral matching.You have existing MSnbase-based workflows or need MSnSet quantification.

Benchmark Evidence

Key studies that have validated or benchmarked this tool:

  • Gatto L, Lilley KS (2012). Bioinformatics 28:288. PMID:22113085
    MSnbase provides unified infrastructure for MS-based proteomics and metabolomics in R.

Common Errors & Troubleshooting

Error reading mzML: corrupted or non-standard file

Cause: Vendor format not fully converted to standard mzML

Fix: Re-convert with ProteoWizard/msconvert using standard parameters

Additional Notes from Official Documentation

Extracted from the MSnbase Bioconductor vignette(s)

1 Introduction

In this vignette, we will document various timings and benchmarkings of the MSnbase version 2, that focuses on on-disk data access (as opposed to in-memory ). More details about the new implementation are documented in the respective classes manual pages and in MSnbase , efficient and elegant R-based processing and visualisation of raw mass spectrometry data . Laurent Gatto, Sebastian Gibb, Johannes Rainer. bioRxiv 2020.04.29.067868; doi: https://doi.org/10.1101/2020.04.29.067868 As a benchmarking dataset, we are going to use a subset of an TMT 6-plex experiment acquired on an LTQ Orbitrap Velos, that is distributed with the msdata package We need to load the MSnbase package and set the session-wide verbosity flag to FALSE .

r
library("msdata")
f <- msdata::proteomics(full.names = TRUE,
                        pattern = "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz")
basename(f)
r
## [1] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz"

2.1 Reading data

We first read the data using the original behaviour readMSData function by setting the mode argument to "inMemory" to generates an in-memory representation of the MS2-level raw data and measure the time needed for this operation. Next, we use the readMSData function to generate an on-disk representation of the same data by setting mode = "onDisk" . Creating the on-disk experiment is considerable faster and scales to much bigger, multi-file data, both in terms of object creation time, but also in terms of object size (see next section). We must of course make sure that these two datasets are equivalent:

r
system.time(inmem <- readMSData(f, msLevel = 2,
                                mode = "inMemory",
                                centroided = TRUE))
r
##    user  system elapsed 
##   5.867   0.370   6.246

2.2 Data size

To compare the size occupied in memory of these two objects, we are going to use the object_size function from the pryr package, which accounts for the data (the spectra) in the assayData environment (as opposed to the object.size function from the utils package). The difference is explained by the fact that for ondisk , the spectra are not created and stored in memory; they are access on disk when needed, such as for example for plotting: Figure 1: Plotting in-memory and on-disk spectra

r
library("pryr")
object_size(inmem)
r
## 2.77 MB

2.3 Accessing spectra

The drawback of the on-disk representation is when the spectrum data has to actually be accessed. To compare access time, we are going to use the microbenchmark and repeat access 10 times to compare access to all 451 and a single spectrum in-memory (i.e. pre-loaded and constructed) and on-disk (i.e. on-the-fly access). While it takes order or magnitudes more time to access the data on-the-fly rather than a pre-generated spectrum, accessing all spectra is only marginally slower than accessing all spectra, as most of the time is spent preparing the file for access, which is done only once. On-disk access performance will depend on the read throughput of the disk. A comparison of the data import of the above file from an internal solid state drive and from an USB3 connected hard disk showe

r
library("microbenchmark")
mb <- microbenchmark(spectra(inmem),
                     inmem[[200]],
                     spectra(ondisk),
                     ondisk[[200]],
                     times = 10)
mb
r
## Unit: microseconds
##             expr        min         lq        mean      median         uq
##   spectra(inmem)     76.694     87.322   1312.3126    211.3235    270.330
##     inmem[[200]]     30.221     32.500     68.5462     80.4705     88.825
##  spectra(ondisk) 453102.954 456584.668 461123.4430 459971.6310 463125.542
##    ondisk[[200]] 261970.948 262110.568 269558.7601 262512.2775 267099.225
##         max neval cld
##   11023.685    10 a  
##      94.427    10 a  
##  473925.730    10  b 
##  318789.700    10   c

2.4 MS2 quantitation

Below, we perform TMT 6-plex reporter ions quantitation on the first 100 spectra and verify that the results are identical (ignoring feature names).

r
system.time(eim <- quantify(inmem[1:100], reporters = TMT6,
                            method = "max"))
r
##    user  system elapsed 
##   0.160   0.175   1.340

3.1 MS levels

On-disk support multiple MS levels in one object, while in-memory only supports a single level. While support for multiple MS levels could be added to the in-memory back-end, memory constrains make this pretty-much useless and will most likely never happen.

3.2 Serialisation

In-memory objects can be save() ed and load() ed, while on-disk canât. As a workaround, the latter can be coerced to in-memory instances with as(, "MSnExp") . We would need mzML write support in mzR to be able to implement serialisation for on-disk data.

3.4 Validity

The on-disk validObject method doesnât verify the validity on the spectra (as there arenât any to check). The validateOnDiskMSnExp function, on the other hand, instantiates all spectra and checks their validity (in addition to calling validObject ).

Resources



Run this on BioMate

This skill is the knowledge layer — when, why, and how to use msnbase. To run this analysis on your own data with managed compute, automated QC, and reproducible outputs, use BioMate — free to start.

▶ Open msnbase on BioMate →

Heefeg gestallte Froen

Wat mécht de KI-Skill Bioconductor Msnbase?

MSnbase provides infrastructure for manipulation, processing and visualisation of mass spectrometry and proteomics data, ranging from raw to quantitative and annotated data.

Firwat Bioconductor Msnbase op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Bioconductor Msnbase besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Bioconductor Msnbase an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/bioMate-AI/biomate-bioconductor-kb/tree/main/skills/proteomics/msnbase an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Bioconductor Msnbase benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Bioconductor Msnbase benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Bioconductor Msnbase domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Bioconductor Msnbase gratis?

bioMate-AI huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇