brianhie / scanorama

Panoramic stitching of single cell data
http://scanorama.csail.mit.edu
MIT License
265 stars 49 forks source link

Issue #162

Open sdhbiusdgb opened 3 months ago

sdhbiusdgb commented 3 months ago

Hello, author, When I was using scanorama for single-cell data integration in R, I encountered difficulties but have not been able to solve them, so I would like to seek help from your team. The specific code and errors are as follows: Code library(reticulate) library(tidyverse) library(Seurat) library(Matrix)

Specify Python virtual environment

use_python("/Software/PythonENV/xteam.py3.8/bin/python", required = TRUE)

Import necessary Python packages

scanorama <- import("scanorama")

Generate random matrix

seurat_obj1 <- readRDS("/IData/DataCenter/ColorectalCancer/Chen_Cell_2021_CRC/scRNAseq.processed.rds") seurat_obj2 <- readRDS("/IData/DataCenter/ColorectalCancer/Giguelay_Theranostics_2022/scRNAseq.processed.ok.rds")

Extract sparse count matrix

seurat_obj1_counts <- seurat_obj1@assays $ RNA@counts seurat_obj2_counts <- seurat_obj2@assays $ RNA@counts X1 <- as.matrix(seurat_obj1_counts) genes1 <- rownames(seurat_obj1_counts) genes1[1:5] X2 <- as.matrix(seurat_obj2_counts) genes2 <- rownames(seurat_obj2_counts)

Put the data into the list

datasets <- list(X1, X2) genes_list <- list(genes1, genes2)

Use Scanorama for data integration

integrated_result <- scanorama$integrate(datasets, genes_list)

Error Found 13402 genes among all datasets Error in py_call_impl(callable, call_args$unnamed, call_args$named) : IndexError: index (14510) out of range Run reticulate::py_last_error() for details. @