Frequency of the gene expression in Seurat
1
1
Entering edit mode
3.1 years ago
yueli7 ▴ 250

Hello,

I can go through the Seurat all the code from here: https://satijalab.org/seurat/archive/v3.0/visualization_vignette.html.

My question is: Is that possible that I can get the frequency of one gene in one cluster?

Thank you in advance for your great help!

Best Regards,

Yue

2021-10-05-10-21-14

Seurat • 3.8k views
ADD COMMENT
0
Entering edit mode

By frequency do you mean the percent of cells in a cluster with at least one UMI detected for that gene?

ADD REPLY
0
Entering edit mode

Hello rpolicastro,

Yes. You are right!

Thank you!

Best,

Yue

ADD REPLY
3
Entering edit mode
3.1 years ago

DotPlot computes the fraction of cells expressing a gene in each group (metadata column), so you can cheat a little and extract the results from it [source].

library("Seurat")

features <- c("PECAM1", "CD14")
group_column <- "clusters"

perc_exp <- DotPlot(seu, features=features, group.by=group_column)$data[, c("features.plot", "id", "pct.exp")]

The returned data will look something like this:

> perc_exp
  features.plot          id  pct.exp
1        PECAM1 Endothelial 26.55087
2          CD14 Endothelial 37.21239
3        PECAM1     T Cells 57.28534
4          CD14     T Cells 90.82078

You can then plot this easily using ggplot.

library("ggplot")

ggplot(perc_exp, aes(x=id, y=pct.exp, fill=id)) +
  geom_col() +
  facet_wrap(~features.plot)

enter image description here


Example data used.

perc_exp <- structure(list(features.plot = c("PECAM1", "CD14", "PECAM1", 
"CD14"), id = c("Endothelial", "Endothelial", "T Cells", "T Cells"
), pct.exp = c(26.55086631421, 37.212389963679, 57.2853363351896, 
90.8207789994776)), class = "data.frame", row.names = c(NA, -4L
))
ADD COMMENT
0
Entering edit mode

Hello rpolicastro,

Thank you so much for your great help!

It is really helpful!

Another question: do you have any idea of the statistical analysis of these data?

Thank you again and really appreciated!

Best Regards,

Yue

> a<-DotPlot(hms_cluster_id,features = c("CST7","PRF1","GZMB","NKG7","GZMH","ADGRG1"),group.by="tech")
> a$data
          avg.exp  pct.exp features.plot    id avg.exp.scaled
CST7    1.9827403 99.66054          CST7 Blood    -0.91611169
PRF1    0.4429154 94.56872          PRF1 Blood    -0.97967384
GZMB    0.4535181 98.08512          GZMB Blood    -0.94559874
NKG7    1.6937367 96.17895          NKG7 Blood    -1.01593918
GZMH    0.3611691 94.86465          GZMH Blood    -0.92377315
ADGRG1  0.0803917 92.27957        ADGRG1 Blood    -0.87072124
CST71   3.9999110 72.95855          CST7 Tumor     1.06678774
PRF11   1.0076192 49.06146          PRF1 Tumor     1.01915665
GZMB1   2.3696889 45.08814          GZMB Tumor     1.04671772
NKG71   4.6311312 55.54073          NKG7 Tumor     0.98325969
GZMH1   1.0144191 42.64888          GZMH Tumor     1.06187189
ADGRG11 0.2199527 37.83707        ADGRG1 Tumor     1.09215845
CST72   2.7614053 95.17601          CST7 Juxta    -0.15067605
PRF12   0.7085354 86.04954          PRF1 Juxta    -0.03948280
GZMB2   1.2657222 82.59452          GZMB Juxta    -0.10111898
NKG72   3.2344572 92.11213          NKG7 Juxta     0.03267949
GZMH2   0.6196452 77.37940          GZMH Juxta    -0.13809874
ADGRG12 0.1265559 66.75359        ADGRG1 Juxta    -0.22143721
> perc_exp<-a$data
> ggplot(perc_exp, aes(x=id, y=pct.exp, fill=id)) + geom_col() +facet_wrap(~features.plot)

Screenshot-from-2021-10-05-18-10-50

ADD REPLY

Login before adding your answer.

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