目前研究蛋白质组的项目越来越多,经常有蛋白质和转录组相关的分析。
deg_file <- 'S-1_S-2_S-3_vs_R-1_R-2_R-3.all' dep_file <- 'S-1_S-2_S-3_vs_R-1_R-2_R-3.DEP.all.xls' # 设置筛选参数 dep_fc <- 1.5 dep_fdr <- 0.05 deg_fc <-1.5 deg_fdr <- 0.05 # 读取文件 deg <- read_delim(deg_file,delim = '\t') dep <- read_delim(dep_file,delim = '\t') dim(dep) # 蛋白ID转换 extr_id <- function(x){ return(substr(x, start = 0, stop = 16)) } dep$protein_id <- as.character(llply(dep$protein, extr_id)) gene_ids <- deg$`#ID` protein_id <- dep$protein_id # 共有ID common_id <- intersect(gene_ids,protein_id) # 提取数据列表 dep_common = dep[dep$protein_id %in% common_id,c('protein_id','logFC','P.Value')] colnames(dep_common) <- c('protein_id','logFC_p','FDR_p') dep_common$regulate_p = as.factor(ifelse(dep_common$FDR_p < dep_fdr & abs(dep_common$logFC_p) >=log2(dep_fc), ifelse(dep_common$logFC_p>log2(dep_fc),'Up','Down'),'Normal')) table(dep_common$regulate_p) deg_common = deg[deg$`#ID` %in% common_id,c('#ID','FDR','log2FC')] colnames(deg_common) <- c('#ID','FDR_g','log2FC_g') deg_common$regulate_g = as.factor(ifelse(deg_common$FDR_g < deg_fdr & abs(deg_common$log2FC_g) >=log2(deg_fc), ifelse(deg_common$log2FC_g>log2(deg_fc),'Up','Down'),'Normal')) table(deg_common$regulate_g) # 合并转录组和蛋白质结果 merge_df <- merge(dep_common, deg_common, by.x='protein_id', by.y='#ID') # 基于调控关系进行分组 merge_df$type <- paste(merge_df$regulate_p, merge_df$regulate_g,sep = '_') types <- c('Down_Down','Down_Up','Up_Down','Up_Up') merge_df[!merge_df$type %in% types,'type'] <- 'Other' # 绘图 mycol <- c("#e41a1c","#ff7f00","#984ea3","#4daf4a","#80b1d3") ggplot(data=merge_df, aes(x=logFC_p,y=log2FC_g,colour=type)) + geom_point() + scale_color_manual(values = c("Up_Up"=mycol[1],"Up_Down"=mycol[2],"Down_Up"=mycol[3],"Down_Down"=mycol[4],"Other"=mycol[5]))+ geom_hline(aes(yintercept=log2(deg_fc)), linetype="dashed",colour="grey11")+ geom_hline(aes(yintercept=-log2(deg_fc)), linetype="dashed",colour="grey11") + geom_vline(aes(xintercept=-log2(dep_fc)),linetype="dashed",colour="grey11") + geom_vline(aes(xintercept=log2(dep_fc)),linetype="dashed",colour="grey11") + labs(x = "Protein_logFC", y = "Gene_logFC", title = "Protein_Gene_relation") + theme_bw()+ theme( panel.grid=element_blank(), axis.text.x=element_text(colour="black"), axis.text.y=element_text(colour="black"), panel.border=element_rect(colour = "black"), legend.key = element_blank(), legend.title = element_blank())
结果如下图:
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!