1 Star 0 Fork 0

QianWei_1129/ZPP_data_analysis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ZPP_volcano.R 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
rm(list = ls())
setwd("D:\\the_first_paper\\ZRC_the_first_paper\\ZPP")
load("GSE30529.Rdata")
options(stringsAsFactors = F)
library(limma)
design <- model.matrix(~0 + factor(group))
colnames(design) <- levels(factor(group))
rownames <- colnames(exp_unique)
constrast.matrix <- makeContrasts(DKD-control, levels = design)
# deg
fit <- lmFit(exp_unique, design)
fit2 <- contrasts.fit(fit, constrast.matrix)
fit2 <- eBayes(fit2)
options(digits = 4)
DEG <- topTable(fit2, coef = 1, n = Inf)
DEG$group <- ifelse(DEG$P.Value > 0.05, "no_change",
ifelse(DEG$logFC > 1, "up",
ifelse(DEG$logFC < -1, "down", "no_change")))
table(DEG$group)
DEG$gene <- rownames(DEG)
save(DEG, design, fit, fit2, file = "DEG.Rdata")
# requirement
library(dplyr)
temp <- read.csv("ZPP/temp.csv")
#直接利用dplyr包里面的intersect函数对数据框取交集
temp_data_1 <- subset(DEG, group == "up")
temp_data_2 <- subset(DEG, group == "down")
result1=intersect(temp_data_1$gene, temp$Symbol)
result2=intersect(temp_data_2$gene, temp$Symbol)
#保存交集结果
write.table(file="up_mitochondria.csv",result1,quote=F,row.names = F,sep="\t")
write.table(file="down_mitochondria.csv",result2,quote=F,row.names = F,sep="\t")
# write.table(file="DEG.csv",DEG,quote=F,row.names = F)
# draw_picture
library(ggplot2)
DEG$p <- -log10(DEG$P.Value)
ggplot(data = DEG, aes(x = logFC, y = p, color = group)) + geom_point()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qianwei-1129/zpp_data_analysis.git
git@gitee.com:qianwei-1129/zpp_data_analysis.git
qianwei-1129
zpp_data_analysis
ZPP_data_analysis
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385