-
Notifications
You must be signed in to change notification settings - Fork 1
/
Data_Processing.R
131 lines (124 loc) · 13 KB
/
Data_Processing.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
***************QC and clustering************************
library(Seurat)
library(dplyr)
library(harmony)
ovary_count<-Read10X("/media/disk1/RNA-seq/ovary_aggr/outs/filtered_feature_bc_matrix/")
ovary<- CreateSeuratObject(counts = ovary_count, project = "ovary", min.cells = 3, min.features = 200)
ovary[["percent.mt"]] <- PercentageFeatureSet(ovary, pattern = "^MT-")
ovary<- subset(ovary, subset = nFeature_RNA > 200 & nFeature_RNA < 6000 & percent.mt < 15)
ovary<- NormalizeData(ovary, normalization.method = "LogNormalize", scale.factor = 10000)
ovary<- FindVariableFeatures(ovary, selection.method = "vst", nfeatures = 2100)
all.genes <- rownames(ovary)
ovary<- ScaleData(ovary, features = all.genes)
ovary<- RunPCA(ovary, features = VariableFeatures(object = ovary))
***************clustering************************
library(Seurat)
library(dplyr)
library(harmony)
ovary_count<-read.table("ovary_count",header=T,row.name=1,sep="\t")
ovary<- CreateSeuratObject(counts = ovary_count, project = "ovary")
ovary[["percent.mt"]] <- PercentageFeatureSet(ovary, pattern = "^MT-")
ovary<- NormalizeData(ovary, normalization.method = "LogNormalize", scale.factor = 10000)
ovary<- FindVariableFeatures(ovary, selection.method = "vst", nfeatures = 2100)
all.genes <- rownames(ovary)
ovary<- ScaleData(ovary, features = all.genes,vars.to.regress = "percent.mt")
ovary<- RunPCA(ovary, features = VariableFeatures(object = ovary))
ovary@metadata$age<-ovary_metadata$age
ovary@metadata$group<-ovary_metadata$group
ovary <- ovary %>% RunHarmony("age", plot_convergence = TRUE)
ovary <- ovary %>% RunUMAP(reduction = "harmony", dims = 1:15) %>% FindNeighbors(reduction = "harmony", dims = 1:15) %>% FindClusters(resolution = 0.1) %>% identity()
DimPlot(ovary,pt.size = .5)
DimPlot(ovary,pt.size = .5,split.by="group")
DimPlot(ovary,pt.size = .5,split.by="age")
ovary_roc.markers <- FindAllMarkers(ovary, only.pos = TRUE, min.pct = 0.25, logfc.threshold = 0.25,test.use = "roc")
new.cluster.ids <- c("Stromal_cell", "Blood_endothelial_cell", "Granulosa_cell", "Smooth_muscle_cell", "Immune_cell", "Lymphatic_endothelial_cell", "Epithelial_cell", "Theca_cell","Stromal_cell")
names(new.cluster.ids) <- levels(ovary)
ovary <- RenameIdents(ovary, new.cluster.ids)
DimPlot(ovary, reduction = "umap", label = TRUE, pt.size = 0.5)
DimPlot(ovary, reduction = "umap", label = TRUE, pt.size = 0.5,split.by="age")
DimPlot(ovary, reduction = "umap", label = TRUE, pt.size = 0.5,split.by="group")
DotPlot(ovary,features = c("DCN","COL6A3","LUM","PDGFRA","VWF","FLT1","CDH2","SERPINE2","CYP19A1","INHA","FOXL2","AMH","MYH11","ACTA2","TAGLN","MCAM","PTPRC","CD53","CXCR4","PROX1","FLT4","PAX8","CDH1","CLDN1","STAR","CYP17A1"),cols = c("white","red"))
SC_aging_markers <- FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Stromal_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
BEC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Blood_endothelial_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
GC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Granulosa_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
SMC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Smooth_muscle_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
IC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Immune_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
LEC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Lymphatic_endothelial_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
EpiC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Epithelial_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
TC_aging_markers<-FindMarkers(ovary, ident.1 = "old", ident.2 ="young",subset.ident = "Theca_cell",group.by="group", min.pct = 0.25,logfc.threshold=0.25,test.use="MAST")
write.table(SC_aging_markes,"SC_aging_markers",sep="\t")
write.table(SC_aging_markes,"BEC_aging_markers",sep="\t")
write.table(SC_aging_markes,"GC_aging_markers",sep="\t")
write.table(SC_aging_markes,"SMC_aging_markers",sep="\t")
write.table(SC_aging_markes,"IC_aging_markers",sep="\t")
write.table(SC_aging_markes,"LEC_aging_markers",sep="\t")
write.table(SC_aging_markes,"EpiC_aging_markers",sep="\t")
write.table(SC_aging_markes,"TC_aging_markers",sep="\t")
SC_aging_logfc<-FindMarkers(ovary,subset.ident = "Stromal_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
BEC_aging_logfc<-FindMarkers(ovary,subset.ident = "Blood_endothelial_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
GC_aging_logfc<-FindMarkers(ovary,subset.ident = "Granulosa_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
SMC_aging_logfc<-FindMarkers(ovary,subset.ident = "Smooth_muscle_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
IC_aging_logfc<-FindMarkers(ovary,subset.ident = "Immune_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
LEC_aging_logfc<-FindMarkers(ovary,subset.ident = "Lymphatic_endothelial_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
EpiC_aging_logfc<-FindMarkers(ovary,subset.ident = "Epithelial_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
TC_aging_logfc<-FindMarkers(ovary,subset.ident = "Theca_cell",ident.1 = "old",ident.2 = "young",features = all.genes,group.by = "group",logfc.threshold = -Inf,min.pct = -Inf,test.use = "MAST")
write.table(SC_aging_logfc,"SC_aging_logfc",sep = "\t")
write.table(BEC_aging_logfc,"BEC_aging_logfc",sep = "\t")
write.table(GC_aging_logfc,"GC_aging_logfc",sep = "\t")
write.table(SMC_aging_logfc,"SMC_aging_logfc",sep = "\t")
write.table(IC_aging_logfc,"IC_aging_logfc",sep = "\t")
write.table(LEC_aging_logfc,"LEC_aging_logfc",sep = "\t")
write.table(EpiC_aging_logfc,"EpiC_aging_logfc",sep = "\t")
write.table(TC_aging_logfc,"TC_aging_logfc",sep = "\t")
SC_aging_logfc<-SC_aging_logfc[,"avg_log2FC",drop=F]
BEC_aging_logfc<-BEC_aging_logfc[,"avg_log2FC",drop=F]
GC_aging_logfc<-GC_aging_logfc[,"avg_log2FC",drop=F]
SMC_aging_logfc<-SMC_aging_logfc[,"avg_log2FC",drop=F]
IC_aging_logfc<-IC_aging_logfc[,"avg_log2FC",drop=F]
LEC_aging_logfc<-LEC_aging_logfc[,"avg_log2FC",drop=F]
EpiC_aging_logfc<-EpiC_aging_logfc[,"avg_log2FC",drop=F]
TC_aging_logfc<-TC_aging_logfc[,"avg_log2FC",drop=F]
ovary_aging_logfc<-merge(SC_aging_logfc,BEC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
ovary_aging_logfc<-merge(ovary_aging_logfc,GC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
ovary_aging_logfc<-merge(ovary_aging_logfc,SMC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
ovary_aging_logfc<-merge(ovary_aging_logfc,IC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
ovary_aging_logfc<-merge(ovary_aging_logfc,LEC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
ovary_aging_logfc<-merge(ovary_aging_logfc,EpiC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
ovary_aging_logfc<-merge(ovary_aging_logfc,TC_aging_logfc,by=0,all=F)
rownames(ovary_aging_logfc)<-ovary_aging_logfc$Row.names
ovary_aging_logfc<-ovary_aging_logfc[,-1]
colnames(ovary_aging_logfc)<-c("SC","BEC","GC","SMC","IC","LEC","EpiC","TC")
write.table(ovary_aging_logfc,"ovary_aging_logfc",sep = "\t")
***************ovary_aging_DEG_heatmap************************
library(pheatmap)
library(RColorBrewer)
DEG_list<-read.table("DEG_list.txt",sep = "\t",row.names = 1,header = T)
ovary_aging_DEG<-merge(ovary_aging_logfc,DEG_list,by=0)
rownames(ovary_aging_DEG)<-ovary_aging_DEG$Row.names
ovary_aging_DEG<-ovary_aging_DEG[,2:9]
ovary_aging_DEG<-ovary_aging_DEG[rownames(DEG_list),]
pheatmap(as.matrix(ovary_aging_DEG),scale = "none",cluster_rows = F,cluster_cols = F,annotation_row = DEG_list,filename = "ovary_aging_DEG_heatmap.pdf",color=colorRampPalette(c("blue", "white", "red"))(200))
***************Common_DEG_heatmap************************
Common_up<-ovary_aging_logfc[grepl("^BCL6$|^SYNE1$|^SETBP1$|^SSBP2$|^RORA$|^CCNY$|^KMT2E$|^CHST11$|^EXOC4$|^KIF13A$|^IMMP2L$|^ALPK1$|^COG5$|^PLA2R1$|^ZCCHC7$|^ARID5B$|^XIST$|^NCOA1$|^ZBTB16$|^ANKRD36$|^CAMK2D$|^ZHX2$|^STAG1$|^KIAA1328$|^DYNC2H1$|^CUX1$|^OGA$|^NR3C2$|^AKT3$|^ZBTB20$|^PHF21A$|^MEIS2$|^MAST4$|^RALGAPA1$|^TNRC6B$|^NFIB$|^ZNF292$|^DENND4C$|^NCOA2$|^SENP6$|^CCND3$|^TNS1$|^MYCBP2$|^MLLT6$|^GULP1$|^CRADD$|^VPS13C$|^POGZ$|^USP53$|^SBF2$|^MIR29B2CHG$|^INPP4B$|^AGAP1$|^PTGIS$|^CDKAL1$|^HSPA1A$|^ANKS1B$|^L3MBTL4$|^VWA8$|^SLC9A9$|^PPP6R3$|^BABAM2$|^IGF1R$|^RNF149$|^ATP8A1$|^CHPT1$|^NAMPT$|^TMOD1$|^BCAS3$|^RUNX1T1$|^MYO1D$|^PITPNC1$|^PATJ$|^SLC25A37$|^RABGAP1L$|^NFIA$|^RNF217$|^ARID4B$|^DPYD$|^SNX9$|^DENND4A$|^ABLIM1$|^MKLN1$|^FARS2$|^DDX17$|^AKAP13$|^NBEA$|^USP24$|^WDPCP$|^KANSL1$|^C1orf21$|^LRMDA$|^GPCPD1$|^TCF7L2$|^DIAPH2$|^ATG7$|^ANAPC16$|^TACC1$|^SND1$|^ZEB1$|^SPPL3$|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6$|^UBA52$|^AMBRA1$|^LAPTM4A$|^PPARG$|^RPL19$|^NACA$|^RPL5$|^HIBCH$|^COL4A1$|^NEAT1$|^DDX24$|^PRKCA$|^CPEB4$|^MTRNR2L8$|^MEF2C$|^RPS24$|^RAB11A$|^HSP90AB1$|^UBC$|^SMARCA1$|^GATA4$|^S100A13$|^OOEP$|^HMGB1$|^RPL23$|^HSPA4$|^RPL6$|^C11orf96$|^CBR4$|^PTMA$|^LRP4$|^ATRNL1$|^THUMPD1$|^EXT1$|^MIB1$|^GJA1$|^RPL7$|^MYL9$|^GPC6$|^RACK1$",rownames(ovary_aging_logfc)),]
Common_DEG<-rbind(Common_up,Common_down)
pheatmap(as.matrix(Common_DEG),scale = "none",cluster_rows = T,cluster_cols = T,filename = "Common_DEG_heatmap.pdf",color=colorRampPalette(c("blue", "white", "red"))(200))
***************cell_specific_DEG_heatmap************************
cell_specific_DEG<-read.table("cell_specific_DEG",sep = "\t",row.names = 1,header = T)
ovary_cell_specific_DEG<-merge(ovary_aging_logfc,cell_specific_DEG,by=0)
rownames(ovary_cell_specific_DEG)<-ovary_cell_specific_DEG$Row.names
ovary_cell_specific_DEG<-ovary_cell_specific_DEG[,2:9]
ovary_cell_specific_DEG<-ovary_cell_specific_DEG[rownames(cell_specific_DEG),]
pheatmap(as.matrix(ovary_cell_specific_DEG),scale = "none",cluster_rows = F,cluster_cols = F,filename = "ovary_cell_specific_DEG_heatmap.pdf",color=colorRampPalette(c("blue", "white", "red"))(200))