Getting normalized gene expression matrix from seurat object as a non-sparse matrix (i.e. a normal dataframe)
0
0
Entering edit mode
2.2 years ago

I want to use a seurat normalization method on a scRAN-seq dataset, specifically the integration method they use to normalize across differnt species or datasets. Tutorial is here. Seurat objects store data in a sparese matrix and after the integration I am not performing the clustering I am using it for another purpose and I need it as a regular dataframe. How can I pull the sparse matrix out as a regular dataframe? In case this wasn't clear I am using R.

R seurat rna-seq • 3.6k views
ADD COMMENT
1
Entering edit mode

Just a warning that casting a sparse matrix into a dense matrix may require a lot of memory.

# Convert to a dense matrix and then a data.frame.
# Replace "..." with the slot name you want.

df <- as.data.frame(as.matrix(GetAssayData(seu, assay="integrated", slot="...")))

For some general advice make sure that integrated values are appropriate for your analysis. Normally integrated values are used for dimension reduction and clustering only, and log normalized counts are used for most other things like e.g. plotting.

ADD REPLY
0
Entering edit mode

I've trained a RF on some mouse data for a rare cell type. I'm looking for them in humans now using the same classifier (restricted to 1 to 1 orthologs present in both the mouse scRNA-seq and the human scRNA-seq). The RF works on other mouse datasets and I'm able to manually spot signs they should be in the human dataset but the RF isn't working in the human dataset. I'm hoping the integrated transform for seurat can fix my problems. Its just a shot in the dark, not sure if it will work but it may be a quick fix.

ADD REPLY

Login before adding your answer.

Traffic: 2135 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6