agentsclimarketplace

Sample missingness filtering

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/sample-missingness-filtering

Use when when you have loaded (un)targeted metabolite data into a Metaboprep object and need to exclude samples with excessive missing values before quality control or statistical analysis. This is typically applied early in the QC pipeline when sample-level data completeness is a concern (e.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill sample-missingness-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

6.7 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

sample-missingness-filtering

License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->

Summary

Filter metabolomics samples from a Metaboprep object based on user-defined thresholds for missing data proportion. This step removes samples exceeding a missingness cutoff (e.g., ≥20%) to ensure adequate feature coverage before downstream analysis.

When to use

When you have loaded (un)targeted metabolite data into a Metaboprep object and need to exclude samples with excessive missing values before quality control or statistical analysis. This is typically applied early in the QC pipeline when sample-level data completeness is a concern (e.g., when some samples have incomplete LC-MS runs or systematic acquisition failures). Use this skill if your research question depends on reliable per-sample metabolite measurements across a consistent feature set.

When NOT to use

  • Input data is already a feature table or sparse matrix not wrapped in a Metaboprep object — use Metaboprep() constructor first.
  • You require all samples to be retained (e.g., in a small exploratory cohort) — adjust sample_missingness to 1.0 or skip this filter.
  • Missing data patterns are informative and should be preserved for downstream imputation or pattern analysis — consider deferring this filter or using a less aggressive threshold.

Inputs

  • Metaboprep object containing raw or preprocessed metabolite abundance matrix, sample metadata, and feature annotations

Outputs

  • Filtered Metaboprep object with QC-flagged data in the 'qc' layer
  • Updated sample metadata with exclusion codes (e.g., 'user_defined_sample_missingness')
  • Summary statistics indicating number of samples excluded by missingness threshold

How to apply

Within the quality_control() function, set the sample_missingness parameter to your chosen threshold (as a decimal; e.g., 0.2 for samples with ≥20% missing values). The function calculates the proportion of missing (zero or NA) metabolite abundances for each sample and flags samples exceeding the threshold for exclusion. Before applying, decide whether to exclude specific features from this calculation using the features_exclude_but_keep parameter (e.g., to keep xenobiotics out of missingness calculations but retain them in the final dataset). After QC completes, inspect the exclusion summary to confirm how many samples were removed and verify that the exclusion codes match your intent (e.g., 'user_defined_sample_missingness'). This threshold is typically set conservatively (0.2–0.5) to balance data completeness with sample retention.

Related tools

  • metaboprep (R package providing the quality_control() function and Metaboprep object class for metabolite data filtering and QC reporting) — https://github.com/MRCIEU/metaboprep
  • R (Programming language environment for executing the quality_control pipeline and Metaboprep workflows)

Examples

mydata <- mydata |> quality_control(source_layer = "input", sample_missingness = 0.2, feature_missingness = 0.2, total_peak_area_sd = 5, outlier_udist = 5, outlier_treatment = "leave_be", winsorize_quantile = 1.0, tree_cut_height = 0.5, pc_outlier_sd = 5)

Evaluation signals

  • Verify the number of samples excluded matches the count in the exclusion summary (e.g., 'user_defined_sample_missingness | 2').
  • Confirm excluded samples had missingness proportions ≥ the specified threshold (e.g., ≥0.2); spot-check a few flagged samples.
  • Check that the remaining samples (those not excluded) all have missingness < threshold; no false negatives.
  • Inspect the Metaboprep summary() output showing 'excluded' flags and exclusion codes to ensure the QC layer reflects the filtering.
  • Verify that features marked in features_exclude_but_keep were not used to calculate sample missingness but are still present in the final output.

Limitations

  • The filter is applied independently per sample and does not account for missing-data correlations or batch patterns; extreme missingness may still result from technical factors not captured by threshold alone.
  • Setting sample_missingness too stringently (e.g., <0.1) may over-remove samples and reduce statistical power, especially in small cohorts.
  • The function assumes missing data are represented as zero or NA in the abundance matrix; alternative missingness encodings (e.g., negative values, sentinel values) may not be detected.
  • This filter does not impute missing values; samples are excluded entirely. If metabolite patterns are informative, consider batch-specific or feature-specific thresholds instead.

Evidence

  • [methods] sample_missingness filter applied during quality_control pipeline: "Assessing for sample missingness at specified level of >=20% - excluding 0 sa"
  • [methods] sample_missingness parameter in quality_control function: "quality_control(source_layer = "input", sample_missingness = 0.2, feature_missingness = 0.2)"
  • [intro] Perform data filtering according to user-defined thresholds: "Perform data filtering on the data set using a standard pipeline and according to user-defined thresholds"
  • [methods] Exclusion summary reports sample_missingness exclusions: "user_defined_sample_missingness | 2"
  • [methods] Option to exclude features from QC filtering while retaining them: "features_exclude_but_keep parameter while retaining them in the final dataset"

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.