Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logNormcounts() function doesn't work for my singlecellExperiment object #59

Open
tf1993614 opened this issue May 2, 2021 · 11 comments

Comments

@tf1993614
Copy link

tf1993614 commented May 2, 2021

sce <- SingleCellExperiment(list(counts = dge$counts))

clst <- quickCluster(sce, method="igraph", min.mean = 0.5)

sce <- computeSumFactors(sce, cluster = lst)`

libsize <- dge$samples$lib.size

plot(libsize/1e3, sizeFactors(sce), log="xy", pch=16, cex = 0.7, xlab = "library size(thousands)", ylab = "size factor")

sce <- logNormCounts(sce)

error message:
Error in assays<-(*tmp*, withDimnames = withDimnames, ..., value = *vtmp*) :
please use 'assay(x, withDimnames=FALSE)) <- value' or 'assays(x, withDimnames=FALSE)) <- value'
when the dimnames on the supplied assay(s) are not identical to the dimnames on
SingleCellExperiment object 'x'

Could you help me figure out this problem?

@LTLA
Copy link
Collaborator

LTLA commented May 2, 2021

Are you using the latest versions of all packages? Run BiocManager::valid() and check that you're not using packages from different Bioconductor releases. The error that you're seeing should not occur when using packages from the same release.

@tf1993614
Copy link
Author

tf1993614 commented May 3, 2021 via email

@LTLA
Copy link
Collaborator

LTLA commented May 3, 2021

Perhaps you should run BiocManager::valid(), as I suggested, and show the output.

@tf1993614
Copy link
Author

tf1993614 commented May 3, 2021 via email

@LTLA
Copy link
Collaborator

LTLA commented May 3, 2021

Your version of scran is out of date. The latest version is 1.18.7, see the landing page.

In fact, all your Bioconductor packages seem to be from the previous release, and Biocmanager::valid() tells you as such; you're on BioC 3.11, and the latest Bioconductor release is 3.12, so that's that.

Now, I don't understand why you're seeing that error because it didn't occur in the previous release either. I can only suggest that you upgrade to the latest release and try with the latest versions of all relevant packages. This may or may not fix the problem, but if you stick to 3.11, then I definitely can't fix anything, because that release is already frozen.

@tf1993614
Copy link
Author

tf1993614 commented May 3, 2021 via email

@LTLA
Copy link
Collaborator

LTLA commented May 5, 2021

I don't know why it doesn't work for you. The following minimal example works fine for me.

library(BiocFileCache)
bfc <- BiocFileCache(ask=FALSE)
base <- "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSM2510617&format=file&file=GSM2510617%5FP7%2D"
barcodes <- bfcrpath(bfc, paste0(base[1], "barcodes%2Etsv%2Egz"))
genes <- bfcrpath(bfc, paste0(base[1], "genes%2Etsv%2Egz"))
mat <- bfcrpath(bfc, paste0(base[1], "matrix%2Emtx%2Egz"))

library(SingleCellExperiment)
rd <- read.table(genes, row.names=1, header=FALSE)
colnames(rd) <- "SYMBOL"
sce <- SingleCellExperiment(list(counts=Matrix::readMM(mat)), rowData=rd)
colnames(sce) <- readLines(barcodes)

library(scuttle)
logNormCounts(sce)
## class: SingleCellExperiment 
## dim: 27998 3302 
## metadata(0):
## assays(2): counts logcounts
## rownames(27998): ENSMUSG00000051951 ENSMUSG00000089699 ...
##   ENSMUSG00000096730 ENSMUSG00000095742
## rowData names(1): SYMBOL
## colnames(3302): AAACATACCCTTTA-1 AAACATACGAACTC-1 ... TTTGCATGAGCTAC-1
##   TTTGCATGCTTTAC-1
## colData names(1): sizeFactor
## reducedDimNames(0):
## altExpNames(0):

@fengyuanelab
Copy link

I am having the same issue. Have you find the solution for this?

@LTLA
Copy link
Collaborator

LTLA commented Jul 12, 2021

Depends on whether you can provide a minimum reproducible example.

@LachlanD
Copy link

I was also receiving this same error but I was able to work out that it was because I had labeled the dimensions on my count matrix ($Gene, $Cell) but the SingleCellExperiment had unlabeled dimnames. Removing the labels from the count matrix resolved the issue for me. Hope that might help.

@LTLA
Copy link
Collaborator

LTLA commented Jul 19, 2021

Thanks @LachlanD, that was a useful diagnosis. See the linked issue in the SummarizedExperiment repo for the follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants