module load R/3.6.1;R setwd("/share/dept_bbsr/Projects/Czerniecki_Brian/2923_Oncogene_Expression_2020/work/attempt4") library(dplyr) library(ggplot2) #################################################################################################################################### level = c('TCGA-BLCA_nrm','TCGA-BLCA_pri', 'TCGA-BRCA_nrm','TCGA-BRCA_pri', 'TCGA-COAD_nrm','TCGA-COAD_pri', 'TCGA-ESCA_nrm','TCGA-ESCA_pri', 'TCGA-HNSC_nrm','TCGA-HNSC_pri', 'TCGA-LUAD_nrm','TCGA-LUAD_pri', 'TCGA-LUSC_nrm','TCGA-LUSC_pri', 'TCGA-OV_pri', 'TCGA-PAAD_nrm','TCGA-PAAD_pri', 'TCGA-PRAD_nrm','TCGA-PRAD_pri', 'TCGA-SKCM_nrm','TCGA-SKCM_pri', 'TCGA-STAD_nrm','TCGA-STAD_pri'); level1 = c('TCGA-BLCA', 'TCGA-BRCA', 'TCGA-COAD', 'TCGA-ESCA', 'TCGA-HNSC', 'TCGA-LUAD', 'TCGA-LUSC', 'TCGA-OV', 'TCGA-PAAD', 'TCGA-PRAD', 'TCGA-SKCM', 'TCGA-STAD'); level2 = c('nrm','pri'); num = 20 len = length(level) cols = c(as.character(rep(num,len))) inf = "file3d_boxplot.csv" rawdat = read.csv(file=inf,header=F) exp = rawdat exp[1:5,] rownames(exp) = rawdat[,2] colnames(exp) = c("type","sample","val","project","tissue") exp$type <- factor(exp$type, levels = level) exp$project <- factor(exp$project, levels = level1) exp$tissue <- factor(exp$tissue, levels = level2) exp[1:5,] title = "HER3_expression"; otf = paste(title,".pdf",sep="") cols = c("#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#ff0000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000", "#00ff40", "#ff4000" ) exp1 = exp exp1$type = gsub("TCGA-BLCA_nrm","Bladder(N)",exp1$type) exp1$type = gsub("TCGA-BLCA_pri","Bladder(T)",exp1$type) exp1$type = gsub("TCGA-BRCA_nrm","Breast(N)",exp1$type) exp1$type = gsub("TCGA-BRCA_pri","Breast(T)",exp1$type) exp1$type = gsub("TCGA-COAD_nrm","Colon(N)",exp1$type) exp1$type = gsub("TCGA-COAD_pri","Colon(T)",exp1$type) exp1$type = gsub("TCGA-HNSC_nrm","Head & Neck(N)",exp1$type) exp1$type = gsub("TCGA-HNSC_pri","Head & Neck(T)",exp1$type) exp1$type = gsub("TCGA-LUAD_nrm","Lung(N)",exp1$type) exp1$type = gsub("TCGA-LUAD_pri","Lung(T)",exp1$type) exp1$type = gsub("TCGA-LUSC_nrm","Lung Squamous(N)",exp1$type) exp1$type = gsub("TCGA-LUSC_pri","Lung Squamous(T)",exp1$type) exp1$type = gsub("TCGA-OV_nrm","Ovarian(N)",exp1$type) exp1$type = gsub("TCGA-OV_pri","Ovarian(T)",exp1$type) exp1$type = gsub("TCGA-PAAD_nrm","Pancreatic(N)",exp1$type) exp1$type = gsub("TCGA-PAAD_pri","Pancreatic(T)",exp1$type) exp1$type = gsub("TCGA-PRAD_nrm","Prostate(N)",exp1$type) exp1$type = gsub("TCGA-PRAD_pri","Prostate(T)",exp1$type) exp1$type = gsub("TCGA-SKCM_nrm","Skin(N)",exp1$type) exp1$type = gsub("TCGA-SKCM_pri","Skin(T)",exp1$type) exp1$type = gsub("TCGA-STAD_nrm","Stomach(N)",exp1$type) exp1$type = gsub("TCGA-STAD_pri","Stomach(T)",exp1$type) exp1$type = gsub("TCGA-ESCA_nrm","Esophageal(N)",exp1$type) exp1$type = gsub("TCGA-ESCA_pri","Esophageal(T)",exp1$type) title = "HER3 Expression"; otf = "HER3_expression3.pdf"; pdf(otf) ggplot(exp1, aes(x=type, y=val,fill=tissue)) + ggtitle(title) + xlab("") + ylab("FPKM (log2)") + theme(plot.title = element_text(size=20,hjust = 0.5,face="bold")) + geom_jitter(color=num,shape=num, position=position_jitter(0.2),size = 0.2) + geom_boxplot(position = "dodge",alpha = 0.2,outlier.alpha = 0.1,outlier.size = 0.1, width=0.5) + theme(axis.text.y=element_text(size=15),axis.title=element_text(size=14,face="bold")) + theme(axis.text.x=element_text(size=15,angle=90,hjust=1,face="bold")) + theme(legend.position = "none",panel.background = element_blank()) + theme(axis.line.x = element_line(color="black", size = 0.6),axis.line.y = element_line(color="black", size = 0.6)) + scale_fill_manual(values = c("#00ff00", "#ff0000") ) dev.off() ####################################################################################################################################