bulk-combat-correction_skill

This skill harmonises bulk RNA-seq data across batches using ComBat, exports corrected matrices, and benchmarks pre/post correction visually.
  • Python

866

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill starlitnightly/omicverse --skill bulk-combat-correction

  • reference.md1.8 KB
  • SKILL.md4.1 KB

Overview

This skill harmonises merged bulk RNA-seq or microarray cohorts using omicverse's pyComBat wrapper to remove batch effects, export corrected matrices, and generate benchmark visualisations. It walks through loading per-batch matrices, concatenating on shared genes, running ComBat, and saving both raw and corrected outputs for downstream analysis. The workflow includes PCA and embedding plots to verify mixing of batches after correction.

How this skill works

You load each cohort into an AnnData object, annotate samples with a batch label, and concatenate on the intersection of genes. ComBat is applied via ov.bulk.batch_correction(adata, batch_key='batch'), which writes corrected values into adata.layers['batch_correction'] while preserving original counts in adata.X. The skill then exports CSVs and a compressed h5ad and generates before/after PCA and variance visualisations to benchmark the correction.

When to use it

  • Combining multiple bulk RNA-seq or microarray cohorts with suspected batch effects.
  • Preparing a harmonised expression matrix for differential expression or meta-analysis.
  • Verifying whether batches mix after correction using PCA or embedding plots.
  • Exporting corrected and raw matrices for downstream tools that require CSV input.
  • When you need a reproducible AnnData file containing both raw and corrected layers.

Best practices

  • Ensure gene identifiers are harmonised (same gene symbols or IDs) before concatenation to avoid dropped features.
  • Assign descriptive batch labels (e.g., 'GEO_cohort_A') rather than only numeric codes for clearer plots and metadata.
  • Log-transform strongly skewed counts when required; pyComBat expects similarly distributed inputs.
  • Copy raw counts into a named layer (adata.layers['raw'] = adata.X.copy()) before running PCA to retain originals.
  • Save both corrected and raw tables plus a compressed adata write_h5ad(...) for reproducibility and downstream reuse.

Example use cases

  • Combine three GEO ovarian microarray cohorts, run ComBat, export raw and corrected CSVs, and save harmonised h5ad.
  • Benchmark batch correction by plotting PCA embeddings before and after correction to confirm improved mixing.
  • Process multiple bulk RNA-seq studies into a single corrected matrix for pan-cancer differential expression analysis.
  • Convert corrected AnnData layers to gene×sample matrices for input into external pathway or enrichment tools.

FAQ

Concatenation with merge='same' keeps only the intersection; harmonise feature names upstream if you need union or consistent features.

Where are corrected values stored?

Corrected intensities are stored in adata.layers['batch_correction']; the original matrix remains in adata.X.

My batch_correction layer is missing—what should I check?

Confirm the batch_key matches an adata.obs column and that ov.bulk.batch_correction completed without errors; also check for mismatched gene formats.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational