From f252478add9f1bbb402489db232287917c0476fc Mon Sep 17 00:00:00 2001 From: jeffersonfparil Date: Sun, 9 Jun 2024 10:22:18 +1000 Subject: [PATCH] will need to start visialisation of output via Rshiny --- .Rbuildignore | 1 + R/models.R | 36 +++++++++---------- man/fn_Bayes_A.Rd | 2 +- man/fn_Bayes_B.Rd | 2 +- man/fn_Bayes_C.Rd | 2 +- ...ross_validation_across_populations_bulk.Rd | 1 + ...ross_validation_across_populations_lopo.Rd | 1 + ..._validation_across_populations_pairwise.Rd | 1 + man/fn_cross_validation_within_population.Rd | 1 + man/fn_cv_1.Rd | 1 + man/fn_elastic_net.Rd | 2 +- man/fn_gBLUP.Rd | 2 +- man/fn_lasso.Rd | 2 +- man/fn_ols.Rd | 2 +- man/fn_ridge.Rd | 2 +- man/gp.Rd | 4 +++ tests/testthat/test-models.R | 16 ++++----- 17 files changed, 43 insertions(+), 35 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 9ee6e3c..9157d1d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,4 +1,5 @@ .github/ +.vscode/ exec/ _libs/ shell.nix diff --git a/R/models.R b/R/models.R index 4f2ceee..5e76dda 100644 --- a/R/models.R +++ b/R/models.R @@ -53,7 +53,7 @@ suppressWarnings(suppressPackageStartupMessages(library(sommer))) #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -65,7 +65,7 @@ suppressWarnings(suppressPackageStartupMessages(library(sommer))) fn_ols = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(diag_inflate=1e-4), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -226,7 +226,7 @@ fn_ols = function(list_merged, vec_idx_training, vec_idx_validation, other_param #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -238,7 +238,7 @@ fn_ols = function(list_merged, vec_idx_training, vec_idx_validation, other_param fn_ridge = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(n_folds=10), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -370,7 +370,7 @@ fn_ridge = function(list_merged, vec_idx_training, vec_idx_validation, other_par #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -382,7 +382,7 @@ fn_ridge = function(list_merged, vec_idx_training, vec_idx_validation, other_par fn_lasso = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(n_folds=10), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -514,7 +514,7 @@ fn_lasso = function(list_merged, vec_idx_training, vec_idx_validation, other_par #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -526,7 +526,7 @@ fn_lasso = function(list_merged, vec_idx_training, vec_idx_validation, other_par fn_elastic_net = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(n_folds=10), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -660,7 +660,7 @@ fn_elastic_net = function(list_merged, vec_idx_training, vec_idx_validation, oth #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -673,7 +673,7 @@ fn_Bayes_A = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(nIter=12e3, burnIn=2e3, out_prefix="bglr_bayesA-"), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -802,7 +802,7 @@ fn_Bayes_A = function(list_merged, vec_idx_training, vec_idx_validation, #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -815,7 +815,7 @@ fn_Bayes_B = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(nIter=12e3, burnIn=2e3, out_prefix="bglr_bayesB-"), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -944,7 +944,7 @@ fn_Bayes_B = function(list_merged, vec_idx_training, vec_idx_validation, #' + $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -957,7 +957,7 @@ fn_Bayes_C = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(nIter=12e3, burnIn=2e3, out_prefix="bglr_bayesC-"), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -1085,7 +1085,7 @@ fn_Bayes_C = function(list_merged, vec_idx_training, vec_idx_validation, #' effects (effects greater than machine epsilon ~2.2e-16) #' - Err: gpError #' @examples -#' list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +#' list_sim = fn_simulate_data(verbose=TRUE) #' G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) #' list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) #' list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -1097,7 +1097,7 @@ fn_Bayes_C = function(list_merged, vec_idx_training, vec_idx_validation, fn_gBLUP = function(list_merged, vec_idx_training, vec_idx_validation, other_params=list(), verbose=FALSE) { ################################################### ### TEST - # list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + # list_sim = fn_simulate_data(verbose=TRUE) # G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) # list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) # COVAR = G %*% t(G); # rownames(COVAR) = NULL @@ -1156,10 +1156,8 @@ fn_gBLUP = function(list_merged, vec_idx_training, vec_idx_validation, other_par covariates_string = paste(paste0("covariate_", 1:ncol(X)), collapse="+") eval(parse(text=paste0("mod = sommer::mmer(y ~ 1 + ", covariates_string, ", random= ~vsr(id, Gu=A ), rcov= ~vsr(units), data=df_training, dateWarning=FALSE, verbose=FALSE)"))) } else { - mod = sommer::mmer(y ~ 1, random= ~vsr(id, Gu=A ), rcov= ~vsr(units), data=df_training, dateWarning=FALSE, verbose=FALSE) + mod = sommer::mmer(y ~ 1, random= ~vsr(id, Gu=A), rcov= ~vsr(units), data=df_training, dateWarning=FALSE, verbose=FALSE) } - - ### Extract effects b_hat = mod$Beta$Estimate; names(b_hat) = mod$Beta$Effect u_hat = mod$U$`u:id`$y diff --git a/man/fn_Bayes_A.Rd b/man/fn_Bayes_A.Rd index 3c2e88e..17fbd9f 100644 --- a/man/fn_Bayes_A.Rd +++ b/man/fn_Bayes_A.Rd @@ -77,7 +77,7 @@ SNP/allele identity including chromosome/scaffold, position and optionally allel Bayes A regression model (scaled t-distributed effects) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_Bayes_B.Rd b/man/fn_Bayes_B.Rd index b5a9082..e59b620 100644 --- a/man/fn_Bayes_B.Rd +++ b/man/fn_Bayes_B.Rd @@ -81,7 +81,7 @@ Bayes B regression model where \eqn{\pi \sim \beta(\theta_1, \theta_2)}) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_Bayes_C.Rd b/man/fn_Bayes_C.Rd index e71c532..391de15 100644 --- a/man/fn_Bayes_C.Rd +++ b/man/fn_Bayes_C.Rd @@ -81,7 +81,7 @@ Bayes C regression model with probability \eqn{1-\pi}, where \eqn{\pi \sim \beta(\theta_1, \theta_2)}) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_cross_validation_across_populations_bulk.Rd b/man/fn_cross_validation_across_populations_bulk.Rd index c2e0dad..3bd6e42 100644 --- a/man/fn_cross_validation_across_populations_bulk.Rd +++ b/man/fn_cross_validation_across_populations_bulk.Rd @@ -89,6 +89,7 @@ https://link.springer.com/protocol/10.1007/978-1-62703-447-0_13 \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error diff --git a/man/fn_cross_validation_across_populations_lopo.Rd b/man/fn_cross_validation_across_populations_lopo.Rd index c00f662..0b441ae 100644 --- a/man/fn_cross_validation_across_populations_lopo.Rd +++ b/man/fn_cross_validation_across_populations_lopo.Rd @@ -79,6 +79,7 @@ https://link.springer.com/protocol/10.1007/978-1-62703-447-0_13 \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error diff --git a/man/fn_cross_validation_across_populations_pairwise.Rd b/man/fn_cross_validation_across_populations_pairwise.Rd index c1934fb..b6fe760 100644 --- a/man/fn_cross_validation_across_populations_pairwise.Rd +++ b/man/fn_cross_validation_across_populations_pairwise.Rd @@ -79,6 +79,7 @@ https://link.springer.com/protocol/10.1007/978-1-62703-447-0_13 \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error diff --git a/man/fn_cross_validation_within_population.Rd b/man/fn_cross_validation_within_population.Rd index 31ec425..e060dc2 100644 --- a/man/fn_cross_validation_within_population.Rd +++ b/man/fn_cross_validation_within_population.Rd @@ -89,6 +89,7 @@ https://link.springer.com/protocol/10.1007/978-1-62703-447-0_13 \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error diff --git a/man/fn_cv_1.Rd b/man/fn_cv_1.Rd index 0398a01..2f2ced8 100644 --- a/man/fn_cv_1.Rd +++ b/man/fn_cv_1.Rd @@ -68,6 +68,7 @@ i.e. prefix (which can include an existing directory) of Bayesian (BGLR) model t \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error diff --git a/man/fn_elastic_net.Rd b/man/fn_elastic_net.Rd index 1a9e64d..a901944 100644 --- a/man/fn_elastic_net.Rd +++ b/man/fn_elastic_net.Rd @@ -73,7 +73,7 @@ SNP/allele identity including chromosome/scaffold, position and optionally allel Elastic-net regression model (regularisation via combination of ridge and Lasso; alpha is optimised) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_gBLUP.Rd b/man/fn_gBLUP.Rd index 626a6b0..1c022ce 100644 --- a/man/fn_gBLUP.Rd +++ b/man/fn_gBLUP.Rd @@ -79,7 +79,7 @@ and not to estimate the additive effects of each SNP/locus/allele which differen The genotypic value of each sample/entry/pool is estimated as the best linear unbiased predictors or BLUPs.) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_lasso.Rd b/man/fn_lasso.Rd index 81b3e5d..a051c21 100644 --- a/man/fn_lasso.Rd +++ b/man/fn_lasso.Rd @@ -73,7 +73,7 @@ SNP/allele identity including chromosome/scaffold, position and optionally allel Lasso regression model (regularisation via least absolute shrinkage and selection operator; alpha=1) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_ols.Rd b/man/fn_ols.Rd index 0e5239b..c537336 100644 --- a/man/fn_ols.Rd +++ b/man/fn_ols.Rd @@ -73,7 +73,7 @@ SNP/allele identity including chromosome/scaffold, position and optionally allel Ordinary least squares model } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/fn_ridge.Rd b/man/fn_ridge.Rd index 801b4ca..7254428 100644 --- a/man/fn_ridge.Rd +++ b/man/fn_ridge.Rd @@ -73,7 +73,7 @@ SNP/allele identity including chromosome/scaffold, position and optionally allel Ridge regression model (a.k.a. GBLUP; regularisation via Tikhonov regularisation; alpha=0) } \examples{ -list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) +list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) diff --git a/man/gp.Rd b/man/gp.Rd index b786e1f..ae9874f 100644 --- a/man/gp.Rd +++ b/man/gp.Rd @@ -94,6 +94,7 @@ in within population cross-validation (see ?fn_cross_validation_within_populatio \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error @@ -127,6 +128,7 @@ in within population cross-validation (see ?fn_cross_validation_within_populatio \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error @@ -160,6 +162,7 @@ in within population cross-validation (see ?fn_cross_validation_within_populatio \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error @@ -193,6 +196,7 @@ in within population cross-validation (see ?fn_cross_validation_within_populatio \item $n_validation: number of samples/entries/pools in the validation set \item $duration_mins: time taken in minutes to fit the genomic prediction model and assess the prediction accuracies \item $n_non_zero: number of non-zero estimated effects (effects greater than machine epsilon ~2.2e-16) +\item $n_total_features: total number of zero and non-zero effects, i.e. total number of SNPs/alleles/features \item $mbe: mean bias error \item $mae: mean absolute error \item $rmse: root mean squared error diff --git a/tests/testthat/test-models.R b/tests/testthat/test-models.R index b5125e2..68135f8 100644 --- a/tests/testthat/test-models.R +++ b/tests/testthat/test-models.R @@ -5,7 +5,7 @@ test_that("fn_ols", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -21,7 +21,7 @@ test_that("fn_ols", { test_that("fn_ridge", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -38,7 +38,7 @@ test_that("fn_ridge", { test_that("fn_lasso", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -55,7 +55,7 @@ test_that("fn_lasso", { test_that("fn_elastic_net", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -72,7 +72,7 @@ test_that("fn_elastic_net", { test_that("fn_Bayes_A", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -89,7 +89,7 @@ test_that("fn_Bayes_A", { test_that("fn_Bayes_B", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -106,7 +106,7 @@ test_that("fn_Bayes_B", { test_that("fn_Bayes_C", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE) @@ -123,7 +123,7 @@ test_that("fn_Bayes_C", { test_that("fn_gBLUP", { set.seed(123) - list_sim = fn_simulate_data(n_pop=3, verbose=TRUE) + list_sim = fn_simulate_data(verbose=TRUE) G = fn_load_genotype(fname_geno=list_sim$fname_geno_vcf) list_pheno = fn_load_phenotype(fname_pheno=list_sim$fname_pheno_tsv) list_merged = fn_merge_genotype_and_phenotype(G=G, list_pheno=list_pheno, verbose=TRUE)