From 6e7fc48003fb54986d3ec26a102acc65ee2e305c Mon Sep 17 00:00:00 2001 From: Joshua Sodicoff <44811472+jsodicoff@users.noreply.github.com> Date: Sun, 23 Jan 2022 21:39:04 -0500 Subject: [PATCH] Bug in getProportionMito I noticed that getProportionMito gives an uninformative error (about indexing) if all mitochondrial genes found are not shared across all datasets. Using %in% instead of indexing ought to correct that. --- R/rliger.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/rliger.R b/R/rliger.R index 81570570..465bf032 100755 --- a/R/rliger.R +++ b/R/rliger.R @@ -4587,7 +4587,7 @@ getProportionMito <- function(object, use.norm = FALSE) { data.use <- object@norm.data } percent_mito <- unlist(lapply(unname(data.use), function(x) { - colSums(x[mito.genes, ]) / colSums(x) + colSums(x[rownames(x) %in% mito.genes, ]) / colSums(x) }), use.names = TRUE) return(percent_mito) @@ -7161,4 +7161,4 @@ calcNormLoadings = function(object) { } return(results) -} \ No newline at end of file +}