Last updated: 2020-12-11

Checks: 7 0

Knit directory: R_gene_analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2.9000). 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 83dc49a. 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
    Untracked:  data/yield.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/gwas.Rmd) and HTML (docs/gwas.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
html 83dc49a Philipp Bayer 2020-12-11 Trace deleted files
Rmd dae157b Philipp Bayer 2020-09-24 Update of analysis
html dae157b Philipp Bayer 2020-09-24 Update of analysis

Introduction

Here I run GAPIT’s methods with all phenotypes and the NLR gene matrix.

#devtools::install_github("jiabowang/GAPIT3", dependencies=TRUE)
# warning: GAPIT3 depends on LDheatmap, which was removed from CRAN. Install using devtools::install_github("cran/LDheatmap")

library(GAPIT3)
Warning: replacing previous import 'multtest::wapply' by 'gplots::wapply' when
loading 'GAPIT3'

Get all phenotypes:

phenos <- list.files('./data/', pattern = '*txt')
# remove larger data
phenos <- phenos[!grepl('txt.gz', phenos)]

Got 39 phenotype files. Annoyingly, some files have several columns, some have only two (ID + Phenotype).

I’ve written a Python script which transforms the NLR gene PAV matrix into the format GAPIT wants (check code/transformToGAPIT.py).

OK let’s run GAPIT with the Python output.

myGD <- read.table('./data/NLR_PAV_GD.txt', head=TRUE)
myGM <- read.table('./data/NLR_PAV_GM.txt', head=TRUE)
#myKI <- read.table('./data/SNP_KI.txt', head=FALSE) # this was calculated using SNPs from 
# https://research-repository.uwa.edu.au/files/89232545/SNPs_lee.id.biallic_maf_0.05_geno_0.1.vcf.gz

I used MVP for that on Pawsey’s Zeus, the following code was run before remotely:

library(rMVP)
MVP.Data(fileVCF="SNPs_lee.id.biallic_maf_0.05_geno_0.1.vcf",
       fileKin=FALSE,
         filePC=FALSE,
         out="mvp.vcf")
MVP.Data.Kin(TRUE, mvp_prefix='mvp.vcf', out='mvp')
MVP.Data.PC(TRUE, mvp_prefix='mvp.vcf', out='mvp', perc=1, pcs.keep=5)

Then I need to fix the kinship matrix because the GAPIT format is a bit different, and the order needs to be identical.

Let’s run GAPIT then, this might take a few minutes:

for( i in seq_along(phenos)){
  thisy <- phenos[i]
  myY <- read.table(paste('data/', thisy, sep=''), head=TRUE)

  # for now, let's skip those multicolumn phenotypes, I'm not sure what they are
  if(ncol(myY) != 2) {
    next
  }

  GAPIT(Y=myY[,c(1,2)],
        GD=myGD,
        GM=myGM,
        model=c('GLM','MLM','FarmCPU'),
        KI=myKI,
        PCA.total = 0) # avoid calculating PCs based on PAV data
  break
}

# gapit always seems to write to the current working directory. That annoys me.
# setwd() probably breaks something in workflowr,
# so let's just move the files all over

gapit_out <- list.files('.', pattern='GAPIT*')
for (i in seq_along(gapit_out)) {
  thisf <- gapit_out[i]
  # there's no file.move for some reason?!?
  file.copy(from = thisf,
            to = paste('output/GAPIT/', thisf, sep=''))
  file.remove(thisf)
}

sessionInfo()
R version 3.6.3 (2020-02-29)
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] GAPIT3_3.1.0         workflowr_1.6.2.9000

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5          pillar_1.4.4        compiler_3.6.3     
 [4] later_1.1.0.1       git2r_0.27.1        bitops_1.0-6       
 [7] tools_3.6.3         getPass_0.2-2       digest_0.6.25      
[10] lattice_0.20-41     evaluate_0.14       lifecycle_0.2.0    
[13] tibble_3.0.2        pkgconfig_2.0.3     rlang_0.4.7        
[16] Matrix_1.2-18       rstudioapi_0.11     yaml_2.2.1         
[19] parallel_3.6.3      xfun_0.17           httr_1.4.2         
[22] stringr_1.4.0       knitr_1.29          caTools_1.18.0     
[25] gtools_3.8.1        fs_1.5.0.9000       vctrs_0.3.1        
[28] stats4_3.6.3        grid_3.6.3          rprojroot_1.3-2    
[31] multtest_2.42.0     Biobase_2.46.0      glue_1.4.2         
[34] R6_2.4.1            processx_3.4.4      survival_3.2-3     
[37] rmarkdown_2.3       gdata_2.18.0        callr_3.4.4        
[40] magrittr_1.5        whisker_0.4         gplots_3.0.3       
[43] MASS_7.3-51.6       splines_3.6.3       backports_1.1.10   
[46] ps_1.3.4            promises_1.1.1      ellipsis_0.3.1     
[49] htmltools_0.5.0     BiocGenerics_0.32.0 httpuv_1.5.4       
[52] KernSmooth_2.23-17  stringi_1.5.3       crayon_1.3.4