###### tags: `ノート` `TS` `解析` `single-cell RNA-seq`
# 22-03: ES由来セルトリ細胞scRNAseq解析 その3 各マーカーのplot (aggrしない)
<br>
#### 2026/04/22
#### 【 作業場所&保存場所 】
• 作業場所
~/osc-fs/22_TS_FTSLC_scRNAseq_2022/Seurat_Non_aggr
---
#### ※ aggrしないでSeuratした方
【参考】
scRNA-seqデータの解析(応用編)
https://hackmd.io/@takahirosuzuki/ByoEBNVPL
<br>
### 1. 各マーカーのfeatureplot
Early-Sertoli: Sry, Runx1, Nr0b1
Sertoli: Sox9, Dhh, Amh
Early Prog/Int. Prog: Nr2f1, Tcf21, Pdgfra
Getal Leydig:Cyp11a1, Cyp17a1, Star
の発現をfeatureplot, 各サンプル毎で。
```r=
load("20220422_5_data.integrated.RData")
#Early-Sertoli
pdf("FeaturePlot_Sry.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Sry", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdf("FeaturePlot_Runx1.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Runx1", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdf("FeaturePlot_Nr0b1.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Nr0b1", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdfjoin --outfile FeaturePlot_Early-Sertoli.pdf FeaturePlot_Sry.pdf FeaturePlot_Runx1.pdf FeaturePlot_Nr0b1.pdf
```

```r=
#Sertoli
pdf("FeaturePlot_Sox9.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Sox9", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
dev.off()
pdf("FeaturePlot_Dhh.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Dhh", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
dev.off()
pdf("FeaturePlot_Amh.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Amh", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
dev.off()
pdfjoin --outfile FeaturePlot_Sertoli_0.5.pdf FeaturePlot_Sox9.pdf FeaturePlot_Dhh.pdf FeaturePlot_Amh.pdf
```

```r=
#Early Prog/Int. Prog: Nr2f1, Tcf21, Pdgfra
pdf("FeaturePlot_Nr2f1.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Nr2f1", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdf("FeaturePlot_Tcf21.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Tcf21", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdf("FeaturePlot_Pdgfra.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Pdgfra", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdfjoin --outfile FeaturePlot_EarlyProgInt.pdf FeaturePlot_Nr2f1.pdf FeaturePlot_Tcf21.pdf FeaturePlot_Pdgfra.pdf
```

```r=
#Getal Leydig:Cyp11a1, Cyp17a1, Star
pdf("FeaturePlot_Cyp11a1.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Cyp11a1", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdf("FeaturePlot_Cyp17a1.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Cyp17a1", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdf("FeaturePlot_Star.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Star", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=1)
dev.off()
pdfjoin --outfile FeaturePlot_GetalLeydig.pdf FeaturePlot_Cyp11a1.pdf FeaturePlot_Cyp17a1.pdf FeaturePlot_Star.pdf
```

```r=
#overy-specific marker: Foxl2、Wnt4、Dax1
pdf("FeaturePlot_Foxl2.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Foxl2", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
dev.off()
pdf("FeaturePlot_Wnt4.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Wnt4", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
dev.off()
pdf("FeaturePlot_Nr0b1.pdf", width=35, height=5)
FeaturePlot(object=data.integrated, features= "Nr0b1", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
dev.off()
pdfjoin --outfile FeaturePlot_GetalLeydig.pdf FeaturePlot_Cyp11a1.pdf FeaturePlot_Cyp17a1.pdf FeaturePlot_Star.pdf
```



あと、Sryですが、XYのE11.5で少し発現している細胞がありそうなのですが、pt.sizeやmax.cutoffあたりをいじって少し見やすくできますか?
```r=
#FeaturePlot_Sry.pdf
FeaturePlot(object=data.integrated, features= "Sry", col=c("gray", "red"), split.by="sample", min.cutoff=0.1, pt.size=0.5)
FeaturePlot(object=data.integrated, features= "Sry", col=c("gray", "red"), split.by="sample", min.cutoff=0.5, pt.size=0.5)
```


<br>
#### 2. まとめ MultiVlnPlot
```r=
multiVlnPlot <- function(object, features, pt.size = 0, log = FALSE, title = NULL, out_file = NULL, ...){
library(Seurat)
library(ggplot2)
library(cowplot)
scaleFUN <- function(x) sprintf("%.1f", x)
gplot.list <- list()
for(i in 1:length(features)){
vg <- VlnPlot(object = object, features = features[i], pt.size = pt.size, log = log,...)
vg <- vg + scale_y_continuous(labels=scaleFUN)
vg <- vg + scale_fill_discrete(name="Cluster")
vg <- vg + ylab(features[i])
vg <- vg + theme(legend.position = 'none',
axis.title.x = element_blank(),
axis.title.y = element_text(face="bold", vjust = 0.5),
plot.title = element_blank(),
axis.text.x = element_blank(),
panel.border = element_rect(colour="gray1", fill=NA)
)
gplot.list <- c(gplot.list, list(vg))
}
legend <- get_legend(gplot.list[[1]] +
theme(legend.position = "right") +
guides(color = guide_legend(ncol = 1))
)
# now add the title
if(!is.null(title)){
gtitle <- ggdraw() +
draw_label(
title,
fontface = 'bold',
x = 0.5,
hjust = 0.5
)
}else gtitle <- NULL
gplot_all <- plot_grid(plotlist = gplot.list, ncol=1)
gplot_all_title <- plot_grid(gtitle,
gplot_all, nrow = 2,
rel_heights = c(0.5/(length(features)+0.5), length(features)/(length(features)+0.5))
)
gplot_all_legend <- plot_grid(gplot_all_title, legend, ncol=2, rel_widths = c(8, .6))
plot(gplot_all_legend)
if (!is.null(out_file)){
ggsave(file=out_file, plot=gplot_all_legend, width=14, height=length(features)+0.5)
}
return (gplot_all_legend)
}
#マーカーの設定
markers_Sertoli <- c("Sox9", "Dhh", "Amh")
# markers_SertoliでPlot
multiVlnPlot(object=data.integrated, features = markers_Sertoli, title="Sertoli : Sox9, Dhh, Amh Markers", out_file = "MultiVlnPlot_Sertoli_markers.pdf")
```
