---
# System prepended metadata

title: 22-08： ES由来セルトリ細胞scRNAseq解析　FTSLC_scRNAseq 第3弾 (aggrしない) さらに補足
tags: [解析, ノート, TS, single-cell RNA-seq]

---

###### tags: `ノート` `TS` `解析` `single-cell RNA-seq`

# 22-08： ES由来セルトリ細胞scRNAseq解析　FTSLC_scRNAseq 第3弾 (aggrしない) さらに補足

<br>

#### 2026/6/21
#### 【 作業場所＆保存場所 】

• 作業場所
 　~/osc-fs/22_TS_FTSLC_scRNAseq_2022/Seurat_Non_aggr
 
---

#### ※ aggrしないでSeuratした方

---

4ページ目：violinplotの色変更。
```r=
library(Seurat)
library(dplyr)
library(patchwork)
library(MAST)
library(ggsci)
library(ComplexHeatmap)
library(circlize)
library(RColorBrewer)
library(scales)
library(tidyverse)
library(cowplot)

load("09_gsc_res03_20220516.RData")

　#確認
DimPlot(object = data.integrated.gsc , reduction = "umap" , label = TRUE) + scale_color_aaas()

　#　色をAAASに揃えた まとめviolin plot関数
multiVlnPlot <- function(object, features, pt.size = 0, log = FALSE, title = NULL, out_file = NULL, ...){

    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)
                        ) + scale_fill_aaas()
        
        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)
} 


　#マーカーの設定
sertoli = c("Sox9", "Mro", "Aard", "Amh", "Dhh", "Ptgds", "Hsd17b3")
progenitor = c("Sox11", "Ecm1", "Nr2f1")
granulosa = c("Kitl", "Inha", "Foxl2", "Runx1","Fst", "Akr1cl", "Cdkn1b", "Aard", "Hmgcs2")
stromal = c("Wnt5a", "Pdgfra", "Tcf21", "Acta2", "Arx", "Gng13", "Lgr5", "Apoc1", "Gpc3", "Hmcn1")


　#　MultiVlnPlot_gsc_progenitor_markers (5x10)
multiVlnPlot(object=data.integrated.gsc, features = progenitor, title="progenitor markers")
　#　MultiVlnPlot_gsc_granulosa_markers (14x10)
multiVlnPlot(object=data.integrated.gsc, features = granulosa, title="granulosa markers")
　#　MultiVlnPlot_gsc_stromal_markers 
multiVlnPlot(object=data.integrated.gsc, features = stromal, title="stromal, markers")
　#　MultiVlnPlot_gsc_sertoli_markers
multiVlnPlot(object=data.integrated.gsc, features = sertoli, title="sertoli markers")
```
![](https://i.imgur.com/9iqhER2.png)


<br>

3, 6, 8, 10ページ目: featurePlotの色変更。

```r=
load("05_20220516_cl02.RData")

 # all_UMAP.pdf (7.5x10)
DimPlot(object = data.integrated , reduction = "umap" , label = TRUE)+ scale_color_ucscgb()

 # 20220621_all_FeaturePlot_Pou5f1 (8x10)
FeaturePlot(object=data.integrated, features= "Pou5f1", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)
 # 20220621_all_FeaturePlot_Ddx4
FeaturePlot(object=data.integrated, features= "Ddx4", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)

 # 20220621_all_FeaturePlot_Pecam1
FeaturePlot(object=data.integrated, features= "Pecam1", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)
 # 20220621_all_FeaturePlot_Flt1
FeaturePlot(object=data.integrated, features= "Flt1", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)

 # 20220621_all_FeaturePlot_Hbb-y
FeaturePlot(object=data.integrated, features= "Hbb-y", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)
 # 20220621_all_FeaturePlot_Hba-a1
FeaturePlot(object=data.integrated, features= "Hba-a1", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)

 # 20220621_all_FeaturePlot_Ppbp
FeaturePlot(object=data.integrated, features= "Ppbp", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)
 # 20220621_all_FeaturePlot_Plek
FeaturePlot(object=data.integrated, features= "Plek", col=c("gray91", "magenta3"), min.cutoff=0.1, pt.size=1)

```
![](https://i.imgur.com/9lQxJ0u.png)


```r=
load("11_data.integrated.gsc16_02.RData")

 # 確認
DimPlot(object = data.integrated.gsc16_02 , reduction = "umap" , label = TRUE , split.by = "sample")

 # 20220621_FeaturePlot_Sox9 (5 x 35)
FeaturePlot(object=data.integrated.gsc16_02, features= "Sox9", col=c("gray91", "magenta3"), split.by="sample", min.cutoff=0.1, pt.size=1)
 # 20220621_FeaturePlot_Amh
FeaturePlot(object=data.integrated.gsc16_02, features= "Amh", col=c("gray91", "magenta3"), split.by="sample", min.cutoff=0.1, pt.size=1)
 # 20220621_FeaturePlot_Dhh
FeaturePlot(object=data.integrated.gsc16_02, features= "Dhh", col=c("gray91", "magenta3"), split.by="sample", min.cutoff=0.1, pt.size=1)
 # 20220621_FeaturePlot_Hsd17b3
FeaturePlot(object=data.integrated.gsc16_02, features= "Hsd17b3", col=c("gray91", "magenta3"), split.by="sample", min.cutoff=0.1, pt.size=1)

 # 20220621_FeaturePlot_Mki67 (5 x 35)
FeaturePlot(object=data.integrated.gsc16_02, features= "Mki67", col=c("gray91", "magenta3"), split.by="sample", min.cutoff=0.1, pt.size=1)

 # 20220621_gsc16_FeaturePlot_Pax8
FeaturePlot(object=data.integrated.gsc16_02, features= "Pax8", col=c("gray91", "magenta3"),  min.cutoff=0.1, pt.size=1)
```
![](https://i.imgur.com/gA6QUXs.png)

![](https://i.imgur.com/Ievr7Ta.png)



