---
name: batch-effect-correction-and-adjustment
description: Use when your m/z peak data spans multiple batches (recorded in metadata as a batch ID column) or samples have varying concentrations that are documented in metadata.
license: CC-BY-4.0
metadata:
  edam_operation: http://edamontology.org/operation_3435
  edam_topics:
  - http://edamontology.org/topic_3172
  - http://edamontology.org/topic_0091
  tools:
  - MetaboShiny
  - R
  - XCMS
  techniques:
  - mass-spectrometry
derived_from:
- doi: 10.1007/s11306-020-01717-8
  title: MetaboShiny
evidence_spans:
- Welcome to the info page on MetaboShiny
- Welcome to the info page on MetaboShiny! We are currently on BioRXiv
- Through R
claims: []
provenance:
  collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v2
  assembled_by: scripts/collect_metabolomics_collection.py
  sources:
  - build: coll_metaboshiny_cq
    doi: 10.1007/s11306-020-01717-8
    title: MetaboShiny
  dedup_kept_from: coll_metaboshiny_cq
schema_version: 0.2.0
attribution:
  generator: AgenticScienceBuilder
  original_doi: 10.1007/s11306-020-01717-8
  all_source_dois:
  - 10.1007/s11306-020-01717-8
  zenodo_doi: 10.5281/zenodo.20794027
  curators: []
  promoter: Louis-Félix Nothias
  sponsor: CNRS & Université Côte d'Azur
---

# batch-effect-correction-and-adjustment

## Summary

Correct systematic variations in m/z peak intensities that arise from processing samples across different batches or with varying sample concentrations. This skill removes batch-related confounding effects to enable fair cross-batch and cross-sample comparison in mass spectrometry metabolomics workflows.

## When to use

Your m/z peak data spans multiple batches (recorded in metadata as a batch ID column) or samples have varying concentrations that are documented in metadata. Apply this skill before filtering and normalization if batch effects or concentration differences could bias downstream statistical comparisons or compound identification.

## When NOT to use

- Metadata contains only one batch and no concentration information — skip batch correction and proceed directly to filtering and normalization.
- Peak data has already been batch-corrected by upstream preprocessing (e.g., XCMS already applied batch correction) — applying a second correction may introduce artifact.
- Batch IDs or concentration columns are missing or incompletely populated in metadata — the correction step will fail or produce unreliable results.

## Inputs

- m/z peak data table (positive and/or negative ionization mode, from XCMS/MetaboAnalyst or native MetaboShiny format)
- Metadata file with 'sample' column (matching peak table sample names), 'individual' column, and optional 'batch' and 'concentration' columns

## Outputs

- Batch-corrected and concentration-normalized m/z peak intensity table
- Feature table ready for subsequent filtering and normalization steps

## How to apply

Load your m/z peak data (e.g., from XCMS or MetaboAnalyst export format) and corresponding metadata file containing batch IDs and/or sample concentration values into MetaboShiny. Click 'Get options' in the Batches and concentration panel. Select the metadata column representing concentration (if applicable) and the column containing batch IDs (if applicable). The tool will apply batch correction to account for systematic variations across batches, then normalize peak intensities by the selected concentration factor. The corrected data accounts for both inter-batch drift and sample loading differences, enabling proper intensity comparisons in subsequent filtering and normalization steps.

## Related tools

- **MetaboShiny** (Interactive R Shiny application that implements batch correction and concentration normalization for m/z peak data via the Batches and concentration panel) — https://github.com/joannawolthuis/MetaboShiny
- **R** (Underlying language for MetaboShiny; batch correction computations and metadata processing are executed in R)
- **XCMS** (Upstream preprocessing tool for peak detection and alignment; outputs peak tables that serve as input to batch correction)

## Evaluation signals

- Batch-corrected peak intensity distributions are visually similar across batches in pre/post-normalization plots generated by MetaboShiny.
- Peak intensities are scaled proportionally to sample concentration values — samples with higher concentration have proportionally higher intensity after correction.
- Concentration-normalized feature table shows reduced variance attributable to batch ID in subsequent PCA or statistical tests.
- Output feature table is non-null and contains the same m/z features as input, with adjusted intensity values.
- Metadata batch and concentration columns are successfully parsed without error (verified by 'Get options' button completion).

## Limitations

- Requires explicit batch ID and/or concentration metadata columns; batch correction cannot be inferred from peak intensity patterns alone.
- Assumes batch effects are systematic and removable; if batch effects are confounded with biological signal of interest, correction may remove genuine signal.
- Concentration column must be numeric and represent true sample loading differences; if concentration values are unreliable or missing for many samples, correction accuracy is compromised.
- Does not address batch effects introduced during metabolite identification or database searching; only corrects raw peak intensity data.

## Evidence

- [other] MetaboShiny provides data normalization functionality organized into two components: one for handling batches and concentration, and a separate module for filtering and normalization operations on loaded m/z peak data.: "MetaboShiny provides data normalization functionality organized into two components: one for handling batches and concentration, and a separate module for filtering and normalization"
- [other] Apply batch correction to account for systematic variations across sample batches. Normalize peak intensities by concentration to account for differences in sample loading.: "Apply batch correction to account for systematic variations across sample batches. Normalize peak intensities by concentration to account for differences in sample loading."
- [readme] If your metadata only contains one batch and no column that represents concentration, then you can skip this part and continue to the Filtering and normalization step.: "If your metadata only contains one batch and no column that represents concentration, then you can skip this part and continue"
- [readme] MetaboShiny, unless using the MetaboAnalyst format, requires an additional metadata table. This should minimally have a 'sample' column that contains the same sample identifiers used in the peak table files, an 'individual' column (since multiple samples can come from one individual in time series data) and at least one column on experimental group or something alike.: "metadata table. This should minimally have a 'sample' column that contains the same sample identifiers used in the peak table files, an 'individual' column and at least one column on experimental"
- [readme] Click on the 'Get options' button. If applicable, select the variable that represents concentration in your data. If applicable, select the variable that contains your multiple batch IDs.: "Click on the 'Get options' button. If applicable, select the variable that represents concentration in your data. If applicable, select the variable that contains your multiple batch IDs."
