#RAW code install.packages("ggplot2") library(ggplot2) setwd("C:\\xxx\\xxx") rt=read.table("input.txt",sep="\t",header=T,check.names=F) options(max.print=999999) as.data.frame(rt) p <- ggplot(data=rt, mapping=aes(x=group, y=CELSR3)) p <- ggplot(rt, aes(group,CELSR3,fill=group)) p+geom_boxplot()+scale_fill_manual(values=c( "#029386", "#653700"))+geom_jitter(shape=16, position=position_jitter(0.2))+labs(title="XXX.", x=element_blank(), y="XXX")+theme(plot.title = element_text(family="Times",color = "black", size = 18,face = "bold"),axis.title.x = element_text(family="Times",color="black", size = 14,face = "bold"),axis.title.y = element_text(family="Times",color="#000000", size = 16, face = "bold"))+ theme(legend.position="top")+ labs(fill="type")+theme(plot.title = element_text(hjust = 0.5)) + theme(axis.text.x = element_text(size = 15, family = "Times", color = "black", face = "bold", vjust = 0.5, hjust = 0.5)) ============================================================ # The ggplot2 package in the statistical software R (version 3.5.2) was used for graph generation. install.packages('survminer') library(ggplot2) library('survminer') library(survival) setwd("C:\\xxx\\xxx) rt=read.table('input.txt',sep='\t',header=T) head(rt) fit<- survfit(Surv(os, censor) ~ CELSR3, data = rt) print(fit) ggsurvplot(fit) ggsurvplot(fit,palette = c('red','#0504aa'),risk.table =TRUE,pval =TRUE,conf.int =TRUE,xlab ='Time in months', ggtheme =theme_light(), ncensor.plot = TRUE) =============================== # The pROC package in the statistical software R (version 3.5.2) was used for graph generation. library(ggplot2) install.packages('pROC') library(pROC) setwd("C:\\xxx\\xxx) rt=read.table("input.txt",sep="\t",header=T,check.names=F) options(max.print=999999) as.data.frame(rt) roc(rt$outcome, rt$CELSR3, plot=TRUE, print.thres=TRUE, print.auc=TRUE) rocobj1 <- roc(rt$outcome, rt$CELSR3) auc(rocobj1) plot(rocobj1) plot(rocobj1, print.auc=TRUE, auc.polygon=TRUE, grid=c(0.1, 0.2), grid.col=c("green", "red"), max.auc.polygon=TRUE,auc.polygon.col="skyblue", print.thres=TRUE) ============= #source("http://bioconductor.org/biocLite.R") #biocLite("affy") library(affy) setwd("C:/XXX/XXX") affydata=ReadAffy() normalData=rma(affydata) write.table(file="all.exp.xls",exprs(normalData),sep="\t",quote=FALSE) ======================== #source("https://bioconductor.org/biocLite.R") #biocLite("sva") #biocLite("limma") library(sva) library(limma) setwd("C:/XXX/XXX") rt=read.table("merge.txt",sep="\t",header=T,check.names=F) rt=as.matrix(rt) rownames(rt)=rt[,1] exp=rt[,2:ncol(rt)] dimnames=list(rownames(exp),colnames(exp)) data=matrix(as.numeric(as.matrix(exp)),nrow=nrow(exp),dimnames=dimnames) batchType=c(rep(1,36),rep(2,91)) modType=c(rep("normal",18),rep("tumor",18),rep("normal",10),rep("tumor",81)) mod = model.matrix(~as.factor(modType)) outTab=ComBat(data, batchType, mod, par.prior=TRUE) outTab=rbind(geneNames=colnames(outTab),outTab) write.table(outTab,file="normalize.txt",sep="\t",quote=F,col.names=F) ============================ library(plyr) library(ggplot2) library(grid) library(gridExtra) setwd("C:/XXX/XXX") files=grep(".xls",dir(),value=T) data = lapply(files,read.delim) names(data) = files dataSet = ldply(data, data.frame) dataSet$pathway = gsub(".xls","",dataSet$.id) gseaCol=c("#58CDD9","#7A142C","#5D90BA","#431A3D","#91612D","#6E568C","#E0367A","#D8D155","#64495D","#7CC767","#223D6C","#D20A13","#FFD121","#088247","#11AA4D") pGsea=ggplot(dataSet,aes(x=RANK.IN.GENE.LIST,y=RUNNING.ES,colour=pathway,group=pathway))+ geom_line(size = 1.5) + scale_color_manual(values = gseaCol[1:nrow(dataSet)]) + labs(x = "", y = "Enrichment Score", title = "") + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0),limits = c(min(dataSet$RUNNING.ES - 0.02), max(dataSet$RUNNING.ES + 0.02))) + theme_bw() + theme(panel.grid = element_blank()) + theme(panel.border = element_blank()) + theme(axis.line = element_line(colour = "black")) + theme(axis.line.x = element_blank(),axis.ticks.x = element_blank(),axis.text.x = element_blank()) + geom_hline(yintercept = 0) + theme(legend.position = c(0,0),legend.justification = c(0,0)) + #legend×¢Ê͵Äλֵ guides(colour = guide_legend(title = NULL)) + theme(legend.background = element_blank()) + theme(legend.key = element_blank())+theme(legend.key.size=unit(0.5,'cm')) pGene=ggplot(dataSet,aes(RANK.IN.GENE.LIST,pathway,colour=pathway))+geom_tile()+ scale_color_manual(values = gseaCol[1:nrow(dataSet)]) + labs(x = "high expression<----------->low expression", y = "", title = "") + scale_x_discrete(expand = c(0, 0)) + scale_y_discrete(expand = c(0, 0)) + theme_bw() + theme(panel.grid = element_blank()) + theme(panel.border = element_blank()) + theme(axis.line = element_line(colour = "black"))+ theme(axis.line.y = element_blank(),axis.ticks.y = element_blank(),axis.text.y = element_blank())+ guides(color=FALSE) gGsea = ggplot_gtable(ggplot_build(pGsea)) gGene = ggplot_gtable(ggplot_build(pGene)) maxWidth = grid::unit.pmax(gGsea$widths, gGene$widths) gGsea$widths = as.list(maxWidth) gGene$widths = as.list(maxWidth) dev.off() pdf('multipleGSEA.pdf', width=7, height=5.5) par(mar=c(5,5,2,5)) grid.arrange(arrangeGrob(gGsea,gGene,nrow=2,heights=c(.8,.3))) dev.off()