Several fixes for cleaner check

This commit is contained in:
Waldir Leoncio 2020-07-14 14:52:31 +02:00
parent a8e6585d39
commit 7a68fbd585
6 changed files with 15 additions and 21 deletions

View file

@ -294,14 +294,15 @@ greedyMix <- function(
data <- data[, seq_len(ncol(data) - 1)]
# ASK: remove?
# h0 = findobj('Tag','filename1_text'); inp = get(h0,'String');
# h0 = findobj('Tag','filename2_text');
# h0 = findobj('Tag','filename1_text')
# inp = get(h0,'String');
# h0 = findobj('Tag','filename2_text')
# outp = get(h0,'String');
# changesInLogml <- writeMixtureInfo(
# logml, rowsFromInd, data, adjprior, priorTerm, outp, inp,
# popnames, fixedK
# ) # TODO translate
changesInLogml <- writeMixtureInfo(
logml, rowsFromInd, data, adjprior, priorTerm, outp, inp,
popnames, fixedK
) # FIXMEL depends on get function above
# viewMixPartition(PARTITION, popnames) # ASK translate? On graph folder

View file

@ -53,12 +53,12 @@ handleData <- function(raw_data) {
)
}
nind <- max(data[, end])
nind <- max(data[, ncol(data)])
nrows <- size(data, 1)
ncols <- size(data, 2)
rowsFromInd <- zeros(nind, 1)
for (i in 1:nind) {
rowsFromInd[i] <- length(find(data[, end] == i))
rowsFromInd[i] <- length(find(data[, ncol(data)] == i))
}
maxRowsFromInd <- max(rowsFromInd)
a <- -999
@ -81,7 +81,7 @@ handleData <- function(raw_data) {
repmat(1 / noalle[j], c(noalle[j], 1)),
ones(max(noalle) - noalle[j], 1)
))
priorTerm <- priorTerm + noalle[j] * gammaln(1 / noalle[j])
priorTerm <- priorTerm + noalle[j] * lgamma(1 / noalle[j])
}
out <- list(
newData = newData,

View file

@ -7,7 +7,7 @@
#' @param Y data
#' @param method either 'si', 'av', 'co' 'ce' or 'wa'
#' @export
linkage <- function(Y, method) {
linkage <- function(Y, method = 'co') {
k <- size(Y)[1]
n <- size(Y)[2]
m <- (1 + sqrt(1 + 8 * n)) / 2
@ -17,10 +17,7 @@ linkage <- function(Y, method) {
'of the PDIST function in size.'
)
}
if (nargin == 1) { # set default switch to be 'co'
method <- 'co'
}
method <- lower(method[1:2]) # simplify the switch string.
method <- tolower(substr(method, 1, 2)) # simplify the switch string.
monotonic <- 1
Z <- zeros(m - 1, 3) # allocate the output matrix.
N <- zeros(1, 2 * m - 1)

View file

@ -14,7 +14,6 @@
#' @param COUNTS COUNTS
#' @param SUMCOUNTS SUMCOUNTS
#' @param LOGDIFF LOGDIFF
#' @return changesInLogml
#' @export
writeMixtureInfo <- function(
logml, rowsFromInd, data, adjprior, priorTerm, outPutFile, inputFile, partitionSummary, popnames, fixedK, PARTITION, COUNTS, SUMCOUNTS,
@ -100,7 +99,7 @@ writeMixtureInfo <- function(
while (length(text) > 58) {
# Take one line and display it.
new_line <- takeLine(text, 58)
text <- (length(new_line) + 1):end
text <- (length(new_line) + 1):length(text)
cat(new_line)
if (fid != -1) {
append(fid, new_line)
@ -228,7 +227,7 @@ writeMixtureInfo <- function(
sum(dist2 * log2((dist2 + 10 ^ -10) / (dist1 + 10 ^ -10)))
) / nloci
div <- (div12 + div21) / 2
dist_mat(pop1, pop2) <- div
dist_mat[pop1, pop2] <- div
}
}

View file

@ -4,7 +4,7 @@
\alias{linkage}
\title{Linkage}
\usage{
linkage(Y, method)
linkage(Y, method = "co")
}
\arguments{
\item{Y}{data}

View file

@ -50,9 +50,6 @@ writeMixtureInfo(
\item{LOGDIFF}{LOGDIFF}
}
\value{
changesInLogml
}
\description{
Writes information about the mixture
}