From aca1681e4bea2ed988e74577547a0aff8781b3c2 Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Wed, 15 Jan 2025 11:08:09 -0500 Subject: [PATCH] Fix bug in selectBatchHVG --- DESCRIPTION | 4 ++-- R/selectBatchHVG.R | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f37c8bc..e9c26c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rliger -Version: 2.1.0.9003 -Date: 2024-12-04 +Version: 2.1.0.9004 +Date: 2025-01-07 Type: Package Title: Linked Inference of Genomic Experimental Relationships Description: Uses an extension of nonnegative matrix factorization to identify shared and dataset-specific factors. See Welch J, Kozareva V, et al (2019) , and Liu J, Gao C, Sodicoff J, et al (2020) for more details. diff --git a/R/selectBatchHVG.R b/R/selectBatchHVG.R index db2e612..f82e80b 100644 --- a/R/selectBatchHVG.R +++ b/R/selectBatchHVG.R @@ -148,7 +148,7 @@ selectBatchHVG.ligerDataset <- function( fm <- featureMeta(object) idx <- rep(FALSE, nrow(object)) idx[features] <- TRUE - idx <- idx & (fm$nCell > 0) + # idx <- idx & (fm$nCell > 0) mat <- mat[idx, , drop = FALSE] stats <- selectBatchHVG(mat, nGenes = nGenes, verbose = verbose, returnStats = TRUE, ...) @@ -175,6 +175,8 @@ selectBatchHVG.dgCMatrix <- function( ... ) { # Get mean and var + idx <- Matrix::rowSums(object > 0) > 0 + object <- object[idx, , drop = FALSE] means <- Matrix::rowMeans(object) vars <- rowVars_sparse_rcpp(object, means) stats <- .selectBatchHVG.by.metric(