---
# System prepended metadata

title: 22-07： ES由来セルトリ細胞scRNAseq解析　FTSLC_scRNAseq 第２弾 (aggrしない) その他 補足
tags: [解析, ノート, TS, single-cell RNA-seq]

---

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

# 22-07： ES由来セルトリ細胞scRNAseq解析　FTSLC_scRNAseq 第２弾 (aggrしない) その他 補足

<br>

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

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


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

【参考】
scRNA-seqデータの解析(応用編)
https://hackmd.io/@takahirosuzuki/ByoEBNVPL

---

p１　全細胞UMAPと各FeaturePlot
```r=
library(Seurat)
library(dplyr)
library(patchwork)
library(MAST)
library(ggsci)
library("ComplexHeatmap")
library("circlize")
library("RColorBrewer")
library(scales)
library(tidyverse)

load("05_20220516_cl02.RData")

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

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

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

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

# 20220609_all_FeaturePlot_Ppbp
FeaturePlot(object=data.integrated, features= "Ppbp", col=c("gray", "red"), min.cutoff=0.1, pt.size=1)
# 20220609_all_FeaturePlot_Plek
FeaturePlot(object=data.integrated, features= "Plek", col=c("gray", "red"), min.cutoff=0.1, pt.size=1)
```
<br>

p3 gscの色を揃えたUMAP
```r=
load("09_gsc_res03_20220516.RData")

#20220609_gsc_UMAP.pdf (7.5x10)
DimPlot(object = data.integrated.gsc, reduction = "umap" , label = TRUE) + scale_color_aaas()
```
<br>

p4 各クラスターの割合barplot
```r=
load("11_data.integrated.gsc16_02.RData")

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

#XX_conposition

#割合の計算
prop_cluster <- prop.table(x=table(data.integrated.gsc16_02@active.ident, data.integrated.gsc16_02@meta.data$sample), margin =2)

#XX_plot用にデータフレームに変換
Cluster_name=factor(rownames(prop_cluster), levels=rownames(prop_cluster))    
df <- data.frame(Cluster=Cluster_name,XX_10.5=prop_cluster[,1], XX_11.5=prop_cluster[,2], XX_12.5=prop_cluster[,3], XX_FOSLCs=prop_cluster[,4])
df2 <- tidyr::gather(df, key=Sample, value=Proportion, -Cluster, factor_key = TRUE)

#ggplotでvidualization
theme <- theme(panel.background = element_blank(), 
               panel.border = element_blank(),
               panel.grid.major = element_blank(),
               panel.grid.minor = element_blank(),
               strip.background = element_blank(),
               plot.title = element_text(size = 10,hjust = 0.5),
               axis.text.x = element_text(size=10, angle=90),
               axis.text.y = element_text(size=10),
               axis.title.x = element_blank(),
               axis.title.y = element_text(size=10),
               axis.ticks = element_line(size=0.5),
               axis.line = element_line(size=0.5),
               plot.margin = unit(c(1,1,1,1),"line")
)
 
g <- ggplot(df2, aes(x= Sample, y = Proportion, fill=Cluster))
g <- g + geom_bar(stat = "identity")
g <- g + scale_y_continuous(labels = percent)    # display as %
g <- g + theme

#20220609_XX_conposition_barplot (7x10)
g

#割合の計算
prop_cluster <- prop.table(x=table(data.integrated.gsc16_02@active.ident, data.integrated.gsc16_02@meta.data$sample), margin =2)

#XY_plot用にデータフレームに変換
Cluster_name=factor(rownames(prop_cluster), levels=rownames(prop_cluster))    
df <- data.frame(Cluster=Cluster_name,XY_10.5=prop_cluster[,5], XY_11.5=prop_cluster[,6], XY_12.5=prop_cluster[,7], XY_FTSLCs=prop_cluster[,8])
df2 <- tidyr::gather(df, key=Sample, value=Proportion, -Cluster, factor_key = TRUE)

#ggplotでvidualization
theme <- theme(panel.background = element_blank(), 
               panel.border = element_blank(),
               panel.grid.major = element_blank(),
               panel.grid.minor = element_blank(),
               strip.background = element_blank(),
               plot.title = element_text(size = 10,hjust = 0.5),
               axis.text.x = element_text(size=10, angle=90),
               axis.text.y = element_text(size=10),
               axis.title.x = element_blank(),
               axis.title.y = element_text(size=10),
               axis.ticks = element_line(size=0.5),
               axis.line = element_line(size=0.5),
               plot.margin = unit(c(1,1,1,1),"line")
)
 
g <- ggplot(df2, aes(x= Sample, y = Proportion, fill=Cluster))
g <- g + geom_bar(stat = "identity")
g <- g + scale_y_continuous(labels = percent)  
g <- g + theme

#20220609_XY_conposition_barplot 
g
```

<br>

p7 sampleごとに分けないPax8
```r=
# 20220609_gsc16_FeaturePlot_Pax8
FeaturePlot(object=data.integrated.gsc16_02, features= "Pax8", col=c("gray", "red"),  min.cutoff=0.1, pt.size=1)
```