Last updated: 2022-03-30

Checks: 7 0

Knit directory: R_gene_analysis/

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(20200917) 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 6b0f0ac. 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:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  FigS5.png
    Untracked:  GAPIT.GLM.Yield.Df.tValue.StdErr.csv
    Untracked:  GAPIT.GLM.Yield.GWAS.Results.csv
    Untracked:  GAPIT.GLM.Yield.Log.csv
    Untracked:  GAPIT.GLM.Yield.MAF.pdf
    Untracked:  GAPIT.GLM.Yield.Manhattan.Plot.Chromosomewise.pdf
    Untracked:  GAPIT.GLM.Yield.Manhattan.Plot.Genomewise.pdf
    Untracked:  GAPIT.GLM.Yield.Optimum.pdf
    Untracked:  GAPIT.GLM.Yield.PRED.csv
    Untracked:  GAPIT.GLM.Yield.QQ-Plot.pdf
    Untracked:  GAPIT.GLM.Yield.ROC.csv
    Untracked:  GAPIT.GLM.Yield.ROC.pdf
    Untracked:  GAPIT.GLM.Yield.phenotype_view.pdf
    Untracked:  GAPIT.Heterozygosity.pdf
    Untracked:  GAPIT.Kin.VanRaden.csv
    Untracked:  GAPIT.Kin.VanRaden.pdf
    Untracked:  GAPIT.MLM.Yield.Df.tValue.StdErr.csv
    Untracked:  GAPIT.MLM.Yield.GWAS.Results.csv
    Untracked:  GAPIT.MLM.Yield.Log.csv
    Untracked:  GAPIT.MLM.Yield.MAF.pdf
    Untracked:  GAPIT.MLM.Yield.Manhattan.Plot.Chromosomewise.pdf
    Untracked:  GAPIT.MLM.Yield.Manhattan.Plot.Genomewise.pdf
    Untracked:  GAPIT.MLM.Yield.Optimum.pdf
    Untracked:  GAPIT.MLM.Yield.PRED.csv
    Untracked:  GAPIT.MLM.Yield.QQ-Plot.pdf
    Untracked:  GAPIT.MLM.Yield.ROC.csv
    Untracked:  GAPIT.MLM.Yield.ROC.pdf
    Untracked:  GAPIT.MLM.Yield.phenotype_view.pdf
    Untracked:  GAPIT.MLMM.Yield.phenotype_view.pdf
    Untracked:  GAPIT.Marker.Density.pdf
    Untracked:  GAPIT.Marker.LD.pdf
    Untracked:  data/Brec_R1.txt
    Untracked:  data/Brec_R2.txt
    Untracked:  data/CR15_R1.txt
    Untracked:  data/CR15_R2.txt
    Untracked:  data/CR_14_R1.txt
    Untracked:  data/CR_14_R2.txt
    Untracked:  data/KS_R1.txt
    Untracked:  data/KS_R2.txt
    Untracked:  data/NBS_PAV.txt.gz
    Untracked:  data/NLR_PAV_GD.txt
    Untracked:  data/NLR_PAV_GM.txt
    Untracked:  data/PAVs_newick.txt
    Untracked:  data/PPR1.txt
    Untracked:  data/PPR2.txt
    Untracked:  data/SNPs_lee.id.biallic_maf_0.05_geno_0.1.vcf.gz
    Untracked:  data/SNPs_newick.txt
    Untracked:  data/bac.txt
    Untracked:  data/brown.txt
    Untracked:  data/cy3.txt
    Untracked:  data/cy5.txt
    Untracked:  data/early.txt
    Untracked:  data/flowerings.txt
    Untracked:  data/foregeye.txt
    Untracked:  data/height.txt
    Untracked:  data/inds.txt
    Untracked:  data/late.txt
    Untracked:  data/mature.txt
    Untracked:  data/motting.txt
    Untracked:  data/mvp.kin.bin
    Untracked:  data/mvp.kin.desc
    Untracked:  data/oil.txt
    Untracked:  data/paperinds.txt
    Untracked:  data/pdh.txt
    Untracked:  data/protein.txt
    Untracked:  data/rust_tan.txt
    Untracked:  data/salt.txt
    Untracked:  data/seedq.txt
    Untracked:  data/seedweight.txt
    Untracked:  data/snp.gds
    Untracked:  data/stem_termination.txt
    Untracked:  data/sudden.txt
    Untracked:  data/virus.txt

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/eda.Rmd) and HTML (docs/eda.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 6b0f0ac Philipp Bayer 2022-03-30 Fix tidyr update
html 6101181 Philipp Bayer 2021-09-23 Build site.
Rmd 2a87744 Philipp Bayer 2021-09-23 add more EDA
html 29d592e Philipp Bayer 2021-09-23 Build site.
Rmd 01cf4a4 Philipp Bayer 2021-09-23 add more EDA
html 926c27c Philipp Bayer 2021-09-23 Build site.
Rmd 1c46007 Philipp Bayer 2021-09-23 add more EDA
html 2844fd3 Philipp Bayer 2021-02-09 Add changes, add missing yield
html e519122 Philipp Bayer 2020-12-11 Build site.
html 83dc49a Philipp Bayer 2020-12-11 Trace deleted files
html dae157b Philipp Bayer 2020-09-24 Update of analysis
Rmd 1b346e9 Philipp Bayer 2020-09-22 More data!
html 1b346e9 Philipp Bayer 2020-09-22 More data!
html 0777e1d Philipp Bayer 2020-09-22 update
Rmd 3adcc5a Philipp Bayer 2020-09-22 wflow_git_commit(all = TRUE)
html e6e9b9b Philipp Bayer 2020-09-21 Build site.
Rmd c1fbbf9 Philipp Bayer 2020-09-21 wflow_publish("analysis/*")
Rmd c71005a Philipp Bayer 2020-09-18 lots changes
html c71005a Philipp Bayer 2020-09-18 lots changes
html 7d33bac Philipp Bayer 2020-09-18 Build site.
html ca65f66 Philipp Bayer 2020-09-18 Build site.
Rmd efd6af1 Philipp Bayer 2020-09-18 wflow_git_commit(all = T)
html efd6af1 Philipp Bayer 2020-09-18 wflow_git_commit(all = T)

library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.1.2
-- Attaching packages --------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.5     v purrr   0.3.4
v tibble  3.1.5     v dplyr   1.0.7
v tidyr   1.1.4     v stringr 1.4.0
v readr   2.1.2     v forcats 0.5.1
Warning: package 'ggplot2' was built under R version 4.1.1
Warning: package 'tibble' was built under R version 4.1.1
Warning: package 'tidyr' was built under R version 4.1.1
Warning: package 'readr' was built under R version 4.1.2
Warning: package 'purrr' was built under R version 4.1.1
Warning: package 'dplyr' was built under R version 4.1.1
Warning: package 'stringr' was built under R version 4.1.1
Warning: package 'forcats' was built under R version 4.1.1
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
library(knitr)
Warning: package 'knitr' was built under R version 4.1.1

Introduction

Here i make some of the tables for the manuscript.

files_to_make_tables_for <- list.files(path = './data', pattern = '*lst')

Let’s print the counts of R-gene classes for each type, that will be table 1:

all_results <- c()
class_dict <- list()

for(i in seq_along(files_to_make_tables_for)) {
  
  f <- files_to_make_tables_for[i]
  if (f == 'Lee.preRGA.candidates.by.Blast.lst' ) {next}
  if (f == 'Lee.RGA.candidates.lst') {next}
  print(f)
  fh <- read_tsv(paste('./data/', f, sep=''), col_names = c('Name','Class','Type'))
  if (ncol(fh) == 2) {
    # weird change in behaviour of tidyverse- used to be all NA by default
    # when there were only 2 columns
    fh$Type <- NA
  }
  fh <- fh %>% unite(United, Class, Type)
  # remove NAs in files with 2 columns
  fh$United <- gsub(pattern = '_NA', replacement = '', fh$United)
  
  fh <- fh %>% mutate(Name = gsub('.t1', '', Name))
  
  class_dict[[gsub('Lee.|.candidates.lst','',f)]] <- fh
  all_results <- c(all_results, table(fh$United))

}

[1] “Lee.NBS.candidates.lst” [1] “Lee.RLK.candidates.lst” [1] “Lee.RLP.candidates.lst” [1] “Lee.TMCC.candidates.lst”

kable(enframe(all_results, name='Class', value = 'Count'))
Class Count
CN 13
CNL 123
NBS 52
NL 95
OTHER 20
TN 22
TNL 99
TX 62
RLK_lrr 470
RLK_lysm 19
RLK_other_receptor 684
RLP_lrr 177
RLP_lysm 3
TM-CC 280

Let’s calculate the per-class gene variability.

pav_table <- read_tsv('./data/soybean_pan_pav.matrix_gene.txt.gz')
Rows: 51414 Columns: 1111
-- Column specification --------------------------------------------------------
Delimiter: "\t"
chr    (1): Individual
dbl (1110): AB-01, AB-02, BR-01, BR-02, BR-03, BR-04, BR-05, BR-06, BR-07, B...

i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
#t_pav_table <- as_tibble(cbind(nms = names(pav_table), t(pav_table)))
t_pav_table <- pav_table %>% pivot_longer(cols= -1) %>% pivot_wider(names_from = "Individual",values_from = "value") %>% rename('Individual'='name')
names <- c()
presences <- c()

for (i in seq_along(t_pav_table)){
  if ( i == 1) next
  thisind <- colnames(t_pav_table)[i]
  pavs <- t_pav_table[[i]]
  presents <- sum(strtoi(pavs))
  names <- c(names, thisind)
  presences <- c(presences, presents)
}
res_tibb <- new_tibble(list(names = names, presences = presences))

res_tibb now stores for each gene, in how many individuals it is present. We have 1110 individuals, so all genes with presences < 1110 are variable.

res_tibb <- res_tibb %>% mutate(type = case_when(presences == 1110 ~ 'core',
                                     TRUE ~ 'variable'))
nbs_joined <- left_join(class_dict[['NBS']], res_tibb, by = c('Name'='names'))

There are 486 NLR genes out of which 320 are core and 166 are variable.

rlk_joined <- left_join(class_dict[['RLK']], res_tibb, by = c('Name'='names'))

There are 1173 RLK genes out of which 1075 are core and 98 are variable.

rlp_joined <- left_join(class_dict[['RLP']], res_tibb, by = c('Name'='names'))

There are 180 RLK genes out of which 125 are core and 55 are variable.


sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

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

other attached packages:
 [1] knitr_1.36      forcats_0.5.1   stringr_1.4.0   dplyr_1.0.7    
 [5] purrr_0.3.4     readr_2.1.2     tidyr_1.1.4     tibble_3.1.5   
 [9] ggplot2_3.3.5   tidyverse_1.3.1 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       lubridate_1.8.0  assertthat_0.2.1 rprojroot_2.0.2 
 [5] digest_0.6.28    utf8_1.2.2       R6_2.5.1         cellranger_1.1.0
 [9] backports_1.2.1  reprex_2.0.1     evaluate_0.14    highr_0.9       
[13] httr_1.4.2       pillar_1.6.4     rlang_0.4.12     readxl_1.3.1    
[17] rstudioapi_0.13  whisker_0.4      jquerylib_0.1.4  rmarkdown_2.11  
[21] bit_4.0.4        munsell_0.5.0    broom_0.7.9      compiler_4.1.0  
[25] httpuv_1.6.3     modelr_0.1.8     xfun_0.27        pkgconfig_2.0.3 
[29] htmltools_0.5.2  tidyselect_1.1.1 fansi_0.5.0      crayon_1.4.1    
[33] tzdb_0.1.2       dbplyr_2.1.1     withr_2.5.0      later_1.3.0     
[37] grid_4.1.0       jsonlite_1.7.2   gtable_0.3.0     lifecycle_1.0.1 
[41] DBI_1.1.1        git2r_0.28.0     magrittr_2.0.1   scales_1.1.1    
[45] vroom_1.5.7      cli_3.2.0        stringi_1.7.5    fs_1.5.0        
[49] promises_1.2.0.1 xml2_1.3.2       bslib_0.3.1      ellipsis_0.3.2  
[53] generics_0.1.1   vctrs_0.3.8      tools_4.1.0      bit64_4.0.5     
[57] glue_1.6.2       hms_1.1.1        parallel_4.1.0   fastmap_1.1.0   
[61] yaml_2.2.1       colorspace_2.0-2 rvest_1.0.2      haven_2.4.3     
[65] sass_0.4.0