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)] data <- data[, seq_len(ncol(data) - 1)]
# ASK: remove? # ASK: remove?
# h0 = findobj('Tag','filename1_text'); inp = get(h0,'String'); # h0 = findobj('Tag','filename1_text')
# h0 = findobj('Tag','filename2_text'); # inp = get(h0,'String');
# h0 = findobj('Tag','filename2_text')
# outp = get(h0,'String'); # outp = get(h0,'String');
# changesInLogml <- writeMixtureInfo( changesInLogml <- writeMixtureInfo(
# logml, rowsFromInd, data, adjprior, priorTerm, outp, inp, logml, rowsFromInd, data, adjprior, priorTerm, outp, inp,
# popnames, fixedK popnames, fixedK
# ) # TODO translate ) # FIXMEL depends on get function above
# viewMixPartition(PARTITION, popnames) # ASK translate? On graph folder # 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) nrows <- size(data, 1)
ncols <- size(data, 2) ncols <- size(data, 2)
rowsFromInd <- zeros(nind, 1) rowsFromInd <- zeros(nind, 1)
for (i in 1:nind) { for (i in 1:nind) {
rowsFromInd[i] <- length(find(data[, end] == i)) rowsFromInd[i] <- length(find(data[, ncol(data)] == i))
} }
maxRowsFromInd <- max(rowsFromInd) maxRowsFromInd <- max(rowsFromInd)
a <- -999 a <- -999
@ -81,7 +81,7 @@ handleData <- function(raw_data) {
repmat(1 / noalle[j], c(noalle[j], 1)), repmat(1 / noalle[j], c(noalle[j], 1)),
ones(max(noalle) - 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( out <- list(
newData = newData, newData = newData,

View file

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

View file

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

View file

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

View file

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