Last updated: 2020-09-17
Checks: 6 1
Knit directory: IITA_2020GS/
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.
The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish
to commit the R Markdown file and build the HTML.
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(20200915)
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 f953410. 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: analysis/.DS_Store
Ignored: data/.DS_Store
Untracked files:
Untracked: workflowr_log.R
Unstaged changes:
Modified: analysis/04-CrossValidation.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/04-CrossValidation.Rmd
) and HTML (docs/04-CrossValidation.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 | d6d72f8 | wolfemd | 2020-09-17 | Build site. |
html | 7e156dd | wolfemd | 2020-09-17 | Build site. |
Rmd | 7ea8b80 | wolfemd | 2020-09-17 | All steps including genomic predicting (excluding cross-validation), |
Current Step:
5-fold cross-validation. Replicate 5-times.
3 genomic models:
The data for the next step can be found on the cassavabase FTP server here.
Can be loaded directly to R from FTP.
NOTICE: You need enough RAM and a stable network connection. I do the next steps, including cross-validation on a server with plenty of RAM and a good, stable network connection, rather than on my personal computer (a laptop with 16 GB RAM).
The outputs (kinship matrices and filtered snp dosages) of the steps below, which are too large for GitHub, can be found on the cassavabase FTP server here.
# activate multithread OpenBLAS for fast compute of SigmaM (genotypic var-covar matrix)
export OMP_NUM_THREADS=56
library(tidyverse); library(magrittr);
source(here::here("code","gsFunctions.R"))
snps<-readRDS(file=url(paste0("ftp://ftp.cassavabase.org/marnin_datasets/NGC_BigData/",
"DosageMatrix_RefPanelAndGSprogeny_ReadyForGP_73019.rds")))
blups<-readRDS(file=here::here("output","iita_blupsForModelTraining.rds"))
blups %<>%
select(Trait,modelOutput) %>%
unnest(modelOutput) %>%
select(Trait,BLUPs) %>%
unnest(BLUPs)
table(unique(blups$GID) %in% rownames(snps))
# FALSE TRUE
# 36837 7638
# keep only samples that are either geno+pheno or genotyped with TMS18 in the name.
iitaSamples2keep<-union(unique(blups$GID) %>% .[.%in% rownames(snps)],
rownames(snps) %>% grep("TMS18",.,value = T))
length(iitaSamples2keep) # [1] 9061
# subset BLUPs and snps
blups %<>%
filter(GID %in% iitaSamples2keep) %>%
nest(TrainingData=-Trait)
snps<-snps[iitaSamples2keep,]
## MAF>1% filter
snps %<>% maf_filter(.,0.01)
dim(snps) # [1] 9061 68029
Going to use my own kinship function.
Make the kinships.
Below e.g. A*A
makes a matrix that approximates additive-by-additive epistasis relationships.
A<-kinship(snps,type="add")
D<-kinship(snps,type="dom")
AA<-A*A
AD<-A*D
DD<-D*D
saveRDS(snps,file=here::here("output","DosageMatrix_IITA_2020Sep16.rds"))
saveRDS(A,file=here::here("output","Kinship_A_IITA_2020Sep16.rds"))
saveRDS(D,file=here::here("output","Kinship_D_IITA_2020Sep16.rds"))
saveRDS(AA,file=here::here("output","Kinship_AA_IITA_2020Sep16.rds"))
saveRDS(AD,file=here::here("output","Kinship_AD_IITA_2020Sep16.rds"))
saveRDS(DD,file=here::here("output","Kinship_DD_IITA2020Sep16.rds"))
#rm(snps); gc()
NOTICE: The outputs (kinship matrices and filtered snp dosages) of the steps below, which are too large for GitHub, can be found on the cassavabase FTP server here.