Syntax fixes

This commit is contained in:
Waldir Leoncio 2024-09-27 06:59:18 +02:00
parent aa675d1804
commit dd6ee912bd
3 changed files with 7 additions and 7 deletions

View file

@ -80,7 +80,7 @@ greedyMix <- function(
# Generating partition summary ===============================================
ekat <- seq(1L, ninds * c[["rowsFromInd"]], c[["rowsFromInd"]])
c[["rows"]] <- cbind(ekat, ekat + c[["rowsFromInd"]] - 1L)
logml_npops_partitionSummary <- indMixWrapper(c, npops, counts, sumcounts, max_iter, fixedK, verbose) # FIXME: not working for FASTA, GenePop
logml_npops_partitionSummary <- indMixWrapper(c, npops, counts, sumcounts, max_iter, fixedK, verbose) # FIXME: not working for FASTA
logml <- logml_npops_partitionSummary[["logml"]]
npops <- logml_npops_partitionSummary[["npops"]]
partitionSummary <- logml_npops_partitionSummary[["partitionSummary"]]

View file

@ -423,7 +423,7 @@ greedyMix_muutokset <- R6Class(
globals$SUMCOUNTS[i1, ] <- globals$SUMCOUNTS[i1, ] + diffInSumCounts
if (i1 < npops) {
i2 <- c(1:(i1 - 1), (i1 + 1):npops)
i2 <- c(seq_len(i1 - 1), (i1 + 1):npops)
} else {
i2 <- 1:(i1 - 1)
}
@ -458,12 +458,12 @@ greedyMix_muutokset <- R6Class(
muutokset <- zeros(npops2, npops)
i1_logml <- globals$POP_LOGML[i1]
for (pop2 in 1:npops2) {
for (pop2 in seq_len(npops2)) {
inds <- inds2[matlab2r::find(T2 == pop2)]
ninds <- length(inds)
if (ninds > 0) {
rows <- list()
for (i in 1:ninds) {
for (i in seq_len(ninds)) {
ind <- inds[i]
lisa <- globalRows[ind, 1]:globalRows[ind, 2]
rows <- c(rows, t(lisa))
@ -480,7 +480,7 @@ greedyMix_muutokset <- R6Class(
globals$SUMCOUNTS[i1, ] <- globals$SUMCOUNTS[i1, ] + diffInSumCounts
if (i1 < npops) {
i2 <- c(1:(i1 - 1), (i1 + 1):npops)
i2 <- c(seq_len(i1 - 1), (i1 + 1):npops)
} else {
i2 <- 1:(i1 - 1)
}

View file

@ -11,7 +11,7 @@ laskeOsaDist <- function(inds2, dist, ninds) {
ninds2 <- length(inds2)
apu <- zeros(choose(ninds2, 2), 2)
rivi <- 1
for (i in 1:(ninds2 - 1)) {
for (i in seq_len(ninds2 - 1)) {
for (j in (i + 1):ninds2) {
apu[rivi, 1] <- inds2[i]
apu[rivi, 2] <- inds2[j]
@ -20,6 +20,6 @@ laskeOsaDist <- function(inds2, dist, ninds) {
}
apu <- (apu[, 1] - 1) * ninds - apu[, 1] / 2 *
(apu[, 1] - 1) + (apu[, 2] - apu[, 1])
dist2 <- dist(apu)
dist2 <- dist[apu]
return(dist2)
}