library(data.table) library(ggplot2) library(readxl) library(cowplot) library(ggrepel) library(grid) options(ggrepel.max.overlaps=Inf) #Figure 1 data1 <- read.csv("INPUT_PATH/TRAITS_VS_GWAS2_SN_PPV.csv", head=T, stringsAsFactors=F) #looks okay ppi <- 300 png(filename="OUTPUT_PATH/Figure1.png", width=8, height=8, unit="in", res=ppi) .labs <- data1$Method2 grob1 <- grobTree(textGrob("I", x=0.55, y=0.55, hjust=0, gp=gpar(col="red", fontsize=13, fontface="bold"))) grob2 <- grobTree(textGrob("II", x=0.44, y=0.55, hjust=0, gp=gpar(col="red", fontsize=13, fontface="bold"))) grob3 <- grobTree(textGrob("III", x=0.43, y=0.45, hjust=0, gp=gpar(col="red", fontsize=13, fontface="bold"))) grob4 <- grobTree(textGrob("IV", x=0.55, y=0.45, hjust=0, gp=gpar(col="red", fontsize=13, fontface="bold"))) b <- ggplot(data1, aes(x = SN, y = PPV)) b + geom_point(aes(color = Trait)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Trait), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(values = c("#CC79A7", "#009E73", "#E69F00", "#0072B2", "#000000")) + ggtitle("SN vs PPV for Nominated Loci (+/-500kb)") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() #Figure 4 grob1 <- grobTree(textGrob("I", x=0.55, y=0.55, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob2 <- grobTree(textGrob("II", x=0.44, y=0.55, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob3 <- grobTree(textGrob("III", x=0.43, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob4 <- grobTree(textGrob("IV", x=0.55, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) data3 <- read.csv("INPUT_PATH/PGC_VS_GWAS3.csv", head=T, stringsAsFactors=F) ppi <- 300 png(filename="OUTPUT_PATH/Figure4.png", width=8, height=8, unit="in", res=ppi) .labs <- data3$Method2 b <- ggplot(data3, aes(x = SN, y = PPV)) b + geom_point(aes(color = Trait)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Trait), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(values = c("#CC79A7", "#009E73", "#0072B2" )) + ggtitle("SN vs PPV for PGC Nominated Loci (+/-500kb)") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() ############################################### # Figure SF1 data2 <- subset(data1, Trait %in% c("BPD", "SCZ", "MDD")) ppi <- 300 png(filename="OUTPUT_PATH/FigureSF1.png", width=8, height=8, unit="in", res=ppi) .labs <- data2$Method2 b <- ggplot(data2, aes(x = SN, y = PPV)) b + geom_point(aes(color = Trait)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Trait), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(values = c("#CC79A7", "#009E73", "#0072B2" )) + ggtitle("SN vs PPV for PGC Nominated Loci (+/-500kb)") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() ############################################## #Figure SF2 #plot of FDR sensitivity analysis grob1 <- grobTree(textGrob("I", x=0.55, y=0.55, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob2 <- grobTree(textGrob("II", x=0.44, y=0.55, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob3 <- grobTree(textGrob("III", x=0.43, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob4 <- grobTree(textGrob("IV", x=0.55, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) data4 <- read.csv("INPUT_PATH/PGCONLY_FDR.csv", head=T, stringsAsFactors=F) ppi <- 300 png(filename="OUTPUT_PATH/FigureSF2.png", width=8, height=8, unit="in", res=ppi) .labs <- data4$Method b <- ggplot(data4, aes(x = SN, y = PPV)) b + geom_point(aes(color = Trait)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Trait), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(values = c("#CC79A7", "#009E73", "#0072B2" )) + ggtitle("SN vs PPV for PGC Nominated Loci (+/-500kb)") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() ########################################### #PGC overlap sensitivities scz <- read.csv("INPUT_PATH/SCZ_OVERLAP_FILE.csv", head=T, stringsAsFactors=F) mdd <- read.csv("INPUT_PATH/MDD_OVERLAP_FILE.csv", head=T, stringsAsFactors=F) bpd <- read.csv("INPUT_PATH/BPD_OVERLAP_FILE.csv", head=T, stringsAsFactors=F) mpv <- read.csv("INPUT_PATH/MPV_OVERLAP_FILE.csv", head=T, stringsAsFactors=F) wbc <- read.csv("INPUT_PATH/WBC_OVERLAP_FILE.csv", head=T, stringsAsFactors=F) grob1 <- grobTree(textGrob("I", x=0.55, y=0.55, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob2 <- grobTree(textGrob("II", x=0.44, y=0.55, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob3 <- grobTree(textGrob("III", x=0.43, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob4 <- grobTree(textGrob("IV", x=0.55, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) #Figure S3a ppi <- 300 png(filename="OUTPUT_PATH/FigureS3a.png", width=8, height=8, unit="in", res=ppi) .labs <- bpd$Method4 b <- ggplot(bpd, aes(x = SN, y = PPV)) b + geom_point(aes(color = Overlap)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Overlap), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(labels=c("1 base pair", "250kb", "500kb", "750kb"), values = c("red", "blue", "green", "purple", "black")) + ggtitle("SN vs PPV for Nominated Loci (+/-500kb), BPD") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() #Figure S3b ppi <- 300 png(filename="OUTPUT_PATH/FigureS3b.png", width=8, height=8, unit="in", res=ppi) .labs <- mdd$Method4 b <- ggplot(mdd, aes(x = SN, y = PPV)) b + geom_point(aes(color = Overlap)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Overlap), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(labels=c("1 base pair", "250kb", "500kb", "750kb"), values = c("red", "blue", "green", "purple", "black")) + ggtitle("SN vs PPV for Nominated Loci (+/-500kb), MDD") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() #Figure S3c ppi <- 300 png(filename="OUTPUT_PATH/FigureS3c.png", width=8, height=8, unit="in", res=ppi) .labs <- scz$Method4 b <- ggplot(scz, aes(x = SN, y = PPV)) b + geom_point(aes(color = Overlap)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Overlap), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(labels=c("1 base pair", "250kb", "500kb", "750kb"), values = c("red", "blue", "green", "purple", "black")) + ggtitle("SN vs PPV for Nominated Loci (+/-500kb), SCZ") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() grob1 <- grobTree(textGrob("I", x=0.55, y=0.95, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob2 <- grobTree(textGrob("II", x=0.44, y=0.95, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob3 <- grobTree(textGrob("III", x=0.43, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob4 <- grobTree(textGrob("IV", x=0.55, y=0.45, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) #Figure S3d ppi <- 300 png(filename="OUTPUT_PATH/FigureS3d.png", width=8, height=8, unit="in", res=ppi) .labs <- mpv$Method4 b <- ggplot(mpv, aes(x = SN, y = PPV)) b + geom_point(aes(color = Overlap)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Overlap), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(labels=c("1 base pair", "250kb", "500kb", "750kb"), values = c("red", "blue", "green", "purple", "black")) + ggtitle("SN vs PPV for Nominated Loci (+/-500kb), MPV") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off() grob1 <- grobTree(textGrob("I", x=0.55, y=0.95, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob2 <- grobTree(textGrob("II", x=0.44, y=0.95, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob3 <- grobTree(textGrob("III", x=0.43, y=0.05, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) grob4 <- grobTree(textGrob("IV", x=0.55, y=0.05, hjust=0, gp=gpar(col="black", fontsize=13, fontface="bold"))) #Figure S3e ppi <- 300 png(filename="OUTPUT_PATH/FigureS3e.png", width=8, height=8, unit="in", res=ppi) .labs <- wbc$Method4 b <- ggplot(wbc, aes(x = SN, y = PPV)) b + geom_point(aes(color = Overlap)) + geom_hline(yintercept=0.50) + geom_vline(xintercept=0.50) + theme_bw() + theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) + geom_text_repel(aes(label = .labs, color = Overlap), size = 3, max.overlaps=Inf)+ scale_x_continuous(limits=c(0,1)) + scale_y_continuous(limits=c(0,1)) + scale_color_manual(labels=c("1 base pair", "250kb", "500kb", "750kb"), values = c("red", "blue", "green", "purple", "black")) + ggtitle("SN vs PPV for Nominated Loci (+/-500kb), WBC") + theme(plot.title=element_text(hjust=0.5)) + annotation_custom(grob1) + annotation_custom(grob2) + annotation_custom(grob3) + annotation_custom(grob4) dev.off()