agentsclimarketplace

Filter outcome aggregation and counting

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/filter-outcome-aggregation-and-counting

Use when after applying one or more mpactr filters (mispicked, group, cv, insource) to a feature table, you need to quantify the distribution of ions by their pass/fail status across filters to understand filtering impact, identify potential over-filtering, or communicate QC results via treemap or.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill filter-outcome-aggregation-and-counting

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

filter-outcome-aggregation-and-counting

Summary

Aggregate and count ion filtering outcomes (passed/failed status) across all ions and filter types to enable downstream summarization and visualization of quality control results. This skill transforms per-ion filter status into group counts and percentages, supporting transparent reporting of how many ions survive each filtering stage.

When to use

After applying one or more mpactr filters (mispicked, group, cv, insource) to a feature table, you need to quantify the distribution of ions by their pass/fail status across filters to understand filtering impact, identify potential over-filtering, or communicate QC results via treemap or summary plots.

When NOT to use

  • Input data has not yet been filtered; apply at least one filter (e.g., filter_mispicked_ions, filter_group) before aggregating outcomes.
  • You only need to report pass/fail counts for a single ion; this skill is for population-level aggregation, not per-ion inspection.
  • qc_summary() output is unavailable or empty (indicates filtering workflow was not completed).

Inputs

  • filtered mpactr object (after applying one or more filters)
  • qc_summary() output (per-ion filter status: passed/failed for mispicked, group, replicability, insource)

Outputs

  • aggregated summary data frame (status, count, percentage columns)
  • treemap visualization (ggplot2 object or exported PNG)
  • summary statistics (total ions, count by status)

How to apply

Extract per-ion filter status from qc_summary() output, which reports whether each ion passed or failed each of the four filter types (mispicked, group, replicability, insource). Use data.table grouping operations to count ions per status category and calculate the percentage of total ions for each category. Construct a summary data frame with columns for status, count, and percentage. Render this aggregated result as a treemap using ggplot2's geom_treemap() and geom_treemap_text() to visualize tile areas proportional to ion counts and label each tile with status, count, and percentage. The treemap enables rapid visual assessment of filtering selectivity and identifies which filters are most stringent.

Related tools

  • mpactr (source of qc_summary() method and filtered feature table with per-ion filter status) — https://github.com/mums2/mpactr
  • data.table (grouping and aggregation of ion counts by filter status)
  • ggplot2 (rendering treemap visualization with geom_treemap and geom_treemap_text layers)
  • R (execution environment for qc_summary extraction, data.table operations, and ggplot rendering)

Examples

qc_out <- qc_summary(filtered_mpactr_obj); summary_df <- qc_out[, .(count = .N), by = status][, percentage := 100 * count / sum(count)]; ggplot(summary_df, aes(area = count, fill = status, label = paste(status, count, percentage, sep = "\n"))) + geom_treemap() + geom_treemap_text()

Evaluation signals

  • Aggregated ion counts sum to the total number of ions in the filtered object (invariant check).
  • All ions are assigned to exactly one status category (no missing or duplicate counts).
  • Percentages sum to 100% or very close (allowing for rounding); spot-check one or two status percentages by hand calculation from counts.
  • Treemap tiles are visually proportional to reported counts; larger counts occupy larger areas.
  • Treemap labels are readable and include status name, count, and percentage for each tile; no labels are truncated or missing.

Limitations

  • qc_summary() reports cumulative pass/fail status for each ion across all applied filters; it does not isolate the contribution of individual filters, so you cannot determine which single filter is most selective from aggregated counts alone.
  • If filters are applied with copy_object=TRUE (deep copying), memory usage may be high for large datasets; the article recommends copy_object=FALSE for efficiency, but this does not affect aggregation accuracy.
  • Treemap visualization may become crowded if there are many filter status categories; consider filtering or grouping status labels if the number of unique categories is very high.

Evidence

  • [methods] qc_summary() output and per-ion filter status extraction: "Pivot qc_summary output to count ions per status category and calculate percentage of total ions for each status."
  • [methods] data.table-based aggregation workflow: "Ion counts and percentages by status can be computed from qc_summary() output using data.table grouping"
  • [methods] treemap rendering as visualization: "Render treemap using ggplot2 with geom_treemap() for tile areas (scaled by count) and geom_treemap_text() for status labels and percentages."
  • [methods] filter types included in qc_summary: "per-ion filter status (passed/failed for mispicked, group, replicability, insource filters)"
  • [readme] mpactr filter overview from README: "mpactr is a collection of filters for the purpose of identifying high quality MS1 features by correcting peak selection errors"

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.