Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in mechanism to retain full per-cell metadata when loading PNA PXL files into Seurat, while defaulting to a curated subset of QC-relevant columns to keep meta.data smaller/cleaner (Fixes: PNA-2926).
Changes:
- Added
detailed_meta_dataargument toReadPNA_Seurat(); whenFALSEit filtersmeta.datatoCELL_META_COLS. - Introduced
CELL_META_COLSas a central definition of which cell metadata columns are retained by default. - Updated documentation, changelog, and added a test to cover the new behavior.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
R/load_data_pna.R |
Adds detailed_meta_data parameter, validates it, and filters cell metadata by default. |
R/aaa.R |
Defines CELL_META_COLS constant used for default metadata filtering. |
tests/testthat/test-ReadPNA_Seurat.R |
Adds a test asserting detailed metadata loads more columns than the default. |
man/ReadPNA_Seurat.Rd |
Documents the new detailed_meta_data argument. |
CHANGELOG.md |
Notes the new default metadata filtering behavior and how to opt into detailed metadata. |
Files not reviewed (1)
- man/ReadPNA_Seurat.Rd: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
maxkarlsson
left a comment
There was a problem hiding this comment.
I think we should drop tau!
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 58788c3. Configure here.
| test_that("ReadPNA_Seurat fails when X collapses to a vector (1 cell)", { | ||
| # Inject an error by subsetting X to have only one cell | ||
| trace(ReadPNA_Seurat, tracer = quote(X <- X[, 1]), at = 13, print = FALSE) | ||
| trace(ReadPNA_Seurat, tracer = quote(X <- X[, 1, drop = FALSE]), at = 14, print = FALSE) |
There was a problem hiding this comment.
Test accidentally duplicated, losing vector collapse coverage
Medium Severity
The first test ("fails when X collapses to a vector") was changed from quote(X <- X[, 1]) to quote(X <- X[, 1, drop = FALSE]), making it identical to the second test ("fails when X is a 1-column matrix"). The original test without drop = FALSE exercised the is.null(ncol(X)) branch of the guard; now both tests only exercise the ncol(X) == 1 branch. The vector-collapse code path is no longer covered.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 58788c3. Configure here.


Description
This PR adds a meta data filter to
ReadPNA_Seuratto keep the meta.data slot clean. Full meta data can be obtained by settingdetailed_meta_data = TRUE.The columns to keep are defined in the
CELL_META_COLSvariable. Currently, these are:Fixes: PNA-3078
Type of change
How Has This Been Tested?
Added new test to
tests/testthat/test-ReadPNA_Seurat.RPR checklist:
Note
Medium Risk
Default Seurat metadata is slimmer and may omit columns downstream code assumed were present; behavior is opt-in restorable via
detailed_meta_data = TRUE.Overview
ReadPNA_Seuratnow loads only a QC-focused subset of PXL cell metadata intometa.databy default, using the new internalCELL_META_COLSlist (e.g.n_umi,n_edges,sample). Setdetailed_meta_data = TRUEto restore the full__adata__obstable for troubleshooting.This is a behavior change for workflows that expect extra columns (such as
tau_type) without opting in—tests were updated accordingly (e.g.MoleculeRankPlotgrouping uses a syntheticsample_idcolumn). Changelog and roxygen/man docs document the new argument; coverage asserts that detailed mode yields more metadata columns than the default.Reviewed by Cursor Bugbot for commit 58788c3. Bugbot is set up for automated code reviews on this repo. Configure here.