Syntax fixes
This commit is contained in:
parent
aa675d1804
commit
dd6ee912bd
3 changed files with 7 additions and 7 deletions
|
|
@ -80,7 +80,7 @@ greedyMix <- function(
|
||||||
# Generating partition summary ===============================================
|
# Generating partition summary ===============================================
|
||||||
ekat <- seq(1L, ninds * c[["rowsFromInd"]], c[["rowsFromInd"]])
|
ekat <- seq(1L, ninds * c[["rowsFromInd"]], c[["rowsFromInd"]])
|
||||||
c[["rows"]] <- cbind(ekat, ekat + c[["rowsFromInd"]] - 1L)
|
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"]]
|
logml <- logml_npops_partitionSummary[["logml"]]
|
||||||
npops <- logml_npops_partitionSummary[["npops"]]
|
npops <- logml_npops_partitionSummary[["npops"]]
|
||||||
partitionSummary <- logml_npops_partitionSummary[["partitionSummary"]]
|
partitionSummary <- logml_npops_partitionSummary[["partitionSummary"]]
|
||||||
|
|
|
||||||
|
|
@ -423,7 +423,7 @@ greedyMix_muutokset <- R6Class(
|
||||||
globals$SUMCOUNTS[i1, ] <- globals$SUMCOUNTS[i1, ] + diffInSumCounts
|
globals$SUMCOUNTS[i1, ] <- globals$SUMCOUNTS[i1, ] + diffInSumCounts
|
||||||
|
|
||||||
if (i1 < npops) {
|
if (i1 < npops) {
|
||||||
i2 <- c(1:(i1 - 1), (i1 + 1):npops)
|
i2 <- c(seq_len(i1 - 1), (i1 + 1):npops)
|
||||||
} else {
|
} else {
|
||||||
i2 <- 1:(i1 - 1)
|
i2 <- 1:(i1 - 1)
|
||||||
}
|
}
|
||||||
|
|
@ -458,12 +458,12 @@ greedyMix_muutokset <- R6Class(
|
||||||
muutokset <- zeros(npops2, npops)
|
muutokset <- zeros(npops2, npops)
|
||||||
|
|
||||||
i1_logml <- globals$POP_LOGML[i1]
|
i1_logml <- globals$POP_LOGML[i1]
|
||||||
for (pop2 in 1:npops2) {
|
for (pop2 in seq_len(npops2)) {
|
||||||
inds <- inds2[matlab2r::find(T2 == pop2)]
|
inds <- inds2[matlab2r::find(T2 == pop2)]
|
||||||
ninds <- length(inds)
|
ninds <- length(inds)
|
||||||
if (ninds > 0) {
|
if (ninds > 0) {
|
||||||
rows <- list()
|
rows <- list()
|
||||||
for (i in 1:ninds) {
|
for (i in seq_len(ninds)) {
|
||||||
ind <- inds[i]
|
ind <- inds[i]
|
||||||
lisa <- globalRows[ind, 1]:globalRows[ind, 2]
|
lisa <- globalRows[ind, 1]:globalRows[ind, 2]
|
||||||
rows <- c(rows, t(lisa))
|
rows <- c(rows, t(lisa))
|
||||||
|
|
@ -480,7 +480,7 @@ greedyMix_muutokset <- R6Class(
|
||||||
globals$SUMCOUNTS[i1, ] <- globals$SUMCOUNTS[i1, ] + diffInSumCounts
|
globals$SUMCOUNTS[i1, ] <- globals$SUMCOUNTS[i1, ] + diffInSumCounts
|
||||||
|
|
||||||
if (i1 < npops) {
|
if (i1 < npops) {
|
||||||
i2 <- c(1:(i1 - 1), (i1 + 1):npops)
|
i2 <- c(seq_len(i1 - 1), (i1 + 1):npops)
|
||||||
} else {
|
} else {
|
||||||
i2 <- 1:(i1 - 1)
|
i2 <- 1:(i1 - 1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ laskeOsaDist <- function(inds2, dist, ninds) {
|
||||||
ninds2 <- length(inds2)
|
ninds2 <- length(inds2)
|
||||||
apu <- zeros(choose(ninds2, 2), 2)
|
apu <- zeros(choose(ninds2, 2), 2)
|
||||||
rivi <- 1
|
rivi <- 1
|
||||||
for (i in 1:(ninds2 - 1)) {
|
for (i in seq_len(ninds2 - 1)) {
|
||||||
for (j in (i + 1):ninds2) {
|
for (j in (i + 1):ninds2) {
|
||||||
apu[rivi, 1] <- inds2[i]
|
apu[rivi, 1] <- inds2[i]
|
||||||
apu[rivi, 2] <- inds2[j]
|
apu[rivi, 2] <- inds2[j]
|
||||||
|
|
@ -20,6 +20,6 @@ laskeOsaDist <- function(inds2, dist, ninds) {
|
||||||
}
|
}
|
||||||
apu <- (apu[, 1] - 1) * ninds - apu[, 1] / 2 *
|
apu <- (apu[, 1] - 1) * ninds - apu[, 1] / 2 *
|
||||||
(apu[, 1] - 1) + (apu[, 2] - apu[, 1])
|
(apu[, 1] - 1) + (apu[, 2] - apu[, 1])
|
||||||
dist2 <- dist(apu)
|
dist2 <- dist[apu]
|
||||||
return(dist2)
|
return(dist2)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue