Irrationone / cellassign

Automated, probabilistic assignment of cell types in scRNA-seq data
Other
191 stars 79 forks source link

Length(s) == nrow(Y) is not TRUE #72

Closed avln24 closed 4 years ago

avln24 commented 4 years ago

Hi there,

I'm new to cellassign and am trying to apply it to my own dataset, however whenever I run the following code, I get an error.

fit <- cellassign(exprs_obj = gexp, marker_gene_info = markers, s = s, learning_rate = 1e-2, shrinkage = TRUE, verbose = FALSE)

Error in cellassign(exprs_obj = gexp, marker_gene_info = markers, s = s, : length(s) == nrow(Y) is not TRUE

I made sure to apply s = calculateSumFactors() prior to subsetting the gene expression matrix to the markers

I also checked that the gene expression data contained only the marker genes prior to input into cellassign() and that this matched the marker gene matrix.

Also, I did not convert to a singlecellexperiment, instead I used gene expression counts matrix. Should I be converting to a singlecellexperiment?

What does this error mean? Any suggestions are appreciated!

Thanks

kieranrcampbell commented 4 years ago

Hi @avln24

What is dim(gexp) and dim(markers)

right before you put them into cellassign?

avln24 commented 4 years ago

Hi @kieranrcampbell,

This is what I get dim(markers) [1] 15 3 dim(gexp) [1] 4171 15

Irrationone commented 4 years ago

Hi @avln24 ,

How are you calling calculateSumFactors()? Note that it expects a matrix of genes (rows) by cells (columns), which is the opposite of what the exprs_obj input is in cellassign.

So you should have something like

s <- calculateSumFactors(t(gexp))
cellassign(exprs_obj = gexp, s = s, ...)
avln24 commented 4 years ago

Hi @Irrationone,

I followed your suggestion and it worked. Thank you! I was inputing the exprs_obj directly into calculateSumFactors() without taking its transpose