Skip to contents

gwaspr: an R package for plotting GWAS results from the GAPIT package

Installation

devtools::install_github("derekmichaelwright/gwaspr")

Usage

For best practice, output from GAPIT should be in its own folder. In this case, they are located in a folder called GWAS_Results/. For this example we will plot GWAS results from 3 traits in a lentil diversity panel:

  • Testa_Pattern: a qualitative trait describing the presence or absence of seed coat pigmentation.
  • DTF_Nepal_2017: a quantitative trait describing days from sowing to flowering in a 2017 Nepal field trial.
  • DTF_Sask_2017: a quantitative trait describing days from sowing to flowering in a 2017 Saskatchewan field trial.
  • DTF_Sask_2017_b: same as above but run with the b coefficient from a photothermal model (see Wright et al. 2020) used as a covariate.

Note: for more info check out this GWAS tutorial.

myTraits <- list_Traits(folder = "GWAS_Results/")
myTraits
## [1] "DTF_Nepal_2017"  "DTF_Sask_2017"   "DTF_Sask_2017_b" "Testa_Pattern"
myFiles <- list_Result_Files(folder = "GWAS_Results/")
myFiles
##  [1] "GAPIT.Blink.DTF_Nepal_2017.GWAS.Results.csv"   
##  [2] "GAPIT.Blink.DTF_Sask_2017.GWAS.Results.csv"    
##  [3] "GAPIT.Blink.DTF_Sask_2017_b.GWAS.Results.csv"  
##  [4] "GAPIT.Blink.Testa_Pattern.GWAS.Results.csv"    
##  [5] "GAPIT.FarmCPU.DTF_Nepal_2017.GWAS.Results.csv" 
##  [6] "GAPIT.FarmCPU.DTF_Sask_2017.GWAS.Results.csv"  
##  [7] "GAPIT.FarmCPU.DTF_Sask_2017_b.GWAS.Results.csv"
##  [8] "GAPIT.FarmCPU.Testa_Pattern.GWAS.Results.csv"  
##  [9] "GAPIT.GLM.DTF_Nepal_2017.GWAS.Results.csv"     
## [10] "GAPIT.GLM.DTF_Sask_2017.GWAS.Results.csv"      
## [11] "GAPIT.GLM.DTF_Sask_2017_b.GWAS.Results.csv"    
## [12] "GAPIT.GLM.Testa_Pattern.GWAS.Results.csv"      
## [13] "GAPIT.MLM.DTF_Nepal_2017.GWAS.Results.csv"     
## [14] "GAPIT.MLM.DTF_Sask_2017.GWAS.Results.csv"      
## [15] "GAPIT.MLM.DTF_Sask_2017_b.GWAS.Results.csv"    
## [16] "GAPIT.MLM.Testa_Pattern.GWAS.Results.csv"      
## [17] "GAPIT.MLMM.DTF_Nepal_2017.GWAS.Results.csv"    
## [18] "GAPIT.MLMM.DTF_Sask_2017.GWAS.Results.csv"     
## [19] "GAPIT.MLMM.DTF_Sask_2017_b.GWAS.Results.csv"   
## [20] "GAPIT.MLMM.Testa_Pattern.GWAS.Results.csv"
myResults <- table_GWAS_Results(folder = "GWAS_Results/", files = myFiles,
                   threshold = 6.7, sug.threshold = 6)
list_Top_Markers(trait = "DTF_Nepal_2017", model = "MLMM", 
                 folder = "GWAS_Results/", 
                 threshold = 6.7, chroms = c(2,5), n = 1)
##                      SNP CHR      POS -log10(p)
## 1 Lcu.2RBY.Chr2p42543877   2 42543877     11.58
## 2  Lcu.2RBY.Chr5p1069654   5  1069654     16.71

Summary Plot

mp <- gg_GWAS_Summary(folder = "GWAS_Results/", 
                      traits = myTraits,
                      models = c("MLM", "MLMM", "FarmCPU", "Blink"),
                      colors = c("darkgreen", "darkred", "darkorange3", "steelblue"),
                      threshold = 6.7, sug.threshold = 6, 
                      hlines = c(1.5,3.5),
                      vlines = c("Lcu.2RBY.Chr2p42543877","Lcu.2RBY.Chr5p1069654",
                                 "Lcu.2RBY.Chr6p2528817", "Lcu.2RBY.Chr6p12212845"),
                      vline.colors = c("red", "red", "green", "blue"),
                      title = "Summary of Significant GWAS Results")
ggsave("man/figures/GWAS_Summary.png", mp, width = 10, height = 3)

gg_GWAS_plotly(mp, filename = "GWAS_Summary.html")

Manhattan Plots

Multi Manhattan Plots

for(i in myTraits) {
  mp <- gg_Manhattan(folder = "GWAS_Results/", trait = i, facet = F,
                     models = c("MLM", "MLMM", "FarmCPU", "Blink"),
                     threshold = 7.3, sug.threshold = 6.7, pmax = 12,
                     vlines = c("Lcu.2RBY.Chr2p42543877", 
                                "Lcu.2RBY.Chr5p1069654",
                                "Lcu.2RBY.Chr6p12212845",
                                "Lcu.2RBY.Chr6p2528817") )
  ggsave(paste0("man/figures/Multi_",i,".png"), mp, width = 10, height = 4)
}


Facetted Manhattan Plots

for(i in myTraits) {
  mp <- gg_Manhattan(folder = "GWAS_Results/", trait = i, facet = T,
                     threshold = 7.3, sug.threshold = 6.7,
                     vlines = c("Lcu.2RBY.Chr2p42543877", 
                                "Lcu.2RBY.Chr5p1069654",
                                "Lcu.2RBY.Chr6p12212845",
                                "Lcu.2RBY.Chr6p2528817"))
  ggsave(paste0("man/figures/Facet_",i,".png"), mp, width = 10, height = 8)
}


GAPIT

GAPIT: and R package for performing Genome Wide Association Studies (GWAS)

https://github.com/jiabowang/GAPIT3

Dependancies

tidyverse, ggpubr, ggbeeswarm, ggrepel, ggtext, plotly, htmlwidgets


© Derek Michael Wright www.dblogr.com/