Last updated: 2021-09-23

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 01cf4a4. 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:  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_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/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/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/stem_termination.txt
    Untracked:  data/sudden.txt
    Untracked:  data/virus.txt

Unstaged changes:
    Modified:   analysis/yield_lm_link.Rmd

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 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)
-- Attaching packages --------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.5     v purrr   0.3.4
v tibble  3.1.2     v dplyr   1.0.7
v tidyr   1.1.3     v stringr 1.4.0
v readr   1.4.0     v forcats 0.5.1
Warning: package 'ggplot2' was built under R version 4.0.5
Warning: package 'tibble' was built under R version 4.0.5
Warning: package 'dplyr' was built under R version 4.0.5
-- 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.0.5

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 == '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'))
  fh <- fh %>% unite(United, Class, Type)
  # remove NAs in files with 2 columns
  fh$United <- gsub(pattern = '_NA', replacement = '', fh$United)
  
  class_dict[[gsub('Lee.|.candidates.lst','',f)]] <- fh
  all_results <- c(all_results, table(fh$United))

}

[1] “Lee.NBS.candidates.lst” [1] “Lee.preRGA.candidates.by.Blast.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
NA 14358
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')

-- Column specification --------------------------------------------------------
cols(
  .default = col_double(),
  Individual = col_character()
)
i Use `spec()` for the full column specifications.
t_pav_table <- as_tibble(cbind(nms = names(pav_table), t(pav_table)))
Warning: The `x` argument of `as_tibble.matrix()` must have unique column names if `.name_repair` is omitted as of tibble 2.0.0.
Using compatibility `.name_repair`.
names(t_pav_table) <- t_pav_table[1,]
Warning: The `value` argument of `names<-` must be a character vector as of
tibble 3.0.0.
t_pav_table <- t_pav_table %>% filter(Individual != 'Individual')
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))
Warning: The `nrow` argument of `new_tibble()` can't be missing as of tibble 2.0.0.
`x` must be a scalar integer.

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 122 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 89 are variable.

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

There are rnrow(rlp_joined)` RLK genes out of which 125 are core and 45 are variable.


sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

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.33      forcats_0.5.1   stringr_1.4.0   dplyr_1.0.7    
 [5] purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.2   
 [9] ggplot2_3.3.5   tidyverse_1.3.1 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1  xfun_0.22         bslib_0.2.4       haven_2.4.0      
 [5] colorspace_2.0-2  vctrs_0.3.8       generics_0.1.0    htmltools_0.5.1.1
 [9] yaml_2.2.1        utf8_1.2.1        rlang_0.4.11      jquerylib_0.1.4  
[13] later_1.2.0       pillar_1.6.1      withr_2.4.2       glue_1.4.2       
[17] DBI_1.1.1         dbplyr_2.1.1      readxl_1.3.1      modelr_0.1.8     
[21] lifecycle_1.0.0   cellranger_1.1.0  munsell_0.5.0     gtable_0.3.0     
[25] rvest_1.0.0       evaluate_0.14     httpuv_1.6.0      fansi_0.5.0      
[29] highr_0.9         broom_0.7.6       Rcpp_1.0.6        promises_1.2.0.1 
[33] backports_1.2.1   scales_1.1.1      jsonlite_1.7.2    fs_1.5.0         
[37] hms_1.0.0         digest_0.6.27     stringi_1.6.2     rprojroot_2.0.2  
[41] grid_4.0.3        cli_3.0.0         tools_4.0.3       magrittr_2.0.1   
[45] sass_0.3.1        crayon_1.4.1      whisker_0.4       pkgconfig_2.0.3  
[49] ellipsis_0.3.2    xml2_1.3.2        reprex_2.0.0      lubridate_1.7.10 
[53] rstudioapi_0.13   assertthat_0.2.1  rmarkdown_2.7     httr_1.4.2       
[57] R6_2.5.0          git2r_0.28.0      compiler_4.0.3