satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.18k stars 891 forks source link

Error integrating ATAC and scRNA data from different platforms using `FindMultiModalNeighbors` :"Error in dimnames(x) <- dn ..." #9057

Open Nh-code opened 1 week ago

Nh-code commented 1 week ago

Recently, I wanted to integrate snATAC and snRNA data collected from different platforms using Seurat's multi-omics integration function. However, after testing (including testing the small datasets provided by the seurat), I found that this function FindMultiModalNeighbors could not run effectively in either Seurat V5 or V4 environments. The following error always occurs: " Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent Calls: FindMultiModalNeighbors ... FindModalityWeights -> lapply -> FUN -> PredictAssay -> colnames<- Execution halted "

here's the code:

library(Seurat)
library(Signac)
library(dplyr)

pbmc_small
atac_small

multiome_obj <- merge(atac_small,pbmc_small,merge.dr = T)
atac_small <- atac_small %>% FindVariableFeatures() %>% NormalizeData() %>% ScaleData() %>% RunPCA()

{
    DefaultAssay(multiome_obj) <- "peaks"
    multiome_obj <- multiome_obj %>% RunTFIDF(verbose = F) %>% 
        FindTopFeatures(verbose = F) %>% RunSVD(verbose = F) 

    DefaultAssay(multiome_obj) <- "RNA"
    multiome_obj <- multiome_obj %>% NormalizeData(verbose = F) %>% 
        FindVariableFeatures(verbose = F) %>% ScaleData(verbose = F) %>% 
        RunPCA(verbose = F)
}

{
    multiome_obj <- FindMultiModalNeighbors(
        object = multiome_obj,
        reduction.list = list("pca","lsi"),
        dims.list = list(1:10, 2:10),
        knn.range = 10,
        verbose = FALSE
    )
}

Wether Seurat's FindMultiModalNeighbors can't be used to construct co-embedding of snATAC and snRNA data from different platforms and different cells?