Correlate number of cells with gene expression of one gene in scRNA Seq
1
0
Entering edit mode
10 months ago
Bine ▴ 90

Good afternoon,

I would really appreciate any feedback on the following:

We have identified a gene and we want to understand whether a higher percentage of endothelial cells is correlated with a higher expression of this gene.

So far I managed to obtain a table of the percentage of endothelial cells per individual from our Seurat object. Now, in order to run the correlation, I need to extract the gene expression of this gene per individual. I am struggling to continue here as

a) I havent found a way yet to filter the Seurat object on a particular gene

b) I wonder how to combine the gene expression of this gene from different cells

I would like to end up with a table like this in order to run the correlation:

Sample  |   Percentage endothelial cells   | Gene expression 
1       |      20%                         |  30                                                                                                                                                                         
2       |      13%                         |  67 

....

Does it make sense? Any input highly appreciated!

Thank you!

Seurat • 1.2k views
ADD COMMENT
0
Entering edit mode

No comment on the method, but I am interested in the biology here. Aren't you just looking for genes specifically expressed or not expressed in endothelial cells? Don't they already exist in the Seurat DE tables?

ADD REPLY
0
Entering edit mode

I am interested in whether a higher expression of my gene of interest is correlated with a higher amount of endothelial cells. Where do I find the Seurat DE tables? I just started working with scRNA Seq! Thank you!

ADD REPLY
0
Entering edit mode
ADD REPLY
1
Entering edit mode
10 months ago
jv ★ 1.8k

a) I havent found a way yet to filter the Seurat object on a particular gene

assume scrna is your seurat object:

# define a vector of genes of interest
genes <- c('gene_1', 'gene_2', 'gene_3')

# subset seurat obj for genes of interest
scrna_filtered <- scrna[genes,]

b) I wonder how to combine the gene expression of this gene from different cells

What you seem to be asking about is aggregating expression across a set of cells, for that you can use Seurat::AggregateExpression https://satijalab.org/seurat/reference/aggregateexpression

ADD COMMENT
1
Entering edit mode

Hi,

Are you sure you can filter genes from a Seurat object?

I didn't try the new version 5 of the package, but at least in previous version 4 this was not possible (see old github issue: https://github.com/satijalab/seurat/issues/4958)

You would need to filter the matrix and create a new object from scratch.

I know you can do such thing (as your code suggests) with a SingleCellExperiment object though.

Just curious!

Best,

António

ADD REPLY
1
Entering edit mode

Filtering by genes as shown above works for me using SeuratObject v4.1.3 and Seurat v4.3.0

> packageVersion("Seurat")
[1] ‘4.3.0’
> packageVersion("SeuratObject")
[1] ‘4.1.3’
> class(scrna)
[1] "Seurat"
attr(,"package")
[1] "SeuratObject"
> genes <- head(rownames(scrna))
> test <- scrna[genes,]
> dim(scrna)
[1] 16313  6569
> dim(test)
[1]    6 6569
ADD REPLY
0
Entering edit mode

Worth noting that I'm not sure how the above filter applies if the Seurat object has multiple assays. The example above only has a single assay in scrna.

ADD REPLY
0
Entering edit mode

Thank you very much for your reply. For b) I think thats exactly what I need For a) this doesnt work for me (Seurat Object 5).

But I think I can actually combine it with step b) via

 kid.filtered_BAZ2B_aggregated<-AggregateExpression(
                                kid.filtered_new,
                                assays = "RNA",
                                slots="counts",
                                features = "gene_of_interest",
                                return.seurat = FALSE,
                                group.by = c("orig.ident")
                                )

I believe that in the @X slot I should have the aggregated values for that gene then, or?

ADD REPLY
1
Entering edit mode

since you are using return.seurat = FALSE I believe kid.filtered_BAZ2B_aggregated should have a matrix stored under kid.filtered_BAZ2B_aggregated$RNA but things might be different in newer versions of Seurat. Run str(kid.filtered_BAZ2B_aggregated) and you'll see what's returned.

ADD REPLY

Login before adding your answer.

Traffic: 1965 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