ArchR icon indicating copy to clipboard operation
ArchR copied to clipboard

`addGeneIntegrationMatrix` Error in slot(object = object, name = "features")[[layer]] <- features: more elements supplied than there are to replace Traceback:

Open danli349 opened this issue 1 year ago • 10 comments

When run the tutorial in the document: https://www.archrproject.com/bookdown/cross-platform-linkage-of-scatac-seq-cells-with-scrna-seq-cells.html

projHeme2 <- addGeneIntegrationMatrix(
    ArchRProj = projHeme2, 
    useMatrix = "GeneScoreMatrix",
    matrixName = "GeneIntegrationMatrix",
    reducedDims = "IterativeLSI",
    seRNA = seRNA,
    addToArrow = FALSE,
    groupRNA = "BioClassification",
    nameCell = "predictedCell_Un",
    nameGroup = "predictedGroup_Un",
    nameScore = "predictedScore_Un"
)

How should I solve this error:

ArchR logging to : ArchRLogs/ArchR-addGeneIntegrationMatrix-3af203550d8-Date-2024-09-30_Time-11-49-57.128984.log
If there is an issue, please report to github with logFile!

2024-09-30 11:49:57.233178 : Running Seurat's Integration Stuart* et al 2019, 0.002 mins elapsed.

2024-09-30 11:49:57.449474 : Checking ATAC Input, 0.005 mins elapsed.

2024-09-30 11:49:58.36637 : Checking RNA Input, 0.021 mins elapsed.

2024-09-30 11:50:14.923285 : Found 18601 overlapping gene names from gene scores and rna matrix!, 0.297 mins elapsed.

2024-09-30 11:50:14.929036 : Creating Integration Blocks, 0.297 mins elapsed.

2024-09-30 11:50:15.271016 : Prepping Interation Data, 0.302 mins elapsed.

2024-09-30 11:50:16.786384 : Computing Integration in 1 Integration Blocks!, 0 mins elapsed.

2024-09-30 11:50:16.799628 : Block (1 of 1) : Computing Integration, 0 mins elapsed.

2024-09-30 11:50:21.25633 : Block (1 of 1) : Identifying Variable Genes, 0.075 mins elapsed.

2024-09-30 11:50:25.130431 : Block (1 of 1) : Getting GeneScoreMatrix, 0.139 mins elapsed.

2024-09-30 11:50:30.740624 : Block (1 of 1) : Imputing GeneScoreMatrix, 0.233 mins elapsed.

Getting ImputeWeights

Warning message:
“Data is of class dgeMatrix. Coercing to dgCMatrix.”
Error in slot(object = object, name = "features")[[layer]] <- features: more elements supplied than there are to replace
Traceback:

