Fix getRows/getCols filtering and reporting; bump version; add audit - #37
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bce0609de3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #' @export | ||
| getRows <- function(mat, rownamez, silent = FALSE, removeNAonly = FALSE, remove0only = FALSE) { | ||
| stopifnot( | ||
| is.matrix(mat) || is.data.frame(mat), !is.null(rownames(mat)), |
There was a problem hiding this comment.
Allow sparse matrix classes in the input check
Problem: getRows() now rejects S4 matrix implementations such as Matrix::dgCMatrix; the identical assertion in getCols() does the same. These objects are not base matrices or data frames, although the existing name lookup, subsetting, and row/column summary operations support them. Trigger: Any downstream caller passes a sparse matrix, including common Seurat workflows. Fix: Validate the required two-dimensional and named interface, or explicitly accept compatible Matrix classes, instead of restricting mat to base matrices and data frames.
AGENTS.md reference: AGENTS.md:L46-L50
Useful? React with 👍 / 👎.
| if (!silent) { | ||
| iprint(length(idx), "/", length(rownamez), "are found. Missing: ", length(setdiff(row.names(mat), rownamez))) | ||
| missing_rows <- setdiff(rownamez, row.names(mat)) | ||
| iprint(length(idx), "/", length(rownamez), "are found. Missing: ", length(missing_rows)) |
There was a problem hiding this comment.
Count matched names before applying value filters
Problem: length(idx) counts rows retained after zero/NA filtering, but the message describes that number as rows that “are found.” Trigger: If a requested row exists but is removed by remove0only or removeNAonly, getRows() can print 0 / 1 are found. Missing: 0; getCols() has the same issue. Fix: Capture the matched-name count immediately after intersect(), or report the matched and retained counts separately.
Useful? React with 👍 / 👎.
|
Please validate and resolve problems: 1 2 Thank you! |
Co-authored-by: vertesy <5101911+vertesy@users.noreply.github.com>
Addressed in
|
Motivation
remove0only = TRUEreferenced an undefinedmxand could error in clean sessions.Description
mxusage ingetRows()andgetCols()with localizedselected_mat <- mat[... , drop = FALSE]and filter rows/columns from that selection to avoid relying on an external object.stopifnot(...)input assertions togetRows()andgetCols()to validate key arguments and preserve dimensions by returning withdrop = FALSE.2.8.0to2.8.1inDevelopment/config.RandDESCRIPTIONand addDevelopment/Audit_20260827.mdwith a checklist of audit findings and deferred fixes.Testing
git diff --check(pre-commit style) reported no problems.R CMD checkandlintr::lint_package()were attempted but could not run in this environment becauseR/Rscriptare not installed, so package checks and linter runs are pending in an R-equipped environment.Codex Task