From 458038ee801fe5f412d20b5def16494fd2493289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgabrielgesteira=E2=80=9D?= <“gabrielgesteira@gmail.com”> Date: Mon, 24 Oct 2022 14:34:04 -0400 Subject: [PATCH] Revert Pgametes and Qgametes change --- R/read_data.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/read_data.R b/R/read_data.R index fc17c55..5944371 100644 --- a/R/read_data.R +++ b/R/read_data.R @@ -115,13 +115,13 @@ read_data <- function(ploidy = 6, geno.prob, geno.dose = NULL, double.reduction Palleles <- letters[1:ploidy]; length(Palleles) Pgametes <- gtools::combinations(length(Palleles), ploidy/2, Palleles, repeats.allowed = TRUE); dim(Pgametes) Punique <- apply(Pgametes, 1, unique); length(Punique) - Pgametes <- apply(Pgametes[which(lapply(Punique, length) >= n.unique),], 1, paste, collapse=""); length(Pgametes) - # Pgametes <- lapply(combn(Palleles, ploidy/2, simplify = FALSE), paste, collapse=""); length(Pgametes) + ## Pgametes <- apply(Pgametes[which(lapply(Punique, length) >= n.unique),], 1, paste, collapse=""); length(Pgametes) + Pgametes <- lapply(combn(Palleles, ploidy/2, simplify = FALSE), paste, collapse=""); length(Pgametes) Qalleles <- letters[(ploidy+1):(2*ploidy)] Qgametes <- gtools::combinations(length(Qalleles), ploidy/2, Qalleles, repeats.allowed = TRUE); dim(Qgametes) Qunique <- apply(Qgametes, 1, unique); length(Qunique) - Qgametes <- apply(Qgametes[which(lapply(Qunique, length) >= n.unique),], 1, paste, collapse=""); length(Qgametes) - # Qgametes <- lapply(combn(Qalleles, ploidy/2, simplify = FALSE), paste, collapse="") + ## Qgametes <- apply(Qgametes[which(lapply(Qunique, length) >= n.unique),], 1, paste, collapse=""); length(Qgametes) + Qgametes <- lapply(combn(Qalleles, ploidy/2, simplify = FALSE), paste, collapse="") genotypes <- as.vector(t(outer(Pgametes, Qgametes, paste, sep=""))) sibs <- sapply( genotypes, FUN=function(x) paste(x, genotypes, sep="") ) Pi <- matrix(data = NA, nrow = length(Pgametes)^2, ncol = length(Pgametes)^2)