satijalab / seurat

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

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

Closed nh-codem closed 4 months ago

nh-codem commented 5 months 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?

longmanz commented 4 months ago

Hi , Do you refer to a situation where the ATAC and RNA are 2 different sets of cells? FindMultiModalNeighbors only works on multi-modal data (i.e., each cell have 2 modalities). If your aim is to integrate an snATAC data with a scRNA data (cross-modality integration), you may consider using bridge integration: https://satijalab.org/seurat/articles/seurat5_integration_bridge