From 414b0229c73a8eec53dedb86aa223a6294595d8f Mon Sep 17 00:00:00 2001 From: Yen-Chung Chen Date: Wed, 29 May 2019 17:36:46 -0400 Subject: [PATCH] Make sure refdata in TransferData() is sparse To make sure the later [matrix multiplication](https://github.com/chenyenchung/seurat/blob/f195c4a75081713d057e648430a4d288ca752835/R/integration.R#L1033) gives a `dgCMatrix`, `refdata.anchors` must be a `dgCMatrix` but not a `matrix`. Otherwise, `new.data` will be a `dgematrix` and will not be compatible with `[CreateAssayObject(counts = new.data)](https://github.com/chenyenchung/seurat/blob/f195c4a75081713d057e648430a4d288ca752835/R/integration.R#L1037)`. --- R/integration.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/integration.R b/R/integration.R index 0c3332191..b90ea1172 100644 --- a/R/integration.R +++ b/R/integration.R @@ -920,6 +920,9 @@ TransferData <- function( if (!slot %in% c("counts", "data")) { stop("Please specify slot as either 'counts' or 'data'.") } + if (inherits(x = refdata, what = "matrix")) { + refdata <- as(object = refdata, Class = "dgCMatrix") + } label.transfer <- FALSE } else { stop(paste0("Please provide either a vector (character or factor) for label transfer or a matrix",