Open LacquerHed opened 8 months ago
Hi @LacquerHed! 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.
Hi @LacquerHed
I had the same error, in the same step. This is my code (the part that generates the error)
seRNA = readRDS("scRNA-Hematopoiesis-Granja-2019.rds")
seurObj = CreateSeuratObject(counts = CreateAssayObject(assay(seRNA)), meta.data = as.data.frame(colData(seRNA)))
Project = addGeneIntegrationMatrix(
ArchRProj = Project,
useMatrix = "GeneScoreMatrix",
matrixName = "GeneIntegrationMatrix",
reducedDims = "IterativeLSI",
seRNA = seurObj,
addToArrow = FALSE,
groupRNA = "BioClassification",
nameCell = "predictedCell_Un",
nameGroup = "predictedGroup_Un",
nameScore = "predictedScore_Un"
)
I was running on R-4.3.2 with ArchR-1.0.2. Reverting to an older R version (4.2.2) as suggested by @rcorces does not generate the error and the function runs smoothly. I hope this helps, also on the dev side for further fixes ;)
Try update your seurat
to 5 , archR
to 1.0.3
and bioconductor
to 3.19
And try to run Rscript
in your shell rather than using rstudio !
Hi @LacquerHed
I had the same error, in the same step. This is my code (the part that generates the error)
seRNA = readRDS("scRNA-Hematopoiesis-Granja-2019.rds") seurObj = CreateSeuratObject(counts = CreateAssayObject(assay(seRNA)), meta.data = as.data.frame(colData(seRNA))) Project = addGeneIntegrationMatrix( ArchRProj = Project, useMatrix = "GeneScoreMatrix", matrixName = "GeneIntegrationMatrix", reducedDims = "IterativeLSI", seRNA = seurObj, addToArrow = FALSE, groupRNA = "BioClassification", nameCell = "predictedCell_Un", nameGroup = "predictedGroup_Un", nameScore = "predictedScore_Un" )
I was running on R-4.3.2 with ArchR-1.0.2. Reverting to an older R version (4.2.2) as suggested by @rcorces does not generate the error and the function runs smoothly. I hope this helps, also on the dev side for further fixes ;)
I have once been doubted by the same error but it works with latest seurat
archr
bioconductor
.
Getting the same error with the latest seurat and archR
R version 4.2.2 (as suggested)
Seurat_5.1.0
SeuratObject_5.0.2
ArchR_1.0.2
2024-06-07 10:13:24 : Block (1 of 67) : Imputing GeneScoreMatrix, 2.501 mins elapsed.
Getting ImputeWeights
Warning: 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
Calls: addGeneIntegrationMatrix ... .CreateStdAssay.list -> LayerData<- -> LayerData<-.Assay5
Execution halted
Hi @LacquerHed I had the same error, in the same step. This is my code (the part that generates the error)
seRNA = readRDS("scRNA-Hematopoiesis-Granja-2019.rds") seurObj = CreateSeuratObject(counts = CreateAssayObject(assay(seRNA)), meta.data = as.data.frame(colData(seRNA))) Project = addGeneIntegrationMatrix( ArchRProj = Project, useMatrix = "GeneScoreMatrix", matrixName = "GeneIntegrationMatrix", reducedDims = "IterativeLSI", seRNA = seurObj, addToArrow = FALSE, groupRNA = "BioClassification", nameCell = "predictedCell_Un", nameGroup = "predictedGroup_Un", nameScore = "predictedScore_Un" )
I was running on R-4.3.2 with ArchR-1.0.2. Reverting to an older R version (4.2.2) as suggested by @rcorces does not generate the error and the function runs smoothly. I hope this helps, also on the dev side for further fixes ;)
I have once been doubted by the same error but it works with latest
seurat
archr
bioconductor
.
Can you share the exact version?
Here is mine
R version 4.2.2 (as suggested)
Seurat_5.1.0
SeuratObject_5.0.2
ArchR_1.0.2
And still, I get the same error. Thanks
Hi @KyriakisDimitrios
We later found out that the change that fixed the problem was actually reverting Seurat (and SeuratObject) to version 4.3, which in our case came together with reverting R version automatically, since we are using software modules on a cluster. With this change, we were able to keep the latest R version but with older Seurat.
Guys you should test addintegratedmatrix
step by step
some function in addintegratedmatrix
from Seurat
should use v4
and some v5
Hi @KyriakisDimitrios , I'm wondering if you solved this issue since I am also experiencing the same issue despite the suggestions here. I have tried using an SCE and Seurat object but it results the same error. Thanks!
Hi @KyriakisDimitrios , I'm wondering if you solved this issue since I am also experiencing the same issue despite the suggestions here. I have tried using an SCE and Seurat object but it results the same error. Thanks!
Hi @wgao688, I solved the issue using @jiangpuxuan's suggestion. I ran the function step by step and identified the problem in the 4th step: Begin Integration. This step is split into 4 substeps. I used Seurat v5 for steps 1 and 2 (Create Seurat RNA and Normalize, Get Gene Score Matrix, and Create Seurat ATAC) and Seurat v4 for steps 3 and 4 (Transfer Anchors, Transfer Data).
After repeated testing, I finally know the answer to this question:
This error occurred in the RNAIntegration.R of the ArchR package This code in the RNAIntegration.R file: seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 5), , drop = FALSE])
The Seurat::CreateSeuratObject function requires that the rownames of mat must be vector, not matrix. But the rownames passed to mat in the previous code was actually a matrix, so you only need to add a command line before this code, this will cast the rownames of mat to a vector:
rownames(mat) <- as.character(rownames(mat))
And then this error was completely eliminated.
After repeated testing, I finally know the answer to this question:
This error occurred in the RNAIntegration.R of the ArchR package This code in the RNAIntegration.R file: seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 5), , drop = FALSE])
The Seurat::CreateSeuratObject function requires that the rownames of the mat must be vector, not matrix. But the rownames passed to the mat in the previous code was actually a matrix, so you only need to add a command line before this code, this will cast the rownames of mat to a vector:
rownames(mat) <- as.character(rownames(mat))
And then this error was completely eliminated.
After repeated testing, I finally know the answer to this question:
This error occurred in the RNAIntegration.R of the ArchR package This code in the RNAIntegration.R file: seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 5), , drop = FALSE])
The Seurat::CreateSeuratObject function requires that the rownames of mat must be vector, not matrix. But the rownames passed to mat in the previous code was actually a matrix, so you only need to add a command line before this code, this will cast the rownames of mat to a vector:
rownames(mat) <- as.character(rownames(mat))
And then this error was completely eliminated.
Thxs but where is the RNAIntegration.R file? How to modify the code of the addGeneIntegrationMatrix function? I try to edit the code of ArchR but didn't figure out.
After repeated testing, I finally know the answer to this question: This error occurred in the RNAIntegration.R of the ArchR package This code in the RNAIntegration.R file: seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 5), , drop = FALSE]) The Seurat::CreateSeuratObject function requires that the rownames of mat must be vector, not matrix. But the rownames passed to mat in the previous code was actually a matrix, so you only need to add a command line before this code, this will cast the rownames of mat to a vector: rownames(mat) <- as.character(rownames(mat)) And then this error was completely eliminated.
Thxs but where is the RNAIntegration.R file? How to modify the code of the addGeneIntegrationMatrix function? I try to edit the code of ArchR but didn't figure out.
I guess you should have installed the ArchR package on Windows or the compiled ArchR package on Linux. So I suggest you download the source code package first, and never download the compiled package. Then enter to the directory of the source code of ArchR: ArchR/R/IntegrativeAnalysis.R Modify it according to the method I proposed earlier. Then install the modified source code again. As for the method of installing from the source code, please search on Google or Baidu yourself.
After repeated testing, I finally know the answer to this question: This error occurred in the RNAIntegration.R of the ArchR package This code in the RNAIntegration.R file: seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 5), , drop = FALSE]) The Seurat::CreateSeuratObject function requires that the rownames of mat must be vector, not matrix. But the rownames passed to mat in the previous code was actually a matrix, so you only need to add a command line before this code, this will cast the rownames of mat to a vector: rownames(mat) <- as.character(rownames(mat)) And then this error was completely eliminated.
Thxs but where is the RNAIntegration.R file? How to modify the code of the addGeneIntegrationMatrix function? I try to edit the code of ArchR but didn't figure out.
I guess you should have installed the ArchR package on Windows or the compiled ArchR package on Linux. So I suggest you download the source code package first, and never download the compiled package. Then enter to the directory of the source code of ArchR: ArchR/R/IntegrativeAnalysis.R Modify it according to the method I proposed earlier. Then install the modified source code again. As for the method of installing from the source code, please search on Google or Baidu yourself.
Thanks! It works!
Hi Guys I would like to provide another kind of situation THAT do not suit the solution rownames(mat) <- as.character(rownames(mat))
above.
seurat 4.4
cannot FindTransferAnchors()
correctly )ArchR project
was build at ArchR1.0.2 and Seurat object
was build at Seurat4.Seurat::CreateSeuratObject
.Because the mat
( in addGeneIntegrationMatrix()
308 line ) DO NOT have i
p
, so mat
cannot be SeuratV5:: createSeuratobject
-ed.
here is the wrong format:
here is the correct format for seuratV5::createseuratobject.:
So, someone could add i
p
to mat
, or just convert mat
from dgcmatrix to data.frame.
# LINE 308 in `addGeneIntegrationMatrix()`
#seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)),
5), , drop = FALSE])
tmp <- as.data.frame(mat[head(seq_len(nrow(mat)), 5),
, drop = FALSE])
seuratATAC <- Seurat::CreateSeuratObject(counts = tmp)
That's OK.
Hi Guys I would like to provide another kind of situation THAT do not suit the solution
rownames(mat) <- as.character(rownames(mat))
above.
- ArchR1.0.3 Seurat5.1 ( because the
seurat 4.4
cannotFindTransferAnchors()
correctly )- My
ArchR project
was build at ArchR1.0.2 andSeurat object
was build at Seurat4.- My error is also 'more elements supplied than there are to replace' in
Seurat::CreateSeuratObject
.Because the
mat
( inaddGeneIntegrationMatrix()
308 line ) DO NOT havei
p
, somat
cannot beSeuratV5:: createSeuratobject
-ed.here is the wrong format:
here is the correct format for seuratV5::createseuratobject.:
So, someone could add
i
p
tomat
, or just convertmat
from dgcmatrix to data.frame.# LINE 308 in `addGeneIntegrationMatrix()` #seuratATAC <- Seurat::CreateSeuratObject(counts = mat[head(seq_len(nrow(mat)), 5), , drop = FALSE]) tmp <- as.data.frame(mat[head(seq_len(nrow(mat)), 5), , drop = FALSE]) seuratATAC <- Seurat::CreateSeuratObject(counts = tmp)
That's OK.
May I know this mat file is generated by your scRNA data? I am running the test data they provided, the dataset doesn't look like yours.
May I know this mat file is generated by your scRNA data? I am running the test data they provided, the dataset doesn't look like yours.
the mat
file is generated by addGeneIntegration
function
For those still hitting this issue, I've generated a branch of ArchR with this patch implemented (along with additional helpful functions) here: If you're not familiar, you can clone this and use devtools to install it, or simply load it in (devtools::load_all() ) over your existing ArchR installation. https://github.com/aifimmunology/ArchR
Hi I am running unconstrained integration and getting the following error, which seems to stem from the slots/layers ArchR is pulling from the seRNA (Seurat object) input.
2024-03-14 12:11:53.67366 : Block (1 of 1) : Imputing GeneScoreMatrix, 0.323 mins elapsed. Getting ImputeWeights Warning: 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
This is happening with Seurat V5 objects but also V4 when I downgraded to that, so not sure if its the new layer structure of Seurat V5. Not sure how to limit elements supplied from the seRNA. Thanks.
ArchR-addGeneIntegrationMatrix-129a04b8342d3-Date-2024-03-14_Time-12-11-30.735514.log