1. .safelapply(seq_along(blockList), function(i) {
 .     prefix <- sprintf("Block (%s of %s) :", i, length(blockList))
 .     .logDiffTime(sprintf("%s Computing Integration", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     blocki <- blockList[[i]]
 .     subProj@cellColData <- subProj@cellColData[blocki$ATAC, ]
 .     subProj@sampleColData <- subProj@sampleColData[unique(subProj$Sample), 
 .         , drop = FALSE]
 .     subRNA <- seuratRNA[, blocki$RNA]
 .     subRNA <- subRNA[rownames(subRNA) %in% geneDF$name, ]
 .     .logDiffTime(sprintf("%s Identifying Variable Genes", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     subRNA <- FindVariableFeatures(object = subRNA, nfeatures = nGenes, 
 .         verbose = FALSE)
 .     subRNA <- ScaleData(object = subRNA, verbose = FALSE)
 .     if (is.null(genesUse)) {
 .         genesUse <- VariableFeatures(object = subRNA)
 .     }
 .     .logDiffTime(sprintf("%s Getting GeneScoreMatrix", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     mat <- .getPartialMatrix(getArrowFiles(subProj), featureDF = geneDF[geneDF$name %in% 
 .         genesUse, ], threads = 1, cellNames = subProj$cellNames, 
 .         useMatrix = useMatrix, verbose = FALSE)
 .     rownames(mat) <- geneDF[geneDF$name %in% genesUse, "name"]
 .     .logThis(mat, paste0("GeneScoreMat-Block-", i), logFile = logFile)
 .     if (useImputation) {
 .         .logDiffTime(sprintf("%s Imputing GeneScoreMatrix", prefix), 
 .             tstart, verbose = verbose, logFile = logFile)
 .         imputeParams <- list()
 .         imputeParams$ArchRProj <- subProj
 .         imputeParams$randomSuffix <- TRUE
 .         imputeParams$reducedDims <- reducedDims
 .         imputeParams$dimsToUse <- dimsToUse
 .         imputeParams$scaleDims <- scaleDims
 .         imputeParams$corCutOff <- corCutOff
 .         imputeParams$threads <- 1
 .         imputeParams$logFile <- logFile
 .         subProj <- suppressMessages(do.call(addImputeWeights, 
 .             imputeParams))
 .         mat <- suppressMessages(imputeMatrix(mat = mat, imputeWeights = getImputeWeights(subProj), 
 .             verbose = FALSE, logFile = logFile))
 .         o <- suppressWarnings(file.remove(unlist(getImputeWeights(subProj)[[1]])))
 .         .logThis(mat, paste0("GeneScoreMat-Block-Impute-", i), 
 .             logFile = logFile)
 .     }
 .     mat <- log(mat + 1)
 .     seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 
 .         5), , drop = FALSE])
 .     seuratATAC[["GeneScore"]] <- Seurat::CreateAssayObject(counts = mat)
 .     rm(mat)
 .     DefaultAssay(seuratATAC) <- "GeneScore"
 .     seuratATAC <- Seurat::ScaleData(seuratATAC, verbose = FALSE)
 .     .logDiffTime(sprintf("%s Seurat FindTransferAnchors", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     transferAnchors <- .retryCatch({
 .         gc()
 .         Seurat::FindTransferAnchors(reference = subRNA, query = seuratATAC, 
 .             reduction = reduction, features = genesUse, verbose = FALSE, 
 .             ...)
 .     }, maxAttempts = 2, logFile = logFile)
 .     .logThis(paste0(utils::capture.output(transferAnchors), collapse = "\n"), 
 .         paste0("transferAnchors-", i), logFile = logFile)
 .     rDSub <- rD[colnames(seuratATAC), , drop = FALSE]
 .     .logThis(rDSub, paste0("rDSub-", i), logFile = logFile)
 .     transferParams$anchorset <- transferAnchors
 .     transferParams$weight.reduction <- CreateDimReducObject(embeddings = rDSub, 
 .         key = "LSI_", assay = DefaultAssay(seuratATAC))
 .     transferParams$verbose <- FALSE
 .     transferParams$dims <- seq_len(ncol(rDSub))
 .     .logDiffTime(sprintf("%s Seurat TransferData Cell Group Labels", 
 .         prefix), tstart, verbose = verbose, logFile = logFile)
 .     transferParams$refdata <- subRNA$Group
 .     rnaLabels <- do.call(Seurat::TransferData, transferParams)
 .     .logDiffTime(sprintf("%s Seurat TransferData Cell Names Labels", 
 .         prefix), tstart, verbose = verbose, logFile = logFile)
 .     transferParams$refdata <- colnames(subRNA)
 .     rnaLabels2 <- do.call(Seurat::TransferData, transferParams)[, 
 .         1]
 .     if (addToArrow) {
 .         .logDiffTime(sprintf("%s Seurat TransferData GeneMatrix", 
 .             prefix), tstart, verbose = verbose, logFile = logFile)
 .         transferParams$refdata <- GetAssayData(subRNA, assay = "RNA", 
 .             slot = "data")
 .         gc()
 .         matchedRNA <- do.call(Seurat::TransferData, transferParams)
 .         matchedRNA <- matchedRNA@data
 .     }
 .     matchDF <- DataFrame(cellNames = colnames(seuratATAC), predictionScore = rnaLabels$prediction.score.max, 
 .         predictedGroup = rnaLabels$predicted.id, predictedCell = rnaLabels2)
 .     rownames(matchDF) <- matchDF$cellNames
 .     .logDiffTime(sprintf("%s Saving TransferAnchors Joint CCA", 
 .         prefix), tstart, verbose = verbose, logFile = logFile)
 .     jointCCA <- DataFrame([email protected][[1]]@[email protected])
 .     jointCCA$Assay <- ifelse(endsWith(rownames(jointCCA), "_reference"), 
 .         "RNA", "ATAC")
 .     jointCCA$Group <- NA
 .     jointCCA$Score <- NA
 .     jointCCA[paste0(colnames(subRNA), "_reference"), "Group"] <- subRNA$Group
 .     jointCCA[paste0(matchDF$cellNames, "_query"), "Group"] <- matchDF$predictedGroup
 .     jointCCA[paste0(matchDF$cellNames, "_query"), "Score"] <- matchDF$predictionScore
 .     .safeSaveRDS(object = jointCCA, file = file.path(outDir3, 
 .         paste0("Save-Block", i, "-JointCCA.rds")))
 .     rm(transferParams, transferAnchors)
 .     gc()
 .     if (addToArrow) {
 .         .logDiffTime(sprintf("%s Transferring Paired RNA to Temp File", 
 .             prefix), tstart, verbose = verbose, logFile = logFile)
 .         tmpFilei <- paste0(tmpFile, "-IntegrationBlock-", i, 
 .             ".h5")
 .         o <- h5createFile(tmpFilei)
 .         sampleNames <- getCellColData(subProj, "Sample")[matchDF$cellNames, 
 .             ]
 .         uniqueSamples <- unique(sampleNames)
 .         matchedRNA <- .safeSubset(mat = matchedRNA, subsetRows = paste0(featureDF$name), 
 .             subsetCols = matchDF$cellNames)
 .         for (z in seq_along(uniqueSamples)) {
 .             mat <- matchedRNA[, which(sampleNames == uniqueSamples[z]), 
 .                 drop = FALSE]
 .             Group <- uniqueSamples[z]
 .             o <- tryCatch({
 .                 h5delete(tmpFilei, paste0(Group))
 .             }, error = function(x) {
 .             })
 .             o <- h5createGroup(tmpFilei, paste0(Group))
 .             j <- Rle(findInterval(seq(mat@x) - 1, mat@p[-1]) + 
 .                 1)
 .             lengthRle <- length(j@lengths)
 .             lengthI <- length(mat@i)
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/i"), storage.mode = "integer", dims = c(lengthI, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/jLengths"), storage.mode = "integer", dims = c(lengthRle, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/jValues"), storage.mode = "integer", dims = c(lengthRle, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/x"), storage.mode = "double", dims = c(lengthI, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5write(obj = mat@i + 1, file = tmpFilei, 
 .                 name = paste0(Group, "/i")))
 .             o <- .suppressAll(h5write(obj = j@lengths, file = tmpFilei, 
 .                 name = paste0(Group, "/jLengths")))
 .             o <- .suppressAll(h5write(obj = j@values, file = tmpFilei, 
 .                 name = paste0(Group, "/jValues")))
 .             o <- .suppressAll(h5write(obj = mat@x, file = tmpFilei, 
 .                 name = paste0(Group, "/x")))
 .             o <- .suppressAll(h5write(obj = colnames(mat), file = tmpFilei, 
 .                 name = paste0(Group, "/cellNames")))
 .         }
 .         rm(matchedRNA, mat, j)
 .     }
 .     .logDiffTime(sprintf("%s Completed Integration", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     gc()
 .     matchDF$Block <- Rle(i)
 .     matchDF
 . }, threads = threads2) %>% Reduce("rbind", .)
2. Reduce("rbind", .)
3. .safelapply(seq_along(blockList), function(i) {
 .     prefix <- sprintf("Block (%s of %s) :", i, length(blockList))
 .     .logDiffTime(sprintf("%s Computing Integration", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     blocki <- blockList[[i]]
 .     subProj@cellColData <- subProj@cellColData[blocki$ATAC, ]
 .     subProj@sampleColData <- subProj@sampleColData[unique(subProj$Sample), 
 .         , drop = FALSE]
 .     subRNA <- seuratRNA[, blocki$RNA]
 .     subRNA <- subRNA[rownames(subRNA) %in% geneDF$name, ]
 .     .logDiffTime(sprintf("%s Identifying Variable Genes", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     subRNA <- FindVariableFeatures(object = subRNA, nfeatures = nGenes, 
 .         verbose = FALSE)
 .     subRNA <- ScaleData(object = subRNA, verbose = FALSE)
 .     if (is.null(genesUse)) {
 .         genesUse <- VariableFeatures(object = subRNA)
 .     }
 .     .logDiffTime(sprintf("%s Getting GeneScoreMatrix", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     mat <- .getPartialMatrix(getArrowFiles(subProj), featureDF = geneDF[geneDF$name %in% 
 .         genesUse, ], threads = 1, cellNames = subProj$cellNames, 
 .         useMatrix = useMatrix, verbose = FALSE)
 .     rownames(mat) <- geneDF[geneDF$name %in% genesUse, "name"]
 .     .logThis(mat, paste0("GeneScoreMat-Block-", i), logFile = logFile)
 .     if (useImputation) {
 .         .logDiffTime(sprintf("%s Imputing GeneScoreMatrix", prefix), 
 .             tstart, verbose = verbose, logFile = logFile)
 .         imputeParams <- list()
 .         imputeParams$ArchRProj <- subProj
 .         imputeParams$randomSuffix <- TRUE
 .         imputeParams$reducedDims <- reducedDims
 .         imputeParams$dimsToUse <- dimsToUse
 .         imputeParams$scaleDims <- scaleDims
 .         imputeParams$corCutOff <- corCutOff
 .         imputeParams$threads <- 1
 .         imputeParams$logFile <- logFile
 .         subProj <- suppressMessages(do.call(addImputeWeights, 
 .             imputeParams))
 .         mat <- suppressMessages(imputeMatrix(mat = mat, imputeWeights = getImputeWeights(subProj), 
 .             verbose = FALSE, logFile = logFile))
 .         o <- suppressWarnings(file.remove(unlist(getImputeWeights(subProj)[[1]])))
 .         .logThis(mat, paste0("GeneScoreMat-Block-Impute-", i), 
 .             logFile = logFile)
 .     }
 .     mat <- log(mat + 1)
 .     seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 
 .         5), , drop = FALSE])
 .     seuratATAC[["GeneScore"]] <- Seurat::CreateAssayObject(counts = mat)
 .     rm(mat)
 .     DefaultAssay(seuratATAC) <- "GeneScore"
 .     seuratATAC <- Seurat::ScaleData(seuratATAC, verbose = FALSE)
 .     .logDiffTime(sprintf("%s Seurat FindTransferAnchors", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     transferAnchors <- .retryCatch({
 .         gc()
 .         Seurat::FindTransferAnchors(reference = subRNA, query = seuratATAC, 
 .             reduction = reduction, features = genesUse, verbose = FALSE, 
 .             ...)
 .     }, maxAttempts = 2, logFile = logFile)
 .     .logThis(paste0(utils::capture.output(transferAnchors), collapse = "\n"), 
 .         paste0("transferAnchors-", i), logFile = logFile)
 .     rDSub <- rD[colnames(seuratATAC), , drop = FALSE]
 .     .logThis(rDSub, paste0("rDSub-", i), logFile = logFile)
 .     transferParams$anchorset <- transferAnchors
 .     transferParams$weight.reduction <- CreateDimReducObject(embeddings = rDSub, 
 .         key = "LSI_", assay = DefaultAssay(seuratATAC))
 .     transferParams$verbose <- FALSE
 .     transferParams$dims <- seq_len(ncol(rDSub))
 .     .logDiffTime(sprintf("%s Seurat TransferData Cell Group Labels", 
 .         prefix), tstart, verbose = verbose, logFile = logFile)
 .     transferParams$refdata <- subRNA$Group
 .     rnaLabels <- do.call(Seurat::TransferData, transferParams)
 .     .logDiffTime(sprintf("%s Seurat TransferData Cell Names Labels", 
 .         prefix), tstart, verbose = verbose, logFile = logFile)
 .     transferParams$refdata <- colnames(subRNA)
 .     rnaLabels2 <- do.call(Seurat::TransferData, transferParams)[, 
 .         1]
 .     if (addToArrow) {
 .         .logDiffTime(sprintf("%s Seurat TransferData GeneMatrix", 
 .             prefix), tstart, verbose = verbose, logFile = logFile)
 .         transferParams$refdata <- GetAssayData(subRNA, assay = "RNA", 
 .             slot = "data")
 .         gc()
 .         matchedRNA <- do.call(Seurat::TransferData, transferParams)
 .         matchedRNA <- matchedRNA@data
 .     }
 .     matchDF <- DataFrame(cellNames = colnames(seuratATAC), predictionScore = rnaLabels$prediction.score.max, 
 .         predictedGroup = rnaLabels$predicted.id, predictedCell = rnaLabels2)
 .     rownames(matchDF) <- matchDF$cellNames
 .     .logDiffTime(sprintf("%s Saving TransferAnchors Joint CCA", 
 .         prefix), tstart, verbose = verbose, logFile = logFile)
 .     jointCCA <- DataFrame([email protected][[1]]@[email protected])
 .     jointCCA$Assay <- ifelse(endsWith(rownames(jointCCA), "_reference"), 
 .         "RNA", "ATAC")
 .     jointCCA$Group <- NA
 .     jointCCA$Score <- NA
 .     jointCCA[paste0(colnames(subRNA), "_reference"), "Group"] <- subRNA$Group
 .     jointCCA[paste0(matchDF$cellNames, "_query"), "Group"] <- matchDF$predictedGroup
 .     jointCCA[paste0(matchDF$cellNames, "_query"), "Score"] <- matchDF$predictionScore
 .     .safeSaveRDS(object = jointCCA, file = file.path(outDir3, 
 .         paste0("Save-Block", i, "-JointCCA.rds")))
 .     rm(transferParams, transferAnchors)
 .     gc()
 .     if (addToArrow) {
 .         .logDiffTime(sprintf("%s Transferring Paired RNA to Temp File", 
 .             prefix), tstart, verbose = verbose, logFile = logFile)
 .         tmpFilei <- paste0(tmpFile, "-IntegrationBlock-", i, 
 .             ".h5")
 .         o <- h5createFile(tmpFilei)
 .         sampleNames <- getCellColData(subProj, "Sample")[matchDF$cellNames, 
 .             ]
 .         uniqueSamples <- unique(sampleNames)
 .         matchedRNA <- .safeSubset(mat = matchedRNA, subsetRows = paste0(featureDF$name), 
 .             subsetCols = matchDF$cellNames)
 .         for (z in seq_along(uniqueSamples)) {
 .             mat <- matchedRNA[, which(sampleNames == uniqueSamples[z]), 
 .                 drop = FALSE]
 .             Group <- uniqueSamples[z]
 .             o <- tryCatch({
 .                 h5delete(tmpFilei, paste0(Group))
 .             }, error = function(x) {
 .             })
 .             o <- h5createGroup(tmpFilei, paste0(Group))
 .             j <- Rle(findInterval(seq(mat@x) - 1, mat@p[-1]) + 
 .                 1)
 .             lengthRle <- length(j@lengths)
 .             lengthI <- length(mat@i)
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/i"), storage.mode = "integer", dims = c(lengthI, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/jLengths"), storage.mode = "integer", dims = c(lengthRle, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/jValues"), storage.mode = "integer", dims = c(lengthRle, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5createDataset(tmpFilei, paste0(Group, 
 .                 "/x"), storage.mode = "double", dims = c(lengthI, 
 .                 1), level = 0))
 .             o <- .suppressAll(h5write(obj = mat@i + 1, file = tmpFilei, 
 .                 name = paste0(Group, "/i")))
 .             o <- .suppressAll(h5write(obj = j@lengths, file = tmpFilei, 
 .                 name = paste0(Group, "/jLengths")))
 .             o <- .suppressAll(h5write(obj = j@values, file = tmpFilei, 
 .                 name = paste0(Group, "/jValues")))
 .             o <- .suppressAll(h5write(obj = mat@x, file = tmpFilei, 
 .                 name = paste0(Group, "/x")))
 .             o <- .suppressAll(h5write(obj = colnames(mat), file = tmpFilei, 
 .                 name = paste0(Group, "/cellNames")))
 .         }
 .         rm(matchedRNA, mat, j)
 .     }
 .     .logDiffTime(sprintf("%s Completed Integration", prefix), 
 .         tstart, verbose = verbose, logFile = logFile)
 .     gc()
 .     matchDF$Block <- Rle(i)
 .     matchDF
 . }, threads = threads2)
4. mclapply(..., mc.cores = threads, mc.preschedule = preschedule)
5. lapply(X = X, FUN = FUN, ...)
6. FUN(X[[i]], ...)
7. Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 
 .     5), , drop = FALSE])
8. CreateSeuratObject.default(counts = mat[head(seq_len(nrow(mat)), 
 .     5), , drop = FALSE])
9. CreateAssay5Object(counts = counts, min.cells = min.cells, min.features = min.features, 
 .     ...)
10. .CreateStdAssay(counts = counts, min.cells = min.cells, min.features = min.features, 
  .     transpose = transpose, type = type, csum = csum, fsum = fsum, 
  .     ...)
11. .CreateStdAssay.list(counts = counts, min.cells = min.cells, 
  .     min.features = min.features, transpose = transpose, type = type, 
  .     csum = csum, fsum = fsum, ...)
12. `LayerData<-`(object = `*tmp*`, layer = layer, features = features[[layer]], 
  .     cells = cells[[layer]], transpose = transpose, value = counts[[layer]])
13. `LayerData<-.Assay5`(object = `*tmp*`, layer = layer, features = features[[layer]], 
  .     cells = cells[[layer]], transpose = transpose, value = counts[[layer]])
14. .handleSimpleError(function (cnd) 
  . {
  .     watcher$capture_plot_and_output()
  .     cnd <- sanitize_call(cnd)
  .     watcher$push(cnd)
  .     switch(on_error, continue = invokeRestart("eval_continue"), 
  .         stop = invokeRestart("eval_stop"), error = invokeRestart("eval_error", 
  .             cnd))
  . }, "more elements supplied than there are to replace", base::quote(slot(object = object, 
  .     name = "features")[[layer]] <- features))

Thanks a lot

danli349 avatar Sep 30 '24 15:09 danli349

Hi @danli349! Thanks for using ArchR! Lately, it has been very challenging for me to keep up with maintenance of this package and all of my other responsibilities as a PI. I have not been responding to issue posts and I have not been pushing updates to the software. We are actively searching to hire a computational biologist to continue to develop and maintain ArchR and related tools. If you know someone who might be a good fit, please let us know! In the meantime, your issue will likely go without a reply. Most issues with ArchR right not relate to compatibility. Try reverting to R 4.1 and Bioconductor 3.15. Newer versions of Seurat and Matrix also are causing issues. Sorry for not being able to provide active support for this package at this time.

rcorces avatar Sep 30 '24 15:09 rcorces

@rcorces Thanks a lot for helping, can you please let me know which Seurat and Matrix versions should I use?

danli349 avatar Oct 16 '24 15:10 danli349

@rcorces I solved this problem by changing the version of Seurat package:

remove.packages("SeuratObject")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/SeuratObject/SeuratObject_4.1.3.tar.gz"
install.packages(packageurl, repos=NULL, type="source")



remove.packages("Seurat")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/Seurat/Seurat_4.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")


Thanks a lot

danli349 avatar Oct 16 '24 16:10 danli349

@rcorces I solved this problem by changing the version of Seurat package:

remove.packages("SeuratObject")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/SeuratObject/SeuratObject_4.1.3.tar.gz"
install.packages(packageurl, repos=NULL, type="source")



remove.packages("Seurat")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/Seurat/Seurat_4.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Thanks a lot

Solved for me too, thanks!

alekseybelikov avatar Oct 18 '24 19:10 alekseybelikov

ArchR Gene Integration Process

Code Execution

ArchRsub.lungnew <- addGeneIntegrationMatrix(
    ArchRProj = ArchRsub.lungnew, 
    useMatrix = "GeneScoreMatrix",
    matrixName = "GeneIntegrationMatrix",
    reducedDims = "IterativeLSI",
    seRNA = seRNA,
    addToArrow = FALSE,
    groupRNA = "celltype_bped_main",
    nameCell = "predictedCell_Un",
    nameGroup = "predictedGroup_Un",
    nameScore = "predictedScore_Un"
)

ArchR logging to : ArchRLogs/ArchR-addGeneIntegrationMatrix-4bf73914b78f-Date-2024-10-19_Time-12-09-13.353955.log
If there is an issue, please report to github with logFile!
2024-10-19 12:09:13.473208 : Running Seurat's Integration Stuart* et al 2019, 0.002 mins elapsed.
2024-10-19 12:09:13.745389 : Checking ATAC Input, 0.007 mins elapsed.
2024-10-19 12:09:14.673089 : Checking RNA Input, 0.022 mins elapsed.
2024-10-19 12:09:19.392725 : Found 18706 overlapping gene names from gene scores and rna matrix!, 0.101 mins elapsed.
2024-10-19 12:09:19.396339 : Creating Integration Blocks, 0.101 mins elapsed.
2024-10-19 12:09:19.421006 : Prepping Interation Data, 0.101 mins elapsed.
2024-10-19 12:09:20.119927 : Computing Integration in 1 Integration Blocks!, 0 mins elapsed.
2024-10-19 12:09:20.132852 : Block (1 of 1) : Computing Integration, 0 mins elapsed.
2024-10-19 12:09:20.979738 : Block (1 of 1) : Identifying Variable Genes, 0.014 mins elapsed.
2024-10-19 12:09:23.12459 : Block (1 of 1) : Getting GeneScoreMatrix, 0.05 mins elapsed.
2024-10-19 12:09:34.256679 : Block (1 of 1) : Imputing GeneScoreMatrix, 0.236 mins elapsed.
Getting ImputeWeights
2024-10-19 12:10:09.657839 : Block (1 of 1) : Seurat FindTransferAnchors, 0.826 mins elapsed.
<simpleError in dimnames(x) <- dn: length of 'dimnames' [1] not equal to array extent>
Error in .retryCatch({ : 

Moments ago I have faced the same problems in the issue. I have use the same solution to change the Seurat package and run through with Seurat V4 with my RNA data. But when I run the addGeneIntegrationMatrix part, new error came. How to solve this?

Qian-Feng22 avatar Oct 19 '24 12:10 Qian-Feng22

@rcorces I solved this problem by changing the version of Seurat package:

remove.packages("SeuratObject")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/SeuratObject/SeuratObject_4.1.3.tar.gz"
install.packages(packageurl, repos=NULL, type="source")



remove.packages("Seurat")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/Seurat/Seurat_4.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Thanks a lot

Solved for me too, thanks!

same. Thank you kindly for sharing @danli349

xiubert avatar Nov 08 '24 15:11 xiubert

@immanuelazn could you please guide me how i can fix this error projHeme5 <- addArchRAnnotations(ArchRProj = projHeme5, collection = "EncodeTFBS") ArchR logging to : ArchRLogs/ArchR-addArchRAnnotations-19a5c72d2a4560-Date-2024-12-05_Time-14-31-56.261448.log If there is an issue, please report to github with logFile! Error in H5Fopen(file, flags = flags, fapl = fapl, native = native) : HDF5. File accessibility. Unable to open file.

IqRaZaFaR16 avatar Dec 05 '24 06:12 IqRaZaFaR16

Hi @IqRaZaFaR16 , sorry about this issue. This is related to HDF5 file locking, and has been an ongoing issue for a while. Refer to #248 for some more information, but I would recommend passing subThreading = FALSE during createArrowFiles() calls. Additionally, I would recommend trying out the dev branch through remotes::install_github("GreenleafLab/ArchR", ref = "dev") as we implemented a fix for this there

immanuelazn avatar Dec 05 '24 07:12 immanuelazn

@rcorces I solved this problem by changing the version of Seurat package:

remove.packages("SeuratObject")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/SeuratObject/SeuratObject_4.1.3.tar.gz"
install.packages(packageurl, repos=NULL, type="source")



remove.packages("Seurat")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/Seurat/Seurat_4.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Thanks a lot

I use this and it works, but change to another error😭

subproj4 <- addGeneIntegrationMatrix(

  • ArchRProj = subproj3,
  • useMatrix = "GeneScoreMatrix",
  • matrixName = "GeneIntegrationMatrix_ArchR", #整合后的名称
  • reducedDims = "IterativeLSI",
  • seRNA = merged_rna_filtered2, #对应的RNA对象
  • groupList = groupList,
  • addToArrow = T,
  • force= TRUE,
  • groupRNA = "Major_celltype",#这里其实可以调整为celltype或者cluster。调整之后会对GeneIntefrationMatrix有影响,因为是根据group来将细胞进行匹配然后看其基因的表达
  • nameCell = "predictedCell_ArchR",
  • nameGroup = "predictedCluster_ArchR",#这里对应就是cell/cluster,取个名区分下
  • nameScore = "predictedScore_ArchR",
  • plotUMAP = F,
  • useImputation = F,
  • transferParams = list(dims = 1:30),
  • assayRNA = "RNA"
  • )

ArchR logging to : ArchRLogs/ArchR-addGeneIntegrationMatrix-e1fd2403fdda0-Date-2025-02-17_Time-16-03-57.990328.log If there is an issue, please report to github with logFile! 2025-02-17 16:03:58.057631 : Running Seurat's Integration Stuart* et al 2019, 0.001 mins elapsed. 2025-02-17 16:03:58.087769 : Checking ATAC Input, 0.002 mins elapsed. 2025-02-17 16:04:09.807863 : Checking RNA Input, 0.197 mins elapsed. Error in GetAssay.Seurat(object = object, assay = assay) : RNA is not an assay present in the given object. Available assays are:

package.version("Seurat") [1] "4.3.0" package.version("SeuratObject") [1] "4.1.3"

joeyQX avatar Feb 17 '25 08:02 joeyQX

ArchR Gene Integration Process

Code Execution

ArchRsub.lungnew <- addGeneIntegrationMatrix( ArchRProj = ArchRsub.lungnew, useMatrix = "GeneScoreMatrix", matrixName = "GeneIntegrationMatrix", reducedDims = "IterativeLSI", seRNA = seRNA, addToArrow = FALSE, groupRNA = "celltype_bped_main", nameCell = "predictedCell_Un", nameGroup = "predictedGroup_Un", nameScore = "predictedScore_Un" )

ArchR logging to : ArchRLogs/ArchR-addGeneIntegrationMatrix-4bf73914b78f-Date-2024-10-19_Time-12-09-13.353955.log If there is an issue, please report to github with logFile! 2024-10-19 12:09:13.473208 : Running Seurat's Integration Stuart* et al 2019, 0.002 mins elapsed. 2024-10-19 12:09:13.745389 : Checking ATAC Input, 0.007 mins elapsed. 2024-10-19 12:09:14.673089 : Checking RNA Input, 0.022 mins elapsed. 2024-10-19 12:09:19.392725 : Found 18706 overlapping gene names from gene scores and rna matrix!, 0.101 mins elapsed. 2024-10-19 12:09:19.396339 : Creating Integration Blocks, 0.101 mins elapsed. 2024-10-19 12:09:19.421006 : Prepping Interation Data, 0.101 mins elapsed. 2024-10-19 12:09:20.119927 : Computing Integration in 1 Integration Blocks!, 0 mins elapsed. 2024-10-19 12:09:20.132852 : Block (1 of 1) : Computing Integration, 0 mins elapsed. 2024-10-19 12:09:20.979738 : Block (1 of 1) : Identifying Variable Genes, 0.014 mins elapsed. 2024-10-19 12:09:23.12459 : Block (1 of 1) : Getting GeneScoreMatrix, 0.05 mins elapsed. 2024-10-19 12:09:34.256679 : Block (1 of 1) : Imputing GeneScoreMatrix, 0.236 mins elapsed. Getting ImputeWeights 2024-10-19 12:10:09.657839 : Block (1 of 1) : Seurat FindTransferAnchors, 0.826 mins elapsed. <simpleError in dimnames(x) <- dn: length of 'dimnames' [1] not equal to array extent> Error in .retryCatch({ : Moments ago I have faced the same problems in the issue. I have use the same solution to change the Seurat package and run through with Seurat V4 with my RNA data. But when I run the addGeneIntegrationMatrix part, new error came. How to solve this?

How did you solve this problem, bro? I also have this error.

Zhumd avatar Apr 25 '25 15:04 Zhumd