From 177685b6a2180d69149729697435ce424e835e8e Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Fri, 11 Aug 2023 16:22:29 +0200 Subject: [PATCH] Partial reversion of b034158 (#25) It should be OK for Z to be NULL. This currently triggers an issue on initialCounts(), which should be fixed --- R/indMix.R | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/R/indMix.R b/R/indMix.R index 30e21e6..16302be 100644 --- a/R/indMix.R +++ b/R/indMix.R @@ -88,20 +88,18 @@ indMix <- function(c, npops, counts = NULL, sumcounts = NULL, max_iter = 100L, d } ninds <- size(rows, 1) - if (!is.null(Z)) { - initialPartition <- admixture_initialization(initData, npops, Z) - sumcounts_counts_logml <- initialCounts( - initialPartition, data, npops, rows, noalle, adjprior - ) - sumcounts <- sumcounts_counts_logml$sumcounts - counts <- sumcounts_counts_logml$counts - logml <- sumcounts_counts_logml$logml - - PARTITION <- zeros(ninds, 1) - for (i in seq_len(ninds)) { - apu <- rows[i] - PARTITION[i] <- initialPartition[apu[1]] - } + initialPartition <- admixture_initialization(initData, npops, Z) + sumcounts_counts_logml <- initialCounts( + initialPartition, data, npops, rows, noalle, adjprior + ) + sumcounts <- sumcounts_counts_logml$sumcounts + counts <- sumcounts_counts_logml$counts + logml <- sumcounts_counts_logml$logml + + PARTITION <- zeros(ninds, 1) + for (i in seq_len(ninds)) { + apu <- rows[i] + PARTITION[i] <- initialPartition[apu[1]] } COUNTS <- counts