agentsclimarketplace

Metabolomics feature matrix filtering

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/metabolomics-feature-matrix-filtering

Use when you have an aligned MemoMatrix (sample-by-feature occurrence matrix where features are MS2 peaks and neutral losses) and need to remove background noise before applying visualization or clustering techniques (MDS/PCoA, TMAP, Heatmap).From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill metabolomics-feature-matrix-filtering

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.5 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

metabolomics-feature-matrix-filtering

Summary

Remove contaminant MS2 peaks and neutral losses originating from blank samples from an aligned MS2 fingerprint matrix prior to downstream visualization. This filtering step enables selective exclusion of background contamination to improve sample-to-sample comparisons in chemodiverse metabolomics datasets.

When to use

Apply this skill when you have an aligned MemoMatrix (sample-by-feature occurrence matrix where features are MS2 peaks and neutral losses) and need to remove background noise before applying visualization or clustering techniques (MDS/PCoA, TMAP, Heatmap). Specifically, use this when blank sample metadata is available and you want to exclude peaks and losses present in any blank from the full matrix to improve signal-to-noise ratio in downstream analysis.

When NOT to use

  • Input data does not include blank samples or blank metadata is unavailable
  • The MemoMatrix has already undergone blank filtering in an upstream step
  • Analysis goal is to study contamination patterns or background composition rather than remove them

Inputs

  • Aligned MemoMatrix (sample-by-feature occurrence matrix, CSV or tabular format)
  • Blank sample metadata (sample identifiers or indices annotating which samples are blanks)
  • MS2 peaks and neutral losses data associated with each sample

Outputs

  • Filtered MemoMatrix with contaminant peaks/losses removed (CSV or tabular format)
  • Feature set suitable for downstream visualization (MDS/PCoA, TMAP, Heatmap)

How to apply

Load the aligned MemoMatrix and corresponding blank sample metadata using matchms or pandas. Scan the rows corresponding to blank samples and identify all MS2 peaks and neutral losses present in them. Remove (set to zero or delete columns for) all peaks and losses that occur in any blank sample from the full MemoMatrix. The rationale is that any peak or loss detected in a blank represents potential contamination or instrument background rather than true sample signal. Export the filtered MemoMatrix as a CSV or tabular format compatible with downstream visualization tools. Verify filtering by confirming that blank rows now contain zeros for previously detected features and that the matrix dimensions reflect removed features.

Related tools

  • matchms (Load and manipulate the aligned MemoMatrix and MS2 spectral metadata) — https://github.com/matchms/matchms
  • Python (Primary language for implementing the filtering workflow, array operations, and I/O)
  • numpy (Efficient matrix operations (masking, zeroing, column deletion) on the MemoMatrix)
  • pandas (Alternative or complementary tabular data manipulation, indexing by sample/feature names)

Examples

# After loading MemoMatrix and blank metadata with matchms/pandas:
filtered_matrix = memo_matrix.copy()
blank_features = memo_matrix.loc[memo_matrix.index.isin(blank_sample_ids)].sum(axis=0) > 0
filtered_matrix = memo_matrix.loc[:, ~blank_features]
filtered_matrix.to_csv('filtered_memo_matrix.csv')

Evaluation signals

  • Blank sample rows in the filtered matrix contain all zeros (no peaks or losses remain)
  • Column count decreased compared to the input matrix (contaminant features removed)
  • Non-blank samples retain their original peak/loss counts for features not present in any blank
  • Filtered matrix is compatible with downstream visualization tools without import errors
  • Comparison of feature overlap before/after filtering shows expected reduction in background-derived features

Limitations

  • Filtering assumes blanks are representative of true background; contamination present in multiple sample types may not be distinguished
  • Removing all occurrences of a peak/loss present in any blank may discard legitimate sample signal if that peak is truly present in both blanks and samples
  • No statistical threshold (e.g., presence in >N% of blanks) is explicitly mentioned; current method uses presence in any single blank as removal criterion
  • The effectiveness depends on the quality and representativeness of blank sample preparation and acquisition

Evidence

  • [other] MEMO applies a filtering operation that removes peaks and neutral losses originating from blank samples from the aligned fingerprint matrix, enabling selective exclusion of background contamination before visualization techniques such as MDS/PCoA, TMAP, or Heatmap are applied.: "MEMO applies a filtering operation that removes peaks and neutral losses originating from blank samples from the aligned fingerprint matrix, enabling selective exclusion of background contamination"
  • [other] 1. Load the aligned MemoMatrix (sample-by-feature occurrence matrix where features are MS2 peaks and neutral losses) and corresponding blank sample metadata using Python/matchms. 2. Identify all MS2 peaks and neutral losses present in blank samples by scanning their rows in the MemoMatrix. 3. Remove (set to zero or delete columns corresponding to) all peaks and losses that occur in any blank sample from the full MemoMatrix. 4. Export the filtered MemoMatrix as a CSV or tabular format compatible with downstream visualization tools (MDS/PCoA, TMAP, Heatmap).: "Load the aligned MemoMatrix (sample-by-feature occurrence matrix where features are MS2 peaks and neutral losses) and corresponding blank sample metadata using Python/matchms. Identify all MS2 peaks"
  • [intro] different filtering (remove peaks/losses from blanks for example) and visualization techniques (MDS/PCoA, TMAP, Heatmap, ...) can be used: "different filtering (remove peaks/losses from blanks for example) and visualization techniques (MDS/PCoA, TMAP, Heatmap, ...) can be used"
  • [other] The occurence of MS2 peaks and neutral losses (to the precursor) in each sample is counted and used to generate an MS2 fingerprint of the sample. These fingerprints can in a second stage be aligned to compare different samples.: "The occurence of MS2 peaks and neutral losses (to the precursor) in each sample is counted and used to generate an MS2 fingerprint of the sample. These fingerprints can in a second stage be aligned"

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.