GreenleafLab / ArchR

ArchR : Analysis of Regulatory Chromatin in R (www.ArchRProject.com)
MIT License
378 stars 135 forks source link

Problem How to convert archr project into seurat #2207

Open A-legac45 opened 1 day ago

A-legac45 commented 1 day ago

Hi, @rcorces @jeffmgranja @jgranja24 @keyuxi

I would llke to copy my entire ARCHR project cluster, embedding, umap ... into a seurat object but I do not succed to copy embeddings

I try many things but without success :

such as

code

Extraire toutes les matrices disponibles

all_matrices <- lapply(matrices, function(mat) { getMatrixFromProject(project_Peaks_RES0.9_subcluster, useMatrix = mat, binarize = TRUE) })

Nommer les matrices extraites pour identification

names(all_matrices) <- matrices

Extraire tous les embeddings disponibles

embeddings <- c("UMAP_ATAC", "UMAP_RNA") # Ajouter d'autres embeddings si disponibles all_embeddings <- lapply(embeddings, function(emb) { getEmbedding(project_Peaks_RES0.9_subcluster, embedding = emb) })

TEST POUR UNE MATRIX

geneScoreMatrixtest <- assay(geneScoreMatrix)

rownames(geneScoreMatrixtest) = geneScoreMatrix@elementMetadata$name

Créer un objet Seurat à partir de la matrice des scores de gènes

seurat_obj <- CreateSeuratObject(counts = geneScoreMatrixtest)

Ajouter les métadonnées du projet ArchR (par exemple, clusters, batch, etc.)

seurat_obj@meta.data <- as.data.frame(project_Peaks_RES0.9_subcluster@cellColData) umap_embeddings <- getEmbedding(ArchRProj = project_Peaks_RES0.9_subcluster, embedding = "UMAP_ATAC", returnDF = TRUE) head(umap_embeddings) LSI_ATAC#UMAP_Dimension_1 LSI_ATAC#UMAP_Dimension_2 First_try_multiomic_archr#GCGGGTTTCGCTATAA-1 -1.1732380 -0.65935683 First_try_multiomic_archr#GCGAGTGAGGAGTCTT-1 -2.1469619 0.02576101 First_try_multiomic_archr#GTTACCTGTTAACAGT-1 2.5640571 -1.99734956 First_try_multiomic_archr#CGGGACAAGTACCGCA-1 -1.2808077 -1.08204150 First_try_multiomic_archr#AGTGTGGCAATAAGCA-1 -0.4350121 -1.20366609 First_try_multiomic_archr#GGAGGTTAGAGGAGGA-1 1.0420330 -2.85625717 seurat_obj[[umap_embeddings]] <- CreateDimReducObject(embeddings = umapembeddings, key = "LSI", assay = "RNA") Error in validObject(.Object) : invalid class “DimReduc” object: invalid object for slot "cell.embeddings" in class "DimReduc": got class "data.frame", should be or extend class "matrix" In addition: Warning message: Keys should be one or more alphanumeric characters followed by an underscore, setting key from LSI to LSI

rcorces commented 1 day ago

Hi @A-legac45! 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.