1 options(stringsAsFactors = F ) 2 rm(list = ls()) 3 library(Seurat) 4 library(dplyr) 5 library(ggplot2) 6 library(Hmisc) 7 library(pheatmap) 8 #读入数据 9 10 11 #合并gene去batch 12 expr_1 <- readRDS("C:/Gu_lab/PA/result/pipline_results/P1_normal/expr.RDS") 13 expr_1 <- RenameCells(expr_1,add.cell.id = "P1",for.merge = T ) 14 expr_8 <- readRDS("C:/Gu_lab/PA/result/pipline_results/P8_normal/expr.RDS") 15 expr_8 <- RenameCells(expr_8,add.cell.id = "P8",for.merge = T ) 16 expr_all_P1_P8_nobatch <- FindIntegrationAnchors(c(expr_1,expr_8)) 17 expr_all_P1_P8_nobatch <- IntegrateData(anchorset = expr_all_P1_P8_nobatch, dims = 1:30) 18 expr_all_P1_P8_nobatch <- FindVariableFeatures(expr_all_P1_P8_nobatch) 19 all.genes <- rownames(expr_all_P1_P8_nobatch) 20 expr_all_P1_P8_nobatch <- ScaleData(expr_all_P1_P8_nobatch,features = all.genes) 21 expr_all_P1_P8_nobatch <- RunPCA(expr_all_P1_P8_nobatch,features = VariableFeatures(object = expr_all_P1_P8_nobatch)) 22 ElbowPlot(expr_all_P1_P8_nobatch) 23 expr_all_P1_P8_nobatch <- FindNeighbors(expr_all_P1_P8_nobatch,dims = 1:20) 24 expr_all_P1_P8_nobatch <- FindClusters(expr_all_P1_P8_nobatch,resolution = 0.5) 25 expr_all_P1_P8_nobatch <- RunUMAP(expr_all_P1_P8_nobatch, dims = 1:20) 26 DimPlot(expr_all_P1_P8_nobatch,reduction = "umap",cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#000099","#660066","#333333") ) 27 cell_soruce <-rep(c('P1','P8'), times = c(1651,523)) 28 newident_1 <- factor(cell_soruce) 29 expr_all_P1_P8_nobatch_save <- expr_all_P1_P8_nobatch 30 Idents(expr_all_P1_P8_nobatch) <- newident_1 31 #expr_nobatch_seurat@active.ident <- newident_1 32 DimPlot(expr_all_P1_P8_nobatch,reduction = "umap",cols =c("#F0E442", "#999999", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73","#FF0000","#333333") ) 33 expr_all_P1_P8_nobatch <- expr_all_P1_P8_nobatch_save 34 outdir <- "C:/Gu_lab/PA/result/Pred_result/P1_P8_normal/" 35 saveRDS(expr_all_P1_P8_nobatch_save, file =paste0(outdir,"expr_all_P1_P8.RDS")) 36 37 #根据Marker去掉免疫细胞 38 pdf(file = paste0(outdir,"Tcell_feature.pdf"),width = 12,height = 4) 39 VlnPlot(expr_all_P1_P8_nobatch,features = c("CD2","CD3D","CD3E","CD3G","CD4","CD8","CD45"),pt.size = 0)#T-cell Markers 40 dev.off() 41 #FeaturePlot(expr_all_P1_P8_nobatch,features = c("CD2","CD3D","CD3E","CD3G","CD4","CD8","CD45")) 42 pdf(file = paste0(outdir,"Bcell_feature.pdf"),width = 8,height = 2) 43 VlnPlot(expr_all_P1_P8_nobatch,features = c("PTPRC","CD79A","CD19","CD20","CD45"),pt.size = 0)#T-cell Markers 44 dev.off() 45 pdf(file = paste0(outdir,"NK_cell_feature.pdf"),width = 8,height = 2) 46 VlnPlot(expr_all_P1_P8_nobatch,features = c("PTPRC","NKG7","CD56"),pt.size = 0)#T-cell Markers 47 dev.off() 48 pdf(file = paste0(outdir,"Macrophage-cell_feature.pdf"),width = 16,height = 6) 49 VlnPlot(expr_all_P1_P8_nobatch,features = c("CD14","CD163", "CD68", "CSF1R","CD33","HLA-DR","AIF1","FCER1G", "FCGR3A", "TYROBP"),pt.size = 0)#Macrophage-cell Markers 50 dev.off() 51 pdf(file = paste0(outdir,"Fibroblasts-cell_feature.pdf"),width = 16,height = 6) 52 VlnPlot(expr_all_P1_P8_nobatch,features = c("ACTA2","FAP", "PDPN","COL1A2","DCN", "COL3A1", "COL6A1","S100A4","COL1A1","THY1"),pt.size = 0)#Fibroblasts-cell Markers 53 dev.off() 54 pdf(file = paste0(outdir,"Endothelial-cell_feature.pdf"),width = 12,height = 4) 55 VlnPlot(expr_all_P1_P8_nobatch,features = c("PLVAP","PECAM1","VWF","ENG","MCAM","CD146"),pt.size = 0)#Endothelial-cell Markers 56 dev.off() 57 58 pdf(file = paste0(outdir,"Somatotrope_feature.pdf"),width = 12,height = 4) 59 Somatotrope_feature = c("Pappa2","Ceacam10","Tcerg1l","Cabp2","Wnt10a","RP24-294M17.1","Mmp7","Ghrhr","Gh1") 60 Somatotrope_feature = toupper(Somatotrope_feature) 61 VlnPlot(expr_all_P1_P8_nobatch, features =Somatotrope_feature,pt.size = 0) 62 #FeaturePlot(expr_all_P1_P8_nobatch,features = Somatotrope_feature) 63 dev.off() 64 65 66 67 68 pdf(file = paste0(outdir,"Lactotrope_feature.pdf"),width = 12,height = 4) 69 Lactotrope_feature = c("Prl","Agtr1a","Syndig1","Angpt1","Edil3","6030419C18Rik","Hepacam2","Cilp","Akr1c14") 70 Lactotrope_feature = toupper(Lactotrope_feature) 71 VlnPlot(expr_all_P1_P8_nobatch, features =Lactotrope_feature,pt.size = 0) 72 #FeaturePlot(expr_all_P1_P8_nobatch,features = Lactotrope_feature) 73 dev.off() 74 75 pdf(file = paste0(outdir,"Corticotrope_feature.pdf"),width = 12,height = 6) 76 Corticotrope_feature = c("Gpc5","Tnnt1","Tnni3","Gm15543","Cplx3","Egr4","Cdh8","Galnt9","Pomc") 77 Corticotrope_feature = toupper(Corticotrope_feature) 78 VlnPlot(expr_all_P1_P8_nobatch, features =Corticotrope_feature,pt.size = 0) 79 #FeaturePlot(expr_all_P1_P8_nobatch,features = Corticotrope_feature) 80 dev.off() 81 82 pdf(file = paste0(outdir,"Melanotrope_feature.pdf"),width = 12,height = 4) 83 Melanotrope_feature = c("Oacyl","Esm1","Pkib","Gulo","Megf11","Rbfox3","Scn2a1","Pax7","Pcsk2") 84 Melanotrope_feature = toupper(Melanotrope_feature) 85 VlnPlot(expr_all_P1_P8_nobatch, features =Melanotrope_feature,pt.size = 0) 86 #FeaturePlot(expr_all_P1_P8_nobatch,features = Melanotrope_feature) 87 dev.off() 88 89 pdf(file = paste0(outdir,"Thyrotrope_feature.pdf"),width = 8,height = 2) 90 Thyrotrope_feature = c("Tshb","Trhr","Dio2") 91 Thyrotrope_feature = toupper(Thyrotrope_feature) 92 VlnPlot(expr_all_P1_P8_nobatch, features =Thyrotrope_feature,pt.size = 0) 93 #FeaturePlot(expr_all_P1_P8_nobatch,features = Thyrotrope_feature) 94 dev.off() 95 96 pdf(file = paste0(outdir,"Stem_cell_feature.pdf"),width = 16,height = 4) 97 Stem_cell_feature = c("Cyp2f2","Lcn2","Mia","Cpxm2","Rbpms","Gm266","Cdh26","Aqp3","Aqp4","CD8A") 98 Stem_cell_feature = toupper(Stem_cell_feature) 99 VlnPlot(expr_all_P1_P8_nobatch, features =Stem_cell_feature,pt.size = 0) 100 #FeaturePlot(expr_all_P1_P8_nobatch,features = Stem_cell_feature) 101 dev.off() 102 103 pdf(file = paste0(outdir,"Proliferatring_Pou1f1_feature.pdf"),width = 16,height = 4) 104 Proliferatring_Pou1f1_feature = c("POU1f1","Pbk","Spc25","Ube2c","Hmmr","Ckap2l","Spc25","Cdca3","Birc5","Ccnb1") 105 Proliferatring_Pou1f1_feature = toupper(Proliferatring_Pou1f1_feature) 106 VlnPlot(expr_all_P1_P8_nobatch, features =Proliferatring_Pou1f1_feature,pt.size = 0) 107 #FeaturePlot(expr_all_P1_P8_nobatch,features = Proliferatring_Pou1f1_feature) 108 dev.off() 109 110 #激素的Gene 111 pdf(file = paste0(outdir,"VlnPlot.pdf"),width = 16,height = 6) 112 VlnPlot(expr_all_P1_P8_nobatch, features =c("TSHB","TBX19","PCSK2","FHSB","GH1", "PRL", "POMC", "CGA", "LHB", "POU1F1","MIA"),pt.size = 0) 113 dev.off() 114 115 #Cell_Type 116 expr_all_P1_P8_nobatch <- readRDS(paste0(outdir,"expr_all_P1_P8.RDS")) 117 expr <- RenameIdents(expr_all_P1_P8_nobatch,'4' = 'T_NK','5' = 'Fibroblasts','3' = 'Endothelial','1' = 'Macrophage','0' = 'Somatotrope','2' = 'Lactotrope','7' = 'Corticotrope','8' = 'Gonadotrope','6' = 'Stem cell') 118 DimPlot(expr,cols = c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333")) 119 120 121 122 ##Fig2 DEgene heatmap 123 124 expr_all_P1_P8_nobatch.markers <- FindAllMarkers(expr_all_P1_P8_nobatch) 125 top10 <- expr_all_P1_P8_nobatch.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_logFC) 126 DoHeatmap(expr_all_P1_P8_nobatch, features = top10$gene) + NoLegend() 127 128 top5 <- expr_all_P1_P8_nobatch.markers %>% group_by(cluster) %>% top_n(n = 5, wt = avg_logFC) 129 DoHeatmap(expr_all_P1_P8_nobatch, features = top5$gene) + NoLegend() 130 131 pdf(file = paste0(outdir,"vlnplot_new.pdf"),width = 16,height = 24) 132 VlnPlot(expr_all_P1_P8_nobatch, features = top5$gene, pt.size = 0) 133 #for(i in 1:length(top5$gene)){ 134 #print(top5$gene[i]) 135 #VlnPlot(expr_all_P1_P8_nobatch, features = top5$gene, pt.size = 0) 136 #FeaturePlot(expr_all_P1_P8_nobatch,features = top5$gene[i]) 137 #} 138 dev.off() 139 #mice cell type, reclus 140 mice_expr_init <- readRDS(file = "C:/Gu_lab/PA/data/mouse/mice_exp.rds") 141 DimPlot(mice_expr_init,reduction = "umap",cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#000099","#660066","#333333") ) 142 143 144 #mice_corr_P1&P8 145 146 mice_expr<- readRDS(file = "C:/Gu_lab/PA/data/mouse/mice_exp_final.rds") 147 DimPlot(mice_expr,reduction = "umap",cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#000099","#660066","#333333") ) 148 149 #top10 <- expr_all_P1_P8_nobatch.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_logFC) 150 # 151 top10 <- expr_all_P1_P8_nobatch.markers %>% group_by(cluster) %>% top_n(n = 10, wt = p_val) 152 153 top5 <- expr_all_P1_P8_nobatch.markers %>% group_by(cluster) %>% top_n(n = 5, wt = p_val) 154 155 #定义corr矩阵,row_mice,col_human 156 featureGene_mice <- mice_expr@assays$RNA@var.features 157 featureGene_human <- toupper(featureGene_mice) 158 corr_matrix = matrix(nrow = 11, ncol = 9) 159 mice_ident <- mice_expr@active.ident 160 expr_all_P1_P8_nobatch_ident <- expr_all_P1_P8_nobatch@active.ident 161 expr_ident <- expr@active.ident 162 scale_expr_matrix_mice <- mice_expr@assays$RNA@scale.data 163 scale_expr_matrix_human <- expr@assays$integrated@scale.data 164 tm_rowname <- rownames(scale_expr_matrix_mice) 165 tm_rowname_human<- rownames(scale_expr_matrix_human) 166 167 for( i in 1:11){ 168 featrue_x = array(rep(0,length(featureGene_mice)),dim = length(featureGene_mice)) 169 x_name = levels(mice_ident)[i] 170 expr_mice <- scale_expr_matrix_mice[,which(mice_ident==x_name)] 171 for(k in 1:length(featureGene_mice)){ 172 id = which(tm_rowname == featureGene_mice[k]) 173 featrue_x[k] = sum(expr_mice[id,]) 174 } 175 featrue_x = featrue_x/length(colnames(scale_expr_matrix_mice)) 176 for(j in 1:9){ 177 featrue_y = array(rep(0,length(featureGene_mice)),dim = length(featureGene_mice)) 178 y_name = levels(expr_ident)[j] 179 expr_human <- scale_expr_matrix_human[,which(expr_ident==y_name)] 180 for(k in 1:length(featureGene_human)){ 181 if(featureGene_human[k] %in% tm_rowname_human){ 182 id = which(tm_rowname_human == featureGene_human[k]) 183 featrue_y[k] = sum(expr_human[id,]) 184 } 185 } 186 featrue_y = featrue_y/length(colnames(scale_expr_matrix_human)) 187 print(featrue_y[1:10]) 188 corr_matrix[i,j] = cor(featrue_x,featrue_y,method = "spearman") 189 } 190 } 191 192 rownames(corr_matrix) <- levels(mice_ident) 193 colnames(corr_matrix) <- levels(expr_ident) 194 #pheatmap(corr_matrix,clustering_distance_rows = "correlation",display_numbers = T,number_format = "%.2f") 195 pheatmap(corr_matrix,clustering_distance_rows = "correlation",cluster_rows = T,cluster_cols =T,display_numbers = T,number_format = "%.2f") 196 197 198 ######################################################################################################### 199 #老鼠的数据处理见 mouse_data_init.R 200 #use human var gene 201 corr_matrix = matrix(nrow = 11, ncol = 9) 202 mice_ident <- mice_expr@active.ident 203 expr_ident <- expr@active.ident 204 #scale_expr_matrix_mice <- mice_expr@assays$RNA@scale.data 205 #scale_expr_matrix_human <- expr@assays$integrated@scale.data 206 tm_rowname <- rownames(scale_expr_matrix_mice) 207 tm_rowname_human<- rownames(scale_expr_matrix_human) 208 featureGene_human <- expr@assays$integrated@var.features 209 featureGene_mice <- tolower(featureGene_human) 210 featureGene_mice <- capitalize(featureGene_mice) 211 212 for( i in 1:11){ 213 featrue_x = array(rep(0,length(featureGene_mice)),dim = length(featureGene_mice)) 214 x_name = levels(mice_ident)[i] 215 expr_mice <- scale_expr_matrix_mice[,which(mice_ident==x_name)] 216 for(k in 1:length(featureGene_mice)){ 217 if(featureGene_mice[k] %in% tm_rowname){ 218 id = which(tm_rowname == featureGene_mice[k]) 219 featrue_x[k] = sum(expr_mice[id,]) 220 } 221 } 222 featrue_x = featrue_x/length(colnames(scale_expr_matrix_mice)) 223 for(j in 1:9){ 224 featrue_y = array(rep(0,length(featureGene_mice)),dim = length(featureGene_mice)) 225 y_name = levels(expr_ident)[j] 226 expr_human <- scale_expr_matrix_human[,which(expr_ident==y_name)] 227 for(k in 1:length(featureGene_human)){ 228 if(featureGene_human[k] %in% tm_rowname_human){ 229 id = which(tm_rowname_human == featureGene_human[k]) 230 featrue_y[k] = sum(expr_human[id,]) 231 } 232 } 233 featrue_y = featrue_y/length(colnames(scale_expr_matrix_human)) 234 print(featrue_y[1:10]) 235 corr_matrix[i,j] = cor(featrue_x,featrue_y,method = "spearman") 236 } 237 } 238 239 rownames(corr_matrix) <- levels(mice_ident) 240 colnames(corr_matrix) <- levels(expr_ident) 241 #pheatmap(corr_matrix,clustering_distance_rows = "correlation",display_numbers = T,number_format = "%.2f") 242 pheatmap(corr_matrix,clustering_distance_rows = "correlation",cluster_rows = T,cluster_cols =T,display_numbers = T,number_format = "%.2f") 243 244 245 246 247 248 249 #########################################################################################################33 250 251 252 253 expr_all_P1_P8_nobatch_filter <- SubsetData(expr_all_P1_P8_nobatch, ident.remove = '9') 254 saveRDS(expr_all_P1_P8_nobatch_filter, file =paste0(outdir,"expr_all_P1_P8_filter.RDS")) 255 expr_all_P1_P8_nobatch_filter <- SubsetData(expr_all_P1_P8_nobatch_filter,ident.remove = '9') 256 257 258 pdf(file = paste0(outdir,"Dimplot_filter_cell.pdf"),width = 9,height = 7) 259 DimPlot(expr_all_P1_P8_nobatch_filter,cols = c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333")) 260 dev.off() 261 Gene_train <- read.table("C:/Gu_lab/PA/result/mouse_scaleFeatures_rf/Train_Gene_capital_1.txt",sep = " ",stringsAsFactors = F) 262 Gene_train <- Gene_train[,1] 263 Gene_train 264 265 scale_data <- expr_all_P1_P8_nobatch_filter@assays$integrated@scale.data 266 rownames(scale_data) 267 var_gene_exp <- scale_data[which(rownames(scale_data) %in% Gene_train),] 268 269 write.table(var_gene_exp,paste0(outdir,"exp_train_gene_scale_cells.txt"),row.names = T,col.names = T, quote = F) 270 # 271 #python 预测 272 # 273 274 expr <- readRDS("C:/Gu_lab/PA/result/Pred_result/P1_P8_tumor/expr_all_P1_P8_filter.RDS") 275 Gene_list <- read.table("C:/Gu_lab/PA/result/mouse_scaleFeatures_rf/Train_Gene_capital_1.txt") 276 #expr<- RunPCA(expr,features = Gene_list$V1) 277 #DimPlot(expr, reduction = "pca") 278 #ElbowPlot(expr) 279 #expr <- FindNeighbors(expr, dims = 1:10) 280 #expr <- FindClusters(expr, resolution = 0.5) 281 #expr <- RunUMAP(expr,dims = 1:10) 282 283 284 285 286 287 #Plot 预测结果 288 outdir <- "C:/Gu_lab/PA/result/Pred_result/P1_P8_tumor/Replot/" 289 #expr <- readRDS("C:/Gu_lab/PA/result/Pred_result/P1_P8_tumor/expr_filter_cells.rds") 290 291 Pred_data <- read.table('C:/Gu_lab/PA/result/Pred_result/P1_P8_tumor/Pred_results_scale_cell_resample.txt') 292 newident <- Pred_data['V2'][[1]] 293 expr[["CellType"]] <- Pred_data['V2'][[1]] 294 newident <- factor(newident) 295 Idents(expr) <- newident 296 expr[["PredScore"]] <- Pred_data['V3'][[1]] 297 298 #expr_filter_unknown<- SubsetData(expr,ident.use = c("Lactotrope","Thyrotrope","Somatotrope")) 299 expr_filter_unknown <- subset(expr,idents = c("Lactotrope","Somatotrope")) 300 expr_filter_unknown <- RunPCA(expr_filter_unknown,features = Gene_list$V1[1:100]) 301 DimPlot(expr_filter_unknown, reduction = "pca") 302 ElbowPlot(expr_filter_unknown) 303 expr_filter_unknown <- RunUMAP(expr_filter_unknown,dims = 1:20,n.neighbors = 50) 304 305 pdf(file = paste0(outdir,"Dimplot_Pred_results.pdf"),width = 9,height = 7) 306 #去掉数目特别少的类 307 DimPlot(expr_filter_unknown,pt.size = 1,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 308 dev.off() 309 #DimPlot(expr,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 310 Alapha = expr_filter_unknown@meta.data$PredScore 311 umap_pos <- expr_filter_unknown@reductions$umap@cell.embeddings 312 umap_pos_frame <- data.frame(umap_pos) 313 314 #(tsne_pos_frame, aes(x = tSNE_1,y = tSNE_2,color = newident)) + geom_point(size =3,shape = 20,alpha = Alapha) 315 #输出文件的位置 316 dirout <- "C:/Gu_lab/PA/result/Pred_result/P1_P8_tumor/Replot/" 317 318 #不同类别细胞分开画 319 iden_cell = expr_filter_unknown@meta.data$CellType 320 for(i in 1:length(iden_cell)){ 321 if(iden_cell[i]!="Lactotrope") { 322 iden_cell[i] = "Others" 323 } 324 } 325 Cell_type = iden_cell 326 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 327 #gg 328 pdf(file = paste0(dirout,"Lactotrope.pdf"),width = 9,height = 7) 329 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type )) + geom_point(size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell")+scale_colour_manual(values=c( "red","grey"))+theme(plot.title = element_text(hjust = 0.5)) 330 dev.off() 331 332 #不同类别细胞分开画 333 iden_cell =expr_filter_unknown@meta.data$CellType 334 for(i in 1:length(iden_cell)){ 335 if(iden_cell[i]!="Melanotrope") { 336 iden_cell[i] = "Others" 337 } 338 } 339 Cell_type = iden_cell 340 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 341 pdf(file = paste0(dirout,"Melanotrope.pdf"),width = 9,height = 7) 342 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type )) + geom_point(size =1,shape = 20,alpha = Alapha)+labs(title = "Melanotrope_like cell")+scale_colour_manual(values=c( "red","grey"))+theme(plot.title = element_text(hjust = 0.5)) 343 dev.off() 344 345 346 #不同类别细胞分开画 347 iden_cell = expr_filter_unknown@meta.data$CellType 348 for(i in 1:length(iden_cell)){ 349 if(iden_cell[i]!="Corticotrope") { 350 iden_cell[i] = "Others" 351 } 352 } 353 Cell_type = iden_cell 354 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 355 pdf(file = paste0(dirout,"Corticotrope.pdf"),width = 9,height = 7) 356 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type )) + geom_point(size =1,shape = 20,alpha = Alapha)+labs(title = "Corticotrope_like cell")+scale_colour_manual(values=c( "red","grey"))+theme(plot.title = element_text(hjust = 0.5)) 357 dev.off() 358 359 #不同类别细胞分开画 360 iden_cell = expr_filter_unknown@meta.data$CellType 361 for(i in 1:length(iden_cell)){ 362 if(iden_cell[i]!="Proliferating_Pou1f1") { 363 iden_cell[i] = "Others" 364 } 365 } 366 Cell_type = iden_cell 367 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 368 pdf(file = paste0(dirout,"Proliferating_Pou1f1.pdf"),width = 9,height = 7) 369 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type )) + geom_point(size =1,shape = 20,alpha = Alapha)+labs(title = "Proliferating_Pou1f1_like cell")+scale_colour_manual(values=c( "grey","red"))+theme(plot.title = element_text(hjust = 0.5)) 370 dev.off() 371 372 #不同类别细胞分开画 373 iden_cell = expr_filter_unknown@meta.data$CellType 374 for(i in 1:length(iden_cell)){ 375 if(iden_cell[i]!="Somatotrope") { 376 iden_cell[i] = "Others" 377 } 378 } 379 Cell_type = iden_cell 380 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 381 pdf(file = paste0(dirout,"Somatotrope.pdf"),width = 9,height = 7) 382 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type )) + geom_point(size =1,shape = 20,alpha = Alapha)+labs(title = "Somatotrope_like cell")+scale_colour_manual(values=c( "grey","red"))+theme(plot.title = element_text(hjust = 0.5)) 383 dev.off() 384 385 #不同类别细胞分开画 386 iden_cell = Pred_data['V2'][[1]] 387 for(i in 1:length(iden_cell)){ 388 if(iden_cell[i]!="Stem_cell") { 389 iden_cell[i] = "Others" 390 } 391 } 392 Cell_type = iden_cell 393 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 394 pdf(file = paste0(dirout,"Stem_cell.pdf"),width = 9,height = 7) 395 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type )) + geom_point(size =1,shape = 20,alpha =Alapha)+labs(title = "Stem_cell_like cell")+scale_colour_manual(values=c( "grey","red"))+theme(plot.title = element_text(hjust = 0.5)) 396 dev.off() 397 398 399 #不同类别细胞分开画 400 iden_cell = expr_filter_unknown@meta.data$CellType 401 for(i in 1:length(iden_cell)){ 402 if(iden_cell[i]!="Thyrotrope") { 403 iden_cell[i] = "Others" 404 } 405 } 406 Cell_type = iden_cell 407 #gg <- ggplot(data = tsne_pos_frame)+geom_point(mapping = aes(x = tSNE_1,y = tSNE_2,color = CC),size =1,shape = 20,alpha = Alapha)+labs(title = "Lactotrope_like cell") + scale_color_hue(name = "Cell_type",labels = c("Lactotrope","Others")) 408 pdf(file = paste0(dirout,"Thyrotrope.pdf"),width = 9,height = 7) 409 ggplot(umap_pos_frame, aes(x = UMAP_1,y = UMAP_2,color = Cell_type)) + geom_point(size =1,shape = 20,alpha = Alapha)+labs(title = "Thyrotrope_like cell")+scale_colour_manual(values=c( "grey","red"))+theme(plot.title = element_text(hjust = 0.5)) 410 dev.off() 411 412 #看一下两坨细胞来源是否分别是两个样本 413 414 cell_source <-colnames(expr_filter_unknown) 415 cell_type <- strsplit(cell_source,split = '_') 416 ct <-rep(c('P1'), times = length(cell_source)) 417 for( i in 1:length(cell_source)){ 418 if(cell_type[[i]][1]=='P4'){ 419 ct[i]='P4' 420 } 421 } 422 newident <- factor(ct) 423 Idents(expr_filter_unknown) <- newident 424 DimPlot(expr_filter_unknown,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 425 426 #统计一下,两中细胞来源的细胞的细胞类型比例 427 428 sum1_S = 0 429 sum1_L = 0 430 sum4_S = 0 431 sum4_L = 0 432 433 for(i in 1:length(cell_source)){ 434 if(cell_type[[i]][1]=='P1' && Pred_data$V2[i]=='Somatotrope'){sum1_S = sum1_S + 1} 435 else if(cell_type[[i]][1]=='P1' && Pred_data$V2[i]=='Lactotrope'){sum1_L = sum1_L + 1} 436 else if(cell_type[[i]][1]=='P4' && Pred_data$V2[i]=='Lactotrope'){sum4_L = sum4_L + 1} 437 else{sum4_S = sum4_S + 1} 438 } 439 440 #泌乳型的分的并不好,可能是去除了batch的原因,因为MNN的假设是不公的细胞类型相同 441 #但因为P1和P4是不同的细胞类型,所以可以不用做MNN,可以用简单的回归,把表达量拉到同一尺度即可 442 443 expr_1 <- readRDS("C:/Gu_lab/PA/result/pipline_results/P1_tumor/expr.RDS") 444 expr_1 <- RenameCells(expr_1,add.cell.id = "P1_",for.merge = T ) 445 expr_4 <- readRDS("C:/Gu_lab/PA/result/pipline_results/P4_tumor/expr.RDS") 446 expr_4 <- RenameCells(expr_4,add.cell.id = "P4_",for.merge = T ) 447 expr_1_4 <- merge(expr_1,expr_4) 448 expr_1_4 <- FindVariableFeatures(expr_1_4) 449 all.genes <- rownames(expr_1_4) 450 expr_1_4 <- ScaleData(expr_1_4,features = all.genes) 451 expr_1_4 <- RunPCA(expr_1_4,features = VariableFeatures(object = expr_1_4)) 452 ElbowPlot(expr_1_4) 453 expr_1_4 <- FindNeighbors(expr_1_4,dims = 1:20) 454 expr_1_4 <- FindClusters(expr_1_4,resolution = 0.5) 455 expr_1_4 <- RunUMAP(expr_1_4, dims = 1:20) 456 DimPlot(expr_1_4,reduction = "umap",cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#000099","#660066","#333333") ) 457 cell_soruce <-rep(c('P','N'), times = c(10281,7007)) 458 newident_1 <- factor(cell_soruce) 459 expr_1_4_save <- expr_1_4 460 Idents(expr_1_4) <- newident_1 461 #expr_nobatch_seurat@active.ident <- newident_1 462 DimPlot(expr_1_4,reduction = "umap",cols =c("#F0E442", "#999999", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73","#FF0000","#333333") ) 463 expr_1_4 <- expr_1_4_save 464 outdir <- "C:/Gu_lab/PA/result/Pred_result/P1_P8_Tumor/" 465 saveRDS(expr_1_4, file =paste0(outdir,"expr_all_P1_P8_new.RDS")) 466 467 #feature plot 468 outdir <- "C:/Gu_lab/PA/result/Pred_result/P1_P8_Tumor/with_batch/" 469 pdf(file = paste0(outdir,"Somatotrope_feature.pdf")) 470 Somatotrope_feature = c("Pappa2","Ceacam10","Tcerg1l","Cabp2","Wnt10a","RP24-294M17.1","Mmp7","Ghrhr","Gh") 471 Somatotrope_feature = toupper(Somatotrope_feature) 472 VlnPlot(expr_1_4, features =Somatotrope_feature) 473 FeaturePlot(expr_1_4,features = Somatotrope_feature) 474 dev.off() 475 476 pdf(file = paste0(outdir,"Lactotrope_feature.pdf")) 477 Lactotrope_feature = c("Prl","Agtr1a","Syndig1","Angpt1","Edil3","6030419C18Rik","Hepacam2","Cilp","Akr1c14") 478 Lactotrope_feature = toupper(Lactotrope_feature) 479 VlnPlot(expr_1_4, features =Lactotrope_feature) 480 FeaturePlot(expr_1_4,features = Lactotrope_feature) 481 dev.off() 482 483 pdf(file = paste0(outdir,"Corticotrope_feature.pdf")) 484 Corticotrope_feature = c("Gpc5","Tnnt1","Tnni3","Gm15543","Cplx3","Egr4","Cdh8","Galnt9","Pomc") 485 Corticotrope_feature = toupper(Corticotrope_feature) 486 VlnPlot(expr_1_4, features =Corticotrope_feature) 487 FeaturePlot(expr_1_4,features = Corticotrope_feature) 488 dev.off() 489 490 pdf(file = paste0(outdir,"Melanotrope_feature.pdf")) 491 Melanotrope_feature = c("Oacyl","Esm1","Pkib","Gulo","Megf11","Rbfox3","Scn2a1","Pax7","Pcsk2") 492 Melanotrope_feature = toupper(Melanotrope_feature) 493 VlnPlot(expr_1_4, features =Melanotrope_feature) 494 FeaturePlot(expr_1_4,features = Melanotrope_feature) 495 dev.off() 496 497 pdf(file = paste0(outdir,"Thyrotrope_feature.pdf")) 498 Thyrotrope_feature = c("Tshb","Trhr","Dio2") 499 Thyrotrope_feature = toupper(Thyrotrope_feature) 500 VlnPlot(expr_1_4, features =Thyrotrope_feature) 501 FeaturePlot(expr_1_4,features = Thyrotrope_feature) 502 dev.off() 503 504 pdf(file = paste0(outdir,"Stem_cell_feature.pdf")) 505 Stem_cell_feature = c("Cyp2f2","Lcn2","Mia","Cpxm2","Rbpms","Gm266","Cdh26","Aqp3","Aqp4") 506 Stem_cell_feature = toupper(Stem_cell_feature) 507 VlnPlot(expr_1_4, features =Stem_cell_feature) 508 FeaturePlot(expr_1_4,features = Stem_cell_feature) 509 dev.off() 510 511 pdf(file = paste0(outdir,"Proliferatring_Pou1f1_feature.pdf")) 512 Proliferatring_Pou1f1_feature = c("POU1f1","Pbk","Spc25","Ube2c","Hmmr","Ckap2l","Spc25","Cdca3","Birc5","Ccnb1") 513 Proliferatring_Pou1f1_feature = toupper(Proliferatring_Pou1f1_feature) 514 VlnPlot(expr_1_4, features =Proliferatring_Pou1f1_feature) 515 FeaturePlot(expr_1_4,features = Proliferatring_Pou1f1_feature) 516 dev.off() 517 518 pdf(file = paste0(outdir,"T_B_NK_feature.pdf")) 519 VlnPlot(expr_1_4,features = c("CD2","CD3D","CD3E","CD3G","CD4","CD8","CD45"))#T-cell Markers 520 FeaturePlot(expr_1_4,features = c("CD2","CD3D","CD3E","CD3G","CD4","CD8","CD45")) 521 VlnPlot(expr_1_4,features = c("PTPRC","CD79A","CD19","CD20","CD45"))#B-cell Markers 522 FeaturePlot(expr_1_4,features = c("PTPRC","CD79A","CD19","CD20","CD45")) 523 VlnPlot(expr_1_4,features = c("PTPRC","NKG7","CD56"))#NK-cell Markers 524 FeaturePlot(expr_1_4,features = c("PTPRC","NKG7","CD56")) 525 dev.off() 526 pdf(file = paste0(outdir,"Macrophage-cell_feature.pdf")) 527 VlnPlot(expr_1_4,features = c("CD14","CD163", "CD68", "CSF1R","CD33","HLA-DR","AIF1","FCER1G", "FCGR3A", "TYROBP"))#Macrophage-cell Markers 528 FeaturePlot(expr_1_4,features = c("CD14","CD163", "CD68", "CSF1R","CD33","HLA-DR","AIF1","FCER1G", "FCGR3A", "TYROBP")) 529 dev.off() 530 pdf(file = paste0(outdir,"Fibroblasts-cell_feature.pdf")) 531 VlnPlot(expr_1_4,features = c("ACTA2","FAP", "PDPN","COL1A2","DCN", "COL3A1", "COL6A1","S100A4","COL1A1","THY1"))#Fibroblasts-cell Markers 532 dev.off() 533 pdf(file = paste0(outdir,"Endothelial-cell_feature.pdf")) 534 VlnPlot(expr_1_4,features = c("PLVAP","PECAM1","VWF","ENG","MCAM","CD146"))#Endothelial-cell Markers 535 FeaturePlot(expr_1_4,features = c("PLVAP","PECAM1","VWF","ENG","MCAM","CD146")) 536 dev.off() 537 VlnPlot(expr_1_4,features = c("GH1","PRL","POU1F1")) 538 539 #下面是为了去掉非垂体细胞: 540 expr_1_4 <- SubsetData(expr_1_4,ident.use = c( '0','1','2','3','4','5','6','7')) 541 pdf(file = paste0(outdir,"Dimplot_filter_cell.pdf"),width = 9,height = 7) 542 DimPlot(expr_1_4,cols = c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333")) 543 dev.off() 544 saveRDS(expr_1_4,file = paste0(outdir,"expr_1_4_filter.RDS")) 545 Gene_train <- read.table("C:/Gu_lab/PA/result/mouse_scaleFeatures_rf/Train_Gene_capital.txt",sep = " ",stringsAsFactors = F) 546 Gene_train <- Gene_train[,1] 547 Gene_train 548 549 scale_data <- expr_1_4@assays$RNA@scale.data 550 rownames(scale_data) 551 var_gene_exp <- scale_data[which(rownames(scale_data) %in% Gene_train),] 552 553 write.table(var_gene_exp,"C:/Gu_lab/PA/result/Pred_result/P1_P8_Tumor/exp_train_gene_scale_cells.txt",row.names = T,col.names = T, quote = F) 554 555 #去掉垂体细胞以后看一下C('GH1','PRL','POU1F1','TSHB')四个基因的分布 556 pdf(file = paste0(outdir,"GH1_PRL_POU1F1_TSHB.pdf"),width = 13,height = 9) 557 VlnPlot(expr_1_4,features = c('GH1','PRL','POU1F1','TSHB'))#Endothelial-cell Markers 558 dev.off() 559 pdf(file = paste0(outdir,"GH1_PRL_POU1F1_TSHB_FeaturePlot.pdf"),width = 10,height = 9) 560 FeaturePlot(expr_1_4,features = c('GH1','PRL','POU1F1','TSHB')) 561 dev.off() 562 563 564 #Plot 预测结果 565 566 expr <- readRDS(file = paste0(outdir,"expr_1_4_filter.RDS")) 567 Pred_data <- read.table('C:/Gu_lab/PA/result/Pred_result/P1_P8_tumor/Pred_results_scale_cell_resample.txt') 568 newident <- Pred_data['V2'][[1]] 569 newident <- factor(newident) 570 Idents(expr) <- newident 571 572 pdf(file = paste0(outdir,"Dimplot_Pred_results.pdf"),width = 9,height = 7) 573 #去掉数目特别少的类 574 DimPlot(expr,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 575 dev.off() 576 #DimPlot(expr,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 577 Alapha = Pred_data['V3'][[1]] 578 tsne_pos <- expr@reductions$tsne@cell.embeddings 579 tsne_pos_frame <- data.frame(tsne_pos) 580 col = c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#CC79A7", "#0072B2", "#D55E00","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") 581 cid <- Pred_data['V4'][[1]] 582 CC = col[cid+1] 583 584 #去掉unknown 585 expr_filter_unknown <- SubsetData(expr,ident.remove = "Unknown") 586 DimPlot(expr_filter_unknown,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 587 588 expr_filter_unknown <- SubsetData(expr,ident.use = c("Lactotrope","Somatotrope")) 589 DimPlot(expr_filter_unknown,reduction = "umap",cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#000099","#660066","#333333") ) 590 591 expr_filter_unknown <- FindVariableFeatures(expr_filter_unknown) 592 all.genes <- rownames(expr_filter_unknown) 593 expr_filter_unknown <- ScaleData(expr_filter_unknown,features = all.genes) 594 expr_filter_unknown <- RunPCA(expr_filter_unknown,features = VariableFeatures(object = expr_filter_unknown)) 595 ElbowPlot(expr_filter_unknown) 596 #expr_filter_unknown <- FindNeighbors(expr_filter_unknown,dims = 1:20) 597 #expr_filter_unknown <- FindClusters(expr_filter_unknown,resolution = 0.5) 598 expr_filter_unknown <- RunUMAP(expr_filter_unknown, dims = 1:20) 599 DimPlot(expr_filter_unknown,reduction = "umap",cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#000099","#660066","#333333") ) 600 expr_filter_unknown_save <- expr_filter_unknown 601 602 #看一下细胞来源 603 #看一下两坨细胞来源是否分别是两个样本 604 605 cell_source <-colnames(expr_filter_unknown) 606 cell_type <- strsplit(cell_source,split = '_') 607 ct <-rep(c('P1'), times = length(cell_source)) 608 for( i in 1:length(cell_source)){ 609 if(cell_type[[i]][1]=='P4'){ 610 ct[i]='P4' 611 } 612 } 613 newident <- factor(ct) 614 Idents(expr_filter_unknown) <- newident 615 DimPlot(expr_filter_unknown,cols =c("#999999","#FF0099", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#990000","#9900cc","#66FF66","#663300","#0000FF","#CC0033","#FF0000","#333333") ) 616 617 #统计一下,两中细胞来源的细胞的细胞类型比例 618 619 sum1_S = 0 620 sum1_L = 0 621 sum4_S = 0 622 sum4_L = 0 623 624 predresult <- expr_filter_unknown@active.ident 625 626 for(i in 1:length(cell_type)){ 627 if(cell_type[[i]][1]=='P1' && predresult[i]=='Somatotrope'){sum1_S = sum1_S + 1} 628 else if(cell_type[[i]][1]=='P1' && predresult[i]=='Lactotrope'){sum1_L = sum1_L + 1} 629 else if(cell_type[[i]][1]=='P4' && predresult[i]=='Lactotrope'){sum4_L = sum4_L + 1} 630 else{sum4_S = sum4_S + 1} 631 } 632 633 #看一下细胞的marker表达情况 634 VlnPlot(expr_filter_unknown,features = c("GH1","PRL","TSHB","POU1F1"))#Endothelial-cell Markers 635 FeaturePlot(expr_filter_unknown,features = c("GH1","PRL","TSHB","POU1F1")) 636 637 638 639 640 pdf(file = paste0(outdir,"Somatotrope_feature.pdf")) 641 Somatotrope_feature = c("Pappa2","Ceacam10","Tcerg1l","Cabp2","Wnt10a","RP24-294M17.1","Mmp7","Ghrhr","Gh") 642 Somatotrope_feature = toupper(Somatotrope_feature) 643 VlnPlot(expr, features =Somatotrope_feature) 644 FeaturePlot(expr,features = Somatotrope_feature) 645 dev.off() 646 647 pdf(file = paste0(outdir,"Lactotrope_feature.pdf")) 648 Lactotrope_feature = c("Prl","Agtr1a","Syndig1","Angpt1","Edil3","6030419C18Rik","Hepacam2","Cilp","Akr1c14") 649 Lactotrope_feature = toupper(Lactotrope_feature) 650 VlnPlot(expr, features =Lactotrope_feature) 651 FeaturePlot(expr,features = Lactotrope_feature) 652 dev.off() 653 654 pdf(file = paste0(outdir,"Corticotrope_feature.pdf")) 655 Corticotrope_feature = c("Gpc5","Tnnt1","Tnni3","Gm15543","Cplx3","Egr4","Cdh8","Galnt9","Pomc") 656 Corticotrope_feature = toupper(Corticotrope_feature) 657 VlnPlot(expr, features =Corticotrope_feature) 658 FeaturePlot(expr,features = Corticotrope_feature) 659 dev.off() 660 661 pdf(file = paste0(outdir,"Melanotrope_feature.pdf")) 662 Melanotrope_feature = c("Oacyl","Esm1","Pkib","Gulo","Megf11","Rbfox3","Scn2a1","Pax7","Pcsk2") 663 Melanotrope_feature = toupper(Melanotrope_feature) 664 VlnPlot(expr, features =Melanotrope_feature) 665 FeaturePlot(expr,features = Melanotrope_feature) 666 dev.off() 667 668 pdf(file = paste0(outdir,"Thyrotrope_feature.pdf")) 669 Thyrotrope_feature = c("Tshb","Trhr","Dio2") 670 Thyrotrope_feature = toupper(Thyrotrope_feature) 671 VlnPlot(expr, features =Thyrotrope_feature) 672 FeaturePlot(expr,features = Thyrotrope_feature) 673 dev.off() 674 675 pdf(file = paste0(outdir,"Stem_cell_feature.pdf")) 676 Stem_cell_feature = c("Cyp2f2","Lcn2","Mia","Cpxm2","Rbpms","Gm266","Cdh26","Aqp3","Aqp4") 677 Stem_cell_feature = toupper(Stem_cell_feature) 678 VlnPlot(expr, features =Stem_cell_feature) 679 FeaturePlot(expr,features = Stem_cell_feature) 680 dev.off() 681 682 pdf(file = paste0(outdir,"Proliferatring_Pou1f1_feature.pdf")) 683 Proliferatring_Pou1f1_feature = c("POU1f1","Pbk","Spc25","Ube2c","Hmmr","Ckap2l","Spc25","Cdca3","Birc5","Ccnb1") 684 Proliferatring_Pou1f1_feature = toupper(Proliferatring_Pou1f1_feature) 685 VlnPlot(expr, features =Proliferatring_Pou1f1_feature) 686 FeaturePlot(expr,features = Proliferatring_Pou1f1_feature) 687 dev.off() 688 689 pdf(file = paste0(outdir,"T_B_NK_feature.pdf")) 690 VlnPlot(expr,features = c("CD2","CD3D","CD3E","CD3G","CD4","CD8","CD45"))#T-cell Markers 691 FeaturePlot(expr,features = c("CD2","CD3D","CD3E","CD3G","CD4","CD8","CD45")) 692 VlnPlot(expr,features = c("PTPRC","CD79A","CD19","CD20","CD45"))#B-cell Markers 693 FeaturePlot(expr,features = c("PTPRC","CD79A","CD19","CD20","CD45")) 694 VlnPlot(expr,features = c("PTPRC","NKG7","CD56"))#NK-cell Markers 695 FeaturePlot(expr,features = c("PTPRC","NKG7","CD56")) 696 dev.off() 697 pdf(file = paste0(outdir,"Macrophage-cell_feature.pdf")) 698 VlnPlot(expr,features = c("CD14","CD163", "CD68", "CSF1R","CD33","HLA-DR","AIF1","FCER1G", "FCGR3A", "TYROBP"))#Macrophage-cell Markers 699 FeaturePlot(expr,features = c("CD14","CD163", "CD68", "CSF1R","CD33","HLA-DR","AIF1","FCER1G", "FCGR3A", "TYROBP")) 700 dev.off() 701 pdf(file = paste0(outdir,"Fibroblasts-cell_feature.pdf")) 702 VlnPlot(expr,features = c("ACTA2","FAP", "PDPN","COL1A2","DCN", "COL3A1", "COL6A1","S100A4","COL1A1","THY1"))#Fibroblasts-cell Markers 703 dev.off() 704 pdf(file = paste0(outdir,"Endothelial-cell_feature.pdf")) 705 VlnPlot(expr,features = c("PLVAP","PECAM1","VWF","ENG","MCAM","CD146"))#Endothelial-cell Markers 706 FeaturePlot(expr,features = c("PLVAP","PECAM1","VWF","ENG","MCAM","CD146")) 707 dev.off() 708 VlnPlot(expr,features = c("GH1","CHGA","SLPI")) 709 VlnPlot(expr,features = c("GH1","CHGA","SLPI")) 710 VlnPlot(expr,features = c("GH"))