feat: FilterMarkers - #163
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The feature is additive with tests and validation, and the only flagged issue is a minor roxygen documentation punctuation fix.
Pull request overview
Adds a new exported helper (FilterMarkers) to derive a marker panel from a Seurat object’s counts layer based on CPM positivity rules, plus a patch-level version bump and accompanying docs/tests.
Changes:
- Introduces
FilterMarkers()with optional isotype-relative and/or absolute CPM thresholds, optional per-group operation, and optional stats output. - Adds
testthatcoverage for default, threshold variants, stats output, grouping, and input validation errors. - Updates package metadata/documentation for the new API and bumps version to
0.20.2(README badge, DESCRIPTION, CHANGELOG, WORDLIST, NAMESPACE).
File summaries
| File | Description |
|---|---|
R/filter_markers.R |
Implements the new FilterMarkers() API with validation, grouping support, and optional stats output. |
tests/testthat/test-filter-markers.R |
Adds tests covering expected kept markers, threshold modes, stats output, grouping behavior, and error cases. |
NAMESPACE |
Exports FilterMarkers. |
man/FilterMarkers.Rd |
Adds generated Rd documentation for FilterMarkers. |
DESCRIPTION |
Bumps version to 0.20.2 and adds filter_markers.R to Collate. |
README.md |
Updates beta release badge to v0.20.2. |
CHANGELOG.md |
Adds 0.20.2 entry documenting FilterMarkers. |
inst/WORDLIST |
Adds CPM to spelling whitelist. |
Review details
Files not reviewed (1)
- man/FilterMarkers.Rd: Generated file
- Files reviewed: 7/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| #' @param isotype_markers Character vector of isotype control marker names | ||
| #' (for example `c("mIgG1", "mIgG2a", "mIgG2b")`. |
ludvigla
left a comment
There was a problem hiding this comment.
Looks great! The only comment I have is about the function name. FilterMarkers sounds a bit like it will remove markers from the Seurat object. Maybe FindAbundantMarkers? Seurat has FindVariableFeatures for feature selection.
Description
Added
FilterMarkerswhich can be used to get a marker list that fulfills some criteria in aSeuratobject. I am uncertain about the naming here, as the camel caseFilterMarkersimplies that it can be pipable Seurat-style, but it can't since the output is a only list or vector.Added
FilterMarkersto keep markers whose CPM exceeds an isotype-relativeratio and/or an absolute abundance threshold in at least
min_cell_fractionof cells.Type of change
How Has This Been Tested?
Tests are added.
PR checklist:
Note
Low Risk
Additive exported API with validation and tests; read-only on Seurat data and no changes to auth, I/O, or core assay pipelines.
Overview
Adds
FilterMarkers(v 0.20.2) so users can derive a marker panel from aSeuratobject’scountslayer using CPM-based positivity rules, alongside existing isotype helpers likeisotype_pls.A marker is kept when at least
min_cell_fractionof cells are “positive,” where positivity usesisotype_ratio(vs. median isotype CPM), optionalabundance_threshold, or the stricter combination of both. Isotype controls are always excluded. Optionalgroup_columnreturns per-group results;return_statsreturns a per-marker tibble instead of names only. The function does not subset or mutate theSeuratobject—it returns a character vector, tibble, or named list.Release notes, export/
NAMESPACE, roxygen/man, spelling (CPM), andtestthatcoverage are included.Reviewed by Cursor Bugbot for commit 7ffe604. Bugbot is set up for automated code reviews on this repo. Configure here.