Last updated: 2021-06-08

Checks: 7 0

Knit directory: local_adaptation_sequence/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200709) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version a019901. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    data/.DS_Store
    Ignored:    data/Bos_taurus.ARS-UCD1.2.103.gtf.gz
    Ignored:    data/Bos_taurus.ARS-UCD1.2.QTL.gff.gz
    Ignored:    data/FAANG_peaks.bed.gz
    Ignored:    output/.DS_Store
    Ignored:    output/200910_RAN/.DS_Store
    Ignored:    output/200910_RAN/genes/
    Ignored:    output/200910_RAN/gwas/
    Ignored:    output/200910_RAN/seq_gwas/
    Ignored:    output/200910_RAN/sfs_selection/
    Ignored:    output/selscan_window/200907_SIM.all.nsl.out.100bins.norm.windows.txt
    Ignored:    output/selscan_window/200907_SIM.all.nsl.windows.txt
    Ignored:    output/selscan_window/200907_SIM.oldest_5000.nsl.out.100bins.norm.gz
    Ignored:    output/selscan_window/200907_SIM.purebred.nsl.out.100bins.norm.gz
    Ignored:    output/selscan_window/200907_SIM.purebred.nsl.out.100bins.norm.windows.txt
    Ignored:    output/selscan_window/200907_SIM.purebred.nsl.windows.txt
    Ignored:    output/selscan_window/200907_SIM.somesim.nsl.out.100bins.norm.gz
    Ignored:    output/selscan_window/200907_SIM.somesim.nsl.windows.txt
    Ignored:    output/selscan_window/200907_SIM.young_5000.nsl.out.100bins.norm.gz
    Ignored:    output/selscan_window/200910_RAN.all.nsl.out.100bins.norm.gz
    Ignored:    output/selscan_window/200910_RAN.all.nsl.out.100bins.norm.windows.txt
    Ignored:    output/selscan_window/200910_RAN.all.nsl.windows.txt
    Ignored:    output/selscan_window/200910_RAN.oldest_5000.nsl.out.100bins.norm.gz
    Ignored:    output/selscan_window/200910_RAN.young_5000.nsl.out.100bins.norm.gz

