From c55accb9da876eef6aa6f358db85ebc9386a1b1b Mon Sep 17 00:00:00 2001 From: jeffersonfparil Date: Wed, 17 Jul 2024 11:14:19 +1000 Subject: [PATCH] rectifying insufficient rows/columns to sample from in the conversion of non-numeric into numeric genotype matrix --- R/io.R | 4 ++-- man/fn_cv_1.Rd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/io.R b/R/io.R index 7844db8..1c07fe5 100644 --- a/R/io.R +++ b/R/io.R @@ -371,8 +371,8 @@ fn_G_non_numeric_to_numeric = function(G_non_numeric, retain_minus_one_alleles_p } ### Extract ploidy where we assume the same ploidy across the entire data set ploidy = length(unlist(strsplit(G_non_numeric[1,1], ""))) - for (i in sample(1:nrow(G_non_numeric), size=100, replace=FALSE)) { - for (j in sample(1:ncol(G_non_numeric), size=100, replace=FALSE)) { + for (i in sample(1:nrow(G_non_numeric), size=min(c(100, nrow(G_non_numeric))), replace=FALSE)) { + for (j in sample(1:ncol(G_non_numeric), size=min(c(100, ncol(G_non_numeric))), replace=FALSE)) { if (length(unlist(strsplit(G_non_numeric[i, j], ""))) != ploidy) { error = methods::new("gpError", code=213, diff --git a/man/fn_cv_1.Rd b/man/fn_cv_1.Rd index 2f2ced8..322a931 100644 --- a/man/fn_cv_1.Rd +++ b/man/fn_cv_1.Rd @@ -45,7 +45,7 @@ subsequent elements are optional which may refer to the allele identifier and ot each column refer to a random shuffling of samples/entry/pool from which the identities of the training and validation sets will be sourced from} -\item{vec_set_partition_groupings}{vector of numeric partitioning indexes where each index refer to the +\item{vec_set_partition_groupings}{vector of numeric partitioning indexes of size n samples, where each index refer to the fold which will serve as the validation population} \item{prefix_tmp}{string referring to the prefix of the temporary files,