setwd("C:/Users/yuki_cool/RWorkspace")
library(ggplot2)
library(gridExtra) ##多张图片组合为一张图片上
library(RColorBrewer)
mypalette<-brewer.pal(7,"Reds")
paste("aaa","dddd",sep = "")
LSQ_data <-read.table("C:/Users/yuki_cool/RWorkspace/JQL_chr_depth_summary.txt",header = TRUE,sep=' ')
### 主题 样式
windowsFonts(A=windowsFont('等线'), B=windowsFont('微软雅黑'))
par(family='A')
pptblue<-rgb(r=16, g=77, b=96, maxColorValue = 255)
pptgrey<-rgb(r=107, g=107, b=107,maxColorValue = 255)
pptred<-rgb(r=233, g=77, b=96, maxColorValue = 255)
ppttea<-rgb(r=198, g=96, b=52, maxColorValue = 255)
pptdark<-rgb(r=69, g=87, b=101, maxColorValue = 255)
pptbg<-rgb(r=242, g=242, b=242, maxColorValue = 255)
par(bg=pptbg)
par(bty='l')
par(mar=c(4, 5, 4, 6))
theme<-theme_bw()+theme(legend.position = 'top', #图例位置
text=element_text(face = 'bold'), #字体
panel.background=element_rect(pptbg), #画布背景颜 {MOD}
plot.background=element_rect(pptbg), #图形背景颜 {MOD}
plot.title = element_text(hjust=0.5,size=16,vjust=0.5), #标题位置
panel.border=element_blank(),#图形边界
panel.grid.major=element_blank(),#element_line(colour='lightgrey',linetype="dashed"), #网格线
panel.grid.minor=element_blank(), #次级网格线
legend.title=element_text(size=20, colour='black', vjust=-0.5,face = "bold"), #图例标题
legend.text=element_text(size=20, colour='black', face = "bold"), #图例文字
legend.background =element_rect(pptbg),#图例背景
axis.text=element_text(size=12,colour="black",family='A'), #坐标轴文字
strip.text=element_text(size=12,colour="red",family='A'),#分面文字
strip.background=element_blank(),#分面的背景
axis.line = element_line(size=0.5, colour = 'black'), #轴颜 {MOD}大小
panel.spacing=unit(30,'mm')) #画布大小
#####chromosome depth summary plot
LSQ_dt <- na.omit(data.frame(chrome = LSQ_data$chrome, mean_depth = LSQ_data$chr_depth_sum))
LSQ_plot <- ggplot(LSQ_dt, aes(x = chrome, y = mean_depth))+
geom_bar(stat = "identity", fill=I(mypalette[1])) + plot_theme+
labs( y = "Mean depth")
LSQ_plot
#
# LST_plot <- ggplot(LST_dt, aes(x = chrome, y = mean_depth))+
# geom_bar(stat = "identity")+ plot_theme +
# labs( y = "Mean depth")
# ggsave(plot = fushengyi_plot, filename = file.path(local_path, "chr_pic.png"), width = 10, height = 6)
# ####################################
#
#
# plot <- ggplot(LSQ_data, aes(depth, qc)) +geom_point(aes(color="LSQ")) +
# geom_point(data =YZF_data, aes(color="YZF") )+
# geom_point(data =YZJ_data, aes(color="YZJ"))+
# geom_point(data =LST_data, aes(color="LST"))+
# geom_point(data =fushengrong_data, aes(color="FSR"))+
# geom_point(data =fushengyi_data, aes(color="FSY"))+
# labs(color="Sample", x = "sequence depth", y = "Fraction of bases (%)", size = 10)
#
#
# qc_plot <- plot + theme_bw() + plot_theme
#
#
# plot1 <- ggplot(LST_data, aes(depth, ac)) +geom_line(aes(color="LST"),size =1.5) +
# geom_line(data =YZJ_data, aes(color="YZJ"),size =1.5)+
# geom_line(data =LSQ_data, aes(color="LSQ"),size =1.5)+
# geom_line(data =YZF_data, aes(color="YZF"),size =1.5)+
# geom_line(data =fushengrong_data, aes(color="FSR"),size =1.5)+
# geom_line(data =fushengyi_data, aes(color="FSY"),size =1.5)+
# labs(color="Sample", x = "cumulative sequence depth", y = "Fraction of bases (%)")
#
# ac_plot <- plot1+ theme_bw() + plot_theme
#
# pic<-grid.arrange(qc_plot, ac_plot, ncol = 2)
#
#
# ggsave(plot = ac_plot, filename = file.path(local_path, "ac_pic.png"), width = 10, height = 6)