Skip to content

feat: FilterMarkers - #163

Open
maxkarlsson wants to merge 3 commits into
mainfrom
marker-filter-helper
Open

feat: FilterMarkers#163
maxkarlsson wants to merge 3 commits into
mainfrom
marker-filter-helper

Conversation

@maxkarlsson

@maxkarlsson maxkarlsson commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Added FilterMarkers which can be used to get a marker list that fulfills some criteria in a Seurat object. I am uncertain about the naming here, as the camel case FilterMarkers implies that it can be pipable Seurat-style, but it can't since the output is a only list or vector.

Added

  • FilterMarkers to keep markers whose CPM exceeds an isotype-relative
    ratio and/or an absolute abundance threshold in at least
    min_cell_fraction of cells.

Type of change

  • New feature (non-breaking change which adds functionality).

How Has This Been Tested?

Tests are added.

PR checklist:

  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have documented any significant changes to the code in CHANGELOG.md

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 a Seurat object’s counts layer using CPM-based positivity rules, alongside existing isotype helpers like isotype_pls.

A marker is kept when at least min_cell_fraction of cells are “positive,” where positivity uses isotype_ratio (vs. median isotype CPM), optional abundance_threshold, or the stricter combination of both. Isotype controls are always excluded. Optional group_column returns per-group results; return_stats returns a per-marker tibble instead of names only. The function does not subset or mutate the Seurat object—it returns a character vector, tibble, or named list.

Release notes, export/NAMESPACE, roxygen/man, spelling (CPM), and testthat coverage are included.

Reviewed by Cursor Bugbot for commit 7ffe604. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 testthat coverage 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.

Comment thread R/filter_markers.R
Comment on lines +21 to +22
#' @param isotype_markers Character vector of isotype control marker names
#' (for example `c("mIgG1", "mIgG2a", "mIgG2b")`.

@ludvigla ludvigla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants