CostaLab / scMEGA

scMEGA: Single-cell Multiomic Enhancer-based Gene regulAtory network inference
https://costalab.github.io/scMEGA
Other
32 stars 2 forks source link

get the gene activity matrix from ArchR #11

Closed liyang24 closed 1 year ago

liyang24 commented 1 year ago

hi! I would like to know how to get the gene activity matrix in the example from ArchR, since I used the function gene activity matrix to get a different object like this:

gene.activity class: SummarizedExperiment dim: 14103 6791 metadata(0): assays(1): GeneScoreMatrix rownames: NULL rowData names(6): seqnames start ... name idx colnames(6791): #AAACGAAAGGATCCTT-1

AAACGAAAGGCATGCA-1 ... #TTTGTGTTCGATCGCG-1

TTTGTGTTCGATCTTT-1

colData names(15): DoubletEnrichment DoubletScore ... Clusters Celltype

lzj1769 commented 1 year ago

Hi,

You can extract the gene activity matrix like this:

proj <- addGeneScoreMatrix(proj,
                           force = TRUE)
atac <- getMatrixFromProject(ArchRProj = proj,
                             useMatrix = "GeneScoreMatrix")
gene_counts <- atac@assays@data$GeneScoreMatrix
rownames(gene_counts) <- atac@elementMetadata$name
saveRDS(gene_counts, file = "../data/snATAC/GeneScoreMatrix.Rds")
liyang24 commented 1 year ago

Thanks a lot ! i got it