agentsclimarketplace

Bonferroni multiple testing correction

Skill HolobiomicsLab/asb-skill-collections/packs/metabolomics/ms-imaging/skills/bonferroni-multiple-testing-correction

Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill bonferroni-multiple-testing-correction

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

  • 14 stars14 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 author says it does

Copied from the file, not written here

Use when when you have performed many pairwise correlation tests between candidate parent and adduct ion intensity pairs in MSI data and need to identify statistically significant relationships while controlling for multiple-comparison bias.

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

bonferroni-multiple-testing-correction

Summary

Apply Bonferroni multiple-testing correction to control family-wise error rate when performing many pairwise statistical tests (e.g., correlation tests) on mass spectrometry imaging data. This corrects raw p-values by dividing the significance threshold by the number of tests performed, reducing false positives in high-dimensional adduct discovery.

When to use

When you have performed many pairwise correlation tests between candidate parent and adduct ion intensity pairs in MSI data and need to identify statistically significant relationships while controlling for multiple-comparison bias. Specifically, when corrPairsMSI or corrPairsMSIchunks outputs raw uncorrected p-values and you must flag which ion pairs show genuinely significant spatial co-occurrence after multiple-testing adjustment.

When NOT to use

  • When the number of pairwise tests is very small (< 10–20 pairs); Bonferroni becomes overly conservative and may fail to flag any pair as significant, especially if individual correlations are modest.
  • When you have prior biological knowledge that restricts the hypothesis space (e.g., testing only 5 pre-specified adduct forms); use a less stringent correction method such as Benjamini–Hochberg FDR control instead.
  • When raw p-values have not been computed yet; correction requires the full set of uncorrected test results to determine the multiple-comparison threshold.

Inputs

  • msimat object (MSI intensity matrix with spatial pixel coordinates and peak intensities)
  • massdiff object with matches column (annotated mass-difference table identifying candidate parent–adduct pairs)
  • raw p-values from pairwise Pearson correlation test (one per ion pair)

Outputs

  • Bonferroni-corrected significance flags (boolean: TRUE if raw p-value < α/n_tests, FALSE otherwise)
  • Annotated massdiff object with appended Significance column marking statistically robust parent–adduct pairs

How to apply

After performing Pearson correlation tests on all ion pairs in the massdiff object using corrPairsMSI, apply Bonferroni correction by dividing the significance threshold (default α=0.05) by the total number of pairwise tests performed. The corrPairsMSI function automatically computes a boolean Significance column that marks ion pairs where the raw p-value falls below the Bonferroni-adjusted threshold. Extract and retain only those pairs where Significance == TRUE, as these represent correlations unlikely to arise by chance alone across the large number of comparisons. The rationale is that with hundreds or thousands of peaks, many spurious correlations will appear significant at α=0.05 without correction; Bonferroni adjustment ensures that the reported adduct-parent pairs have controlled family-wise error rate.

Related tools

  • corrPairsMSI (Performs two-tailed Pearson correlation tests on each parent–adduct ion pair and returns raw p-values; Bonferroni correction is applied internally to flag Significance column) — https://github.com/kbseah/mass2adduct
  • corrPairsMSIchunks (Memory-efficient variant of corrPairsMSI for large datasets; chunks pairwise correlations and applies Bonferroni correction within each chunk for parallel processing) — https://github.com/kbseah/mass2adduct
  • R (Statistical computing environment in which Bonferroni correction is implemented (native statistical functions); mass2adduct package runs in R)

Examples

d.diff.annot.cor <- corrPairsMSI(d, d.diff.annot); d.sig <- d.diff.annot.cor[d.diff.annot.cor$Significance==TRUE, ]

Evaluation signals

  • Significance column in output massdiff object contains only boolean TRUE/FALSE values; no NA or numerical values.
  • The number of ion pairs flagged as significant (Significance==TRUE) is substantially smaller than the raw count of pairs with p < 0.05, confirming that correction has been applied.
  • For any pair marked Significance==TRUE, verify that raw p-value < (0.05 / total_number_of_pairs_tested); spot-check a few rows to ensure correction threshold was correctly computed.
  • When visualizing adduct ions with pointsAdducts(..., signif=TRUE), only ion pairs with Bonferroni-corrected significance are highlighted, and their number is reduced compared to an uncorrected plot.
  • Downstream biological interpretation: retained adduct pairs should show high spatial correlation (r > 0.5 or similar) and biological plausibility (e.g., mass difference matches a known matrix or salt ion).

Limitations

  • Bonferroni correction is conservative, especially with thousands of peaks; in MSI data with hundreds of detected m/z values, many true adduct relationships may be rejected due to low statistical power. Consider FDR control as an alternative if you prioritize sensitivity.
  • The correction assumes all pairwise tests are independent, which may not hold if ion intensities are spatially or biologically correlated. The README and article do not address dependence structure.
  • No built-in threshold adjustment for different hypothesis classes (e.g., separate α for known versus novel adducts); a single α=0.05 is applied uniformly across all tests.

Evidence

  • [other] raw uncorrected p-value and Significance (boolean flag after Bonferroni multiple-testing correction): "Extract correlation results: Estimate (correlation coefficient), P.value (raw uncorrected p-value), and Significance (boolean flag after Bonferroni multiple-testing correction)."
  • [other] Bonferroni p-value adjustment is the default in corrPairsMSI: "This performs a correlation test (by default two-tailed with Pearson's method) on each pair of peaks in the massdiff object."
  • [other] corrPairsMSI output includes Bonferroni-corrected significance flags: "Output is a data.frame with p-values for each ion pair. By default the cutoff for significance is p=0.05 with Bonferroni correction."
  • [other] Application of Bonferroni correction to MSI adduct correlation testing: "Call corrPairsMSI function, supplying both the msimat and annotated massdiff objects, specifying two-tailed Pearson correlation method (default)."

What ships with it

Read from the repository

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

Keep looking

Skills are one crate of 326,970. 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.