batchelor icon indicating copy to clipboard operation
batchelor copied to clipboard

Unexpected number of cells produced in fastMNN

Open Hrovatin opened this issue 2 years ago • 3 comments

I tried to run fastMNN (installed today from bioconductor), but I get more cells than expecte din the corrected object. Any idea why?

sobj <- subset(data, features=hvg)

print('sobj')

print(sobj)

expr <- GetAssayData(object = sobj ,slot = "data")

print('expr')

print(dim(expr))

sce <- fastMNN(expr, batch = [email protected][[batch]])

print('sce')

print(dim(sce))

[1] "sobj"
An object of class Seurat 
2000 features across 2730 samples within 1 assay 
Active assay: originalexp (2000 features, 0 variable features)
[1] "expr"
[1] 2000 2730
[1] "sce"
[1] 2000 9815

Hrovatin avatar Apr 06 '22 17:04 Hrovatin

I have no idea. I assume that expr is a matrix or dgCMatrix, and not some custom class that might be reinterpreted as a list.

LTLA avatar Apr 10 '22 01:04 LTLA

Yes, it is a matrix

class(expr)

    'matrix''array'

image

Hrovatin avatar Apr 10 '22 10:04 Hrovatin

Well, I dunno. Works fine for me on batchelor 1.10.0.

library(batchelor)
x <- matrix(runif(2000000), ncol=1000)
dim(x)
## [1] 2000 1000

batch <- sample(2, ncol(x), replace=TRUE)
out <- fastMNN(x, batch=batch)
dim(out)
## [1] 2000 1000

Try modifying the example above to reproduce the error.

LTLA avatar Apr 10 '22 17:04 LTLA