Open ccshao opened 4 years ago
Thank you for the issue.
For debugging purposes, it would be useful to have the sobj.q
file so I can run the code. Can you provide this file?
@dvantwisk Thanks for your interest. I installed R 4.0.2, and latest LoomExperiment. The issue persists. Here are codes I used, the submat.rds, a genes by cells matrix, is attached.
library(LoomExperiment)
sobj <- qs::qread("sobj.q")
mat <- as.matrix(sobj[["RNA"]]@counts)
t1 <- sample(17297, 5000)
t2 <- sample(13572, 2000)
submat <- mat[t1, t2]
saveRDS(submat, "submat.rds")
subscle <- SingleCellLoomExperiment(assays = list(counts = submat))
export(subscle, "test.loom", rownames_attr = "Gene", colnames_attr = "CellID")
You created a large dataset with compression and chunking.
The chunk size is equal to the dataset dimensions.
If you want to read subsets of the dataset, you should testsmaller chunk sizes to improve read times.
Warning message:
In value[[3L]](cond) :
zero-length inputs cannot be mixed with those of non-zero length
I apologize for the slow pace on this.
The initial message is new is being thrown by the underlying rhdf5 code, so I will get to removing this does not apply to LoomExperiment.
I'm unable to replicate the warning you are getting. It is a rather difficult message to diagnose as it occurs in the base R code and could be tripped at many points. I would think that it may be because one of the inputs, be it the CellID
or Gene
that is contains a zero length element that is causing this issue at some point in the code. If I could get access to the sobj.q
and submat.rds
files, I could better work to solve this issue. I'm not sure if you meant to give me these or not from the beginning.
@dvantwisk Sorry I forgot to attach the submat.rds. Actually this warning shows in the export
step with example codes, at least on my side.
library(LoomExperiment)
counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
scle <- SingleCellLoomExperiment(assays = list(counts = counts))
export(scle, "test2.loom", rownames_attr = "Gene", colnames_attr = "CellID")
Warning message: In value[3L] : zero-length inputs cannot be mixed with those of non-zero length
export(scle, "test3.loom")
Warning message: In value[3L] : zero-length inputs cannot be mixed with those of non-zero length
sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS High Sierra 10.13.6
Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets [8] methods base
other attached packages: [1] LoomExperiment_1.6.0 rtracklayer_1.47.0 [3] rhdf5_2.32.2 SingleCellExperiment_1.10.1 [5] SummarizedExperiment_1.18.2 DelayedArray_0.14.0 [7] matrixStats_0.56.0 Biobase_2.48.0 [9] GenomicRanges_1.40.0 GenomeInfoDb_1.24.2 [11] IRanges_2.22.2 S4Vectors_0.26.1 [13] BiocGenerics_0.34.0
loaded via a namespace (and not attached): [1] magrittr_1.5 XVector_0.28.0 GenomicAlignments_1.24.0 [4] zlibbioc_1.34.0 BiocParallel_1.22.0 lattice_0.20-41 [7] stringr_1.4.0 tools_4.0.2 grid_4.0.2 [10] HDF5Array_1.16.1 crayon_1.3.4 Matrix_1.2-18 [13] GenomeInfoDbData_1.2.3 Rhdf5lib_1.10.1 bitops_1.0-6 [16] RCurl_1.98-1.2 stringi_1.4.6 compiler_4.0.2 [19] Biostrings_2.56.0 Rsamtools_2.4.0 XML_3.99-0.4
Thanks for the effort, I have a few questions about the usages. Following are my codes on converting a count matrix from seurat object to loom file
sparse matrix The
counts
is a sparse matrix, should it be converted tomatrix
before used as the input for SingleCellLoomExperiment?chunk size There is an message from export,
Should I play wit the chunk size, and how?
zero-length warning Additionally it saide "zero-length inputs cannot be mixed with those of non-zero length", Is there something wrong with the
export
command?