Batch Correction of Single Cell Transcriptome Data
Overview
Non-linear/linear hybrid method for batch-effect correction that uses Mutual Nearest Neighbors (MNNs) to identify similar cells between datasets. Reference: Loza M. et al. (NAR Genomics and Bioinformatics, 2020) doi:10.1093/nargab/lqac022.
Changes
- Sped up MNN pair finding:
FindMnnPairs()scanned the full neighbor tables withwhich()for every cell and grew its result with repeatedrbind()calls inside a loop, both of which scaled quadratically in cell count. Both are now near-linear, with no change in output (verified byte-identical against the previous implementation).Fuzzy()also no longer converts its correction matrix to adata.framejust to track a per-cell flag, which was much slower than tracking it as a plain vector. Together these give roughly a 2-4x speedup on real datasets, more on larger ones, since MNN search is repeated on everymaxLooppass. - Added an
ncoresparameter (CorrectBatches(),CorrectBatch(),GetMnnPairs(), and via...onRunCanek()) to parallelize the two independent k-nearest-neighbor searches MNN pair finding requires. Defaults to 1 (fully sequential) — parallelism is opt-in only, since automatically detecting and using "available" cores could oversubscribe a shared cluster/HPC job's actual allocation. Usesparallel::mclapply(), soncores > 1requires Linux/macOS (errors on Windows, and if more cores are requested thanparallel::detectCores()reports, rather than silently falling back or capping). See the new Speed up batch correction with parallel processing vignette.
From NEWS.md in the release
Install
Health
ERRORpackage dependenciesr-oldrel-macos-arm64
Package required but not available: ‘bluster’ Packages suggested but not available for checking: 'batchelor', 'scran' See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’ manual.
- ERROR12 OK, 1 ERROR2026-07-18
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK13 OK2026-05-10
- ERROR12 OK, 1 ERROR2026-05-03
Show 2 earlier changesHide 2 earlier changes
- OK12 OK2026-04-25
- NOTE13 OK, 1 NOTE2026-03-10
Documentation
- Help pages
- 11 (1 internal)includes a package overview page
- Examples that run
- 0%2 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 67%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 95%
- Median days to close, 50 most recently updated closed issues
- 2
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/martinloza/canek on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-07-17 · The repository has a site deploy workflow
pkgdown site last built 2026-07-17
Show all practicesHide 1 practice
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-07-16Pull request: opened by its own account
Dependencies
Installing Canek adds 22 packages (13 with compiled code, 16 MB of source tarballs). Heaviest: igraph 4.8 MB, mclust 2.7 MB, robustbase 2.2 MB. 1 more not on CRAN is not measured.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.3.1Latest
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- 0.2.52023-12-08 · diff ↗
- 0.2.42023-11-06 · diff ↗
- 0.2.32023-10-18 · diff ↗
- 0.2.22023-05-31 · diff ↗
- RR 4.3.0 released · 2023-04-21
- unarchivedReturned to CRAN2022-05-10
- 0.2.12022-05-10 · diff ↗
- RR 4.2.0 released · 2022-04-22
- archivedRemoved from CRAN2022-04-15installation issues were not corrected in time
- 0.2.02022-03-23
- RR 4.1.0 released · 2021-05-18
Package metadata
- First published
- 2022-03-23
- Total releases
- 7 / 4 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 2.3 MB / 1 file
- Download size
- 2.7 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("Canek")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1093/nargab/lqac022.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.