agentsclimarketplace

Mass spectrometry peak data loading

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/mass-spectrometry-peak-data-loading

Use when when you have raw or parsed MS spectra data (m/z values, intensity values, and spectral metadata) and need to integrate it into a Spectra object for downstream processing.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill mass-spectrometry-peak-data-loading

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

7.2 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

mass-spectrometry-peak-data-loading

Summary

Initialize a mass spectrometry backend by loading spectra variables, m/z, and intensity peak data into a structured NumericList representation. This skill implements the backendInitialize() method to populate MsBackend instances that mediate between raw MS data and the Spectra analysis framework.

When to use

When you have raw or parsed MS spectra data (m/z values, intensity values, and spectral metadata) and need to integrate it into a Spectra object for downstream processing. Specifically, when creating or populating a custom MsBackend implementation, or when wrapping an existing data source (files, databases, in-memory structures) to expose it as a Spectra-compatible backend.

When NOT to use

  • When the input m/z values are not sorted increasingly or contain missing (NA) values — preprocessing or sorting must occur before peak data loading.
  • When the input data already conforms to an existing, fully initialized backend (e.g., MsBackendMemory, MsBackendMzR) — use that backend directly instead of reimplementing.
  • When only analyzing or querying spectra without modifying or creating a new backend — use the Spectra class accessor methods (mz(), intensity(), spectraData()) directly.

Inputs

  • data.frame or DataFrame with spectra variables (metadata columns)
  • list or vector of m/z values (one per spectrum, each sorted and no NA)
  • list or vector of intensity values (one per spectrum, matching m/z length)
  • optional: complete DataFrame containing all peak and spectra variable data

Outputs

  • initialized MsBackend instance with populated spectraData() and peaksData()
  • NumericList of m/z values (one per spectrum, sorted increasingly)
  • NumericList of intensity values (one per spectrum, aligned to m/z)
  • spectra variables including dataStorage and dataOrigin

How to apply

Implement the backendInitialize() method to accept input parameters: a data.frame or DataFrame containing spectra variables (metadata), two lists or vectors containing m/z and intensity values for each spectrum, and optionally a complete DataFrame parameter. Extract and store m/z values as a NumericList, verifying they are sorted increasingly with no missing (NA) values per spectrum. Extract and store intensity values as a corresponding NumericList. Set the dataStorage spectra variable to indicate where peak data is located (e.g., 'memory', 'file', 'database'). Set the dataOrigin spectra variable to indicate the source of the data. Call a validation helper function to verify all core spectra variable data types match MsBackend API requirements (e.g., numeric, character, integer types). Return the initialized backend instance ready for use with Spectra objects.

Related tools

Evaluation signals

  • m/z values in each spectrum are sorted increasingly with no NA values (verified by internal validation helper and mz() accessor)
  • NumericList objects returned by mz() and intensity() have matching lengths (one element per spectrum in the backend)
  • dataStorage and dataOrigin spectra variables are set and non-empty (verified via spectraData() DataFrame)
  • All core spectra variable data types conform to MsBackend requirements (validated by helper function; no type mismatches)
  • Backend instance is usable with Spectra class methods: spectraData(), peaksData(), spectraVariables(), and subsetting operations (extractByIndex) succeed without error

Limitations

  • Missing (NA) values for m/z are not supported; input m/z data must be complete for each spectrum.
  • m/z values must be sorted increasingly within each spectrum; unsorted input will fail validation or produce incorrect results.
  • Backends can be read-only (e.g., MsBackendMzR) or support partial modification (spectra variables but not peaks); backendInitialize() design depends on the backend's mutability contract.
  • Large datasets may require on-disk backends (e.g., MsBackendMzR, MsBackendSql) rather than in-memory storage to avoid memory exhaustion; backendInitialize() must account for data source type.

Evidence

  • [other] Finding: core spectra variable data types validation: "validates core spectra variable data types via a helper function"
  • [intro] Finding: m/z sorting and NA requirement: "m/z values within each spectrum are expected to be sorted increasingly. Missing values (NA) for m/z values are not supported."
  • [other] Workflow: NumericList conversion: "Extract and store m/z values as NumericList, verifying they are sorted increasingly with no missing values."
  • [intro] Workflow: dataStorage and dataOrigin: "dataStorage and dataOrigin are two special spectra variables that define for each spectrum where the data is stored and from where the data derived"
  • [intro] Finding: backendInitialize purpose: "The backendInitialize() method is expected to be called after creating an instance of the backend class and should prepare (initialize) the backend"
  • [intro] Finding: spectraData DataFrame structure: "The spectraData() method should return the full spectra data within a DataFrame object"
  • [intro] Finding: peaksData method: "The peaksData() method extracts the MS peaks data from a backend, which includes the m/z and intensity values of each MS peak of a spectrum"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.