Untracked files:
    Untracked:  analysis/test.Rmd
    Untracked:  output/200907_SIM/
    Untracked:  output/200910_RAN/af_trajectories/
    Untracked:  output/200910_RAN/ld/
    Untracked:  output/200910_RAN/selscan/
    Untracked:  output/200910_RAN/seq_cojo/
    Untracked:  output/figures/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/envGWAS_850K.Rmd) and HTML (docs/envGWAS_850K.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd a019901 Troy Rowan 2021-06-08 Red angus corrections
html f56f685 Troy Rowan 2021-06-08 Build site.
Rmd 77e94f5 Troy Rowan 2021-06-08 Updated with 850K envGWAS analysis
Rmd 63f88e5 Troy Rowan 2021-05-13 Added envGWAS preliminary analysis

source("code/GCTA_functions.R")
source("code/annotation_functions.R")

Simmental

850K envGWAS

Manhattan plots with both p and q values

sim_manhattans = 
  unique(sim_envgwas$variable) %>%
    purrr::map(~plot_grid(ggmanhattan2(filter(sim_envgwas, variable == .x & p < 0.1), pcol = p, value = p) + ggtitle(.x),
                          ggmanhattan2(filter(sim_envgwas, variable == .x & p < 0.1), pcol = q, value = q),
                          nrow = 2))

envGWAS Runs

AridPrairie

sim_manhattans[[1]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

CornBelt

sim_manhattans[[2]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Desert

sim_manhattans[[3]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

dewpoint

sim_manhattans[[4]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

elev

sim_manhattans[[5]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

FescueBelt

sim_manhattans[[6]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Foothills

sim_manhattans[[7]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

ForestedMountains

sim_manhattans[[8]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

HighPlains

sim_manhattans[[9]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

latitude

sim_manhattans[[10]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

longitude

sim_manhattans[[11]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

maxtemp

sim_manhattans[[12]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

maxvap

sim_manhattans[[13]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

meantemp

sim_manhattans[[14]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

mintemp

sim_manhattans[[15]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

minvap

sim_manhattans[[16]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

precip

sim_manhattans[[17]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Southeast

sim_manhattans[[18]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

UpperMidwest

sim_manhattans[[19]]

Version Author Date
f56f685 Troy Rowan 2021-06-08
# cat('# # Simmental 850K envGWAS {.tabset}   \n')
# invisible(
#   sim_envgwas %>% 
#       dplyr::group_split(variable) %>% 
#       purrr::imap(.,~{
#         # create tabset for each group 
#         cat('### Tab',.y,'   \n')
#         cat('\n')
#         #p <- ggmanhattan2(filter(.x, p < 0.1), sigsnps = sim_multisig)
#         p <- filter(.x, p < 0.1) %>% ggplot(aes(CHR, BP))+geom_point()
#         cat(as.character(htmltools::tagList(p)))
#       })
# )

Number of significant SNPs in each analysis at 850K level

Number of SNPs in each analysis that reaches genome-wide significance at 1) Bonferroni 2) p < 1e-5 3) q < 0.1

sim_envgwas %>% 
  group_by(variable) %>% 
  summarize(bonfCount = sum(p < 6e-8),
            pCount = sum(p < 1e-5),
            qCount = sum(q < 0.1))
# A tibble: 19 x 4
   variable          bonfCount pCount qCount
   <chr>                 <int>  <int>  <int>
 1 AridPrairie               0     29     11
 2 CornBelt                  0     16      3
 3 Desert                   26    158    334
 4 dewpoint                  1      8      3
 5 elev                      1     14      3
 6 FescueBelt                0     11      0
 7 Foothills                 4     43     16
 8 ForestedMountains         1     13      3
 9 HighPlains                0     16      6
10 latitude                  1     10      1
11 longitude                 1     23      5
12 maxtemp                   0     10      2
13 maxvap                    0     11      0
14 meantemp                  1      8      2
15 mintemp                   1      9      2
16 minvap                    1     27      1
17 precip                    5     14      7
18 Southeast                 0     15      0
19 UpperMidwest              0     10      0

Number of SNPs that are shared across zones/variables

filter(sim_envgwas, p < 1e-5) %>%
  count(SNP, sort = TRUE)%>%
  filter(n>1) %>%
  kbl() %>%
  kable_styling()
SNP n
25:40171577:C:T 10
23:11653102:T:G 6
18:58490610:T:G 5
22:24449349:A:G 5
28:37890881:G:A 5
28:37891750:A:C 5
16:42569828:C:T 4
17:72089995:A:G 4
6:45760951:A:G 4
19:59908502:C:T 3
22:46620047:A:G 3
28:37892541:G:A 3
4:84863571:A:G 3
1:102180787:T:C 2
1:116110811:T:C 2
1:153515980:C:T 2
15:17921054:T:C 2
2:72751717:T:C 2
2:97342131:G:A 2
20:8095171:T:C 2
21:11109237:C:T 2
23:1747454:A:C 2
5:21848046:C:T 2
5:83441154:A:C 2

Red Angus

850K envGWAS

ran_envgwas =
  # list.files("output/200910_RAN/gwas") %>%
  #   map(
  #     ~read_gwas2(paste0("output/200910_RAN/gwas/", .x)) %>%
  #       mutate(variable = .x)) %>%
  #   reduce(bind_rows) %>%
  # mutate(variable = str_replace(variable, pattern = "200910_RAN.", ""),
  #        variable = str_replace(variable, pattern = ".850K.mlma.gz", ""),
  #        variable = str_replace(variable, pattern = "_noLSF", ""))

#write_csv(ran_envgwas, "output/200910_RAN/gwas/200910_RAN.AllGWAS.850K.mlma.gz")
  read_csv("output/200910_RAN/gwas/200910_RAN.AllGWAS.850K.mlma.gz",
           col_types = cols(SNP = col_character(), chrbp = col_character())) %>%
  filter(CHR < 30)

ran_multisig =
  filter(ran_envgwas, p < 1e-5) %>%
  count(SNP, sort = TRUE)%>%
  filter(n>1) %>%
  .$SNP

ran_manhattans = 
  unique(ran_envgwas$variable) %>%
    purrr::map(~plot_grid(ggmanhattan2(filter(ran_envgwas, variable == .x & p < 0.1),pcol = p)+
                 ggtitle(.x),
                          ggmanhattan2(filter(ran_envgwas, variable == .x & p < 0.1),pcol = p),
                          nrow = 2))

envGWAS Runs

AridPrairie

ran_manhattans[[1]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

CornBelt

ran_manhattans[[2]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Desert

ran_manhattans[[3]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

dewpoint

ran_manhattans[[4]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

elev

ran_manhattans[[5]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

FescueBelt

ran_manhattans[[6]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Foothills

ran_manhattans[[7]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

ForestedMountains

ran_manhattans[[8]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

HighPlains

ran_manhattans[[9]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

latitude

ran_manhattans[[10]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

longitude

ran_manhattans[[11]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

maxtemp

ran_manhattans[[12]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

maxvap

ran_manhattans[[13]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

meantemp

ran_manhattans[[14]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

mintemp

ran_manhattans[[15]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

minvap

ran_manhattans[[16]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

precip

ran_manhattans[[17]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Southeast

ran_manhattans[[18]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

UpperMidwest

ran_manhattans[[19]]

Version Author Date
f56f685 Troy Rowan 2021-06-08

Annotating Genes

Skipping for now

Number of significant SNPs in each analysis at 850K level

Number of SNPs in each analysis that reaches genome-wide significance at 1) Bonferroni 2) p < 1e-5 3) q < 0.1

ran_envgwas %>% 
  group_by(variable) %>% 
  summarize(bonfCount = sum(p < 6e-8),
            pCount = sum(p < 1e-5),
            qCount = sum(q < 0.1))
# A tibble: 19 x 4
   variable          bonfCount pCount qCount
   <chr>                 <int>  <int>  <int>
 1 AridPrairie               0      9     11
 2 CornBelt                  0     16     16
 3 Desert                  186    533   1612
 4 dewpoint                  0      8    151
 5 elev                      0     14     81
 6 FescueBelt                1     12      6
 7 Foothills                 4     44    109
 8 ForestedMountains        22     53    181
 9 HighPlains                1     10     34
10 latitude                  0      9    167
11 longitude                 7     31    106
12 maxtemp                   3     14    148
13 maxvap                    2     11    119
14 meantemp                  2     10    167
15 mintemp                   0     12    175
16 minvap                    2     13      8
17 precip                    0     14     60
18 Southeast                 4     23    105
19 UpperMidwest              4     19     94

Number of SNPs that are shared across zones/variables

At p < 1e-5 threshold

filter(ran_envgwas, p < 1e-5) %>%
  count(SNP, sort = TRUE)%>%
  filter(n>1) %>%
  kbl() %>%
  kable_styling()
SNP n
5:56294803:C:T 8
6:89632622:C:T 8
11:66022330:T:C 5
16:31189754:C:T 5
26:22147551:A:G 5
5:55940985:C:A 4
5:99932542:A:C 4
15:63936462:G:A 3
23:1760296:G:A 3
23:1762985:C:T 3
23:1764305:C:T 3
23:1765645:C:T 3
23:1768070:C:T 3
23:1773893:A:G 3
23:1780836:T:C 3
4:15143313:T:C 3
5:29337648:C:T 3
5:99970391:T:C 3
13:11805638:G:A 2
15:63923159:C:T 2
15:63930524:T:C 2
18:1421130:A:G 2
18:55917363:G:A 2
18:55918169:C:G 2
18:55923037:C:T 2
2:76462949:C:A 2
23:1741368:T:C 2
23:1742961:G:A 2
23:1744435:G:A 2
23:1745568:C:T 2
23:1747454:A:C 2
23:1750999:G:T 2
23:1753411:C:A 2
23:1755721:T:C 2
29:44876613:A:G 2
4:114194176:G:A 2
4:117086624:G:A 2
5:34082134:C:T 2
5:83684035:C:T 2
6:83637243:A:G 2

sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] viridis_0.5.1     viridisLite_0.3.0 kableExtra_1.3.4  UpSetR_1.4.0     
 [5] DT_0.17           gprofiler2_0.2.0  cowplot_1.1.1     GALLO_1.1        
 [9] qvalue_2.22.0     pedigree_1.4      reshape_0.8.8     HaploSim_1.8.4   
[13] Matrix_1.3-2      lubridate_1.7.10  forcats_0.5.1     stringr_1.4.0    
[17] dplyr_1.0.5       readr_1.4.0       tidyr_1.1.3       tibble_3.1.0     
[21] tidyverse_1.3.0   here_1.0.1        ggcorrplot_0.1.3  corrr_0.4.3      
[25] factoextra_1.0.7  ggplot2_3.3.3     purrr_0.3.4       ggthemes_4.2.4   
[29] maps_3.3.0        knitr_1.31        workflowr_1.6.2  

loaded via a namespace (and not attached):
  [1] colorspace_2.0-0            ellipsis_0.3.1             
  [3] rprojroot_2.0.2             circlize_0.4.12            
  [5] XVector_0.30.0              GenomicRanges_1.42.0       
  [7] GlobalOptions_0.1.2         fs_1.5.0                   
  [9] rstudioapi_0.13             farver_2.1.0               
 [11] ggrepel_0.9.1               fansi_0.4.2                
 [13] xml2_1.3.2                  codetools_0.2-18           
 [15] splines_4.0.4               doParallel_1.0.16          
 [17] jsonlite_1.7.2              Rsamtools_2.6.0            
 [19] broom_0.7.5                 dbplyr_2.1.0               
 [21] compiler_4.0.4              httr_1.4.2                 
 [23] backports_1.2.1             assertthat_0.2.1           
 [25] lazyeval_0.2.2              cli_2.3.1                  
 [27] later_1.1.0.1               htmltools_0.5.1.1          
 [29] tools_4.0.4                 GenomeInfoDbData_1.2.4     
 [31] gtable_0.3.0                glue_1.4.2                 
 [33] reshape2_1.4.4              Rcpp_1.0.6                 
 [35] Biobase_2.50.0              cellranger_1.1.0           
 [37] Biostrings_2.58.0           vctrs_0.3.6                
 [39] svglite_2.0.0               rtracklayer_1.50.0         
 [41] iterators_1.0.13            xfun_0.22                  
 [43] rvest_1.0.0                 lifecycle_1.0.0            
 [45] XML_3.99-0.6                zlibbioc_1.36.0            
 [47] scales_1.1.1                MatrixGenerics_1.2.1       
 [49] hms_1.0.0                   promises_1.2.0.1           
 [51] SummarizedExperiment_1.20.0 parallel_4.0.4             
 [53] RColorBrewer_1.1-2          yaml_2.2.1                 
 [55] gridExtra_2.3               stringi_1.5.3              
 [57] highr_0.8                   unbalhaar_2.0              
 [59] S4Vectors_0.28.1            foreach_1.5.1              
 [61] BiocGenerics_0.36.1         BiocParallel_1.24.1        
 [63] shape_1.4.5                 GenomeInfoDb_1.26.7        
 [65] matrixStats_0.58.0          rlang_0.4.10               
 [67] pkgconfig_2.0.3             systemfonts_1.0.1          
 [69] bitops_1.0-6                evaluate_0.14              
 [71] lattice_0.20-41             labeling_0.4.2             
 [73] GenomicAlignments_1.26.0    htmlwidgets_1.5.3          
 [75] tidyselect_1.1.0            plyr_1.8.6                 
 [77] magrittr_2.0.1              R6_2.5.0                   
 [79] IRanges_2.24.1              generics_0.1.0             
 [81] DelayedArray_0.16.3         DBI_1.1.1                  
 [83] pillar_1.5.1                haven_2.3.1                
 [85] whisker_0.4                 withr_2.4.1                
 [87] RCurl_1.98-1.3              modelr_0.1.8               
 [89] crayon_1.4.1                utf8_1.2.1                 
 [91] plotly_4.9.3                rmarkdown_2.7              
 [93] grid_4.0.4                  readxl_1.3.1               
 [95] data.table_1.14.0           git2r_0.28.0               
 [97] reprex_1.0.0                digest_0.6.27              
 [99] webshot_0.5.2               httpuv_1.5.5               
[101] stats4_4.0.4                munsell_0.5.0