Skip to content

Commit

Permalink
Merge pull request #8 from gabrielgesteira/diploid_fix
Browse files Browse the repository at this point in the history
Revert Pgametes and Qgametes change
  • Loading branch information
gabrielgesteira authored Mar 20, 2024
2 parents 5c9ec33 + 458038e commit 2578b35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/read_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2578b35

Please sign in to comment.