From d57be6a8f3b8e519cb05abd50f63e0aafd11239c Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Fri, 31 Jul 2020 14:05:40 +0200 Subject: [PATCH] Updated documentation --- NAMESPACE | 3 ++ R/greedyMix.R | 62 +++++++++++++++--------------- man/fgetl.Rd | 2 +- man/fopen.Rd | 2 +- man/linkage.Rd | 7 +++- man/lueNimi.Rd | 2 +- man/min_MATLAB.Rd | 22 +++++++++++ man/rivinSisaltamienMjonojenLkm.Rd | 2 +- man/testaaGenePopData.Rd | 6 +++ man/testaaPop.Rd | 2 +- 10 files changed, 73 insertions(+), 37 deletions(-) create mode 100644 man/min_MATLAB.Rd diff --git a/NAMESPACE b/NAMESPACE index b7d74df..2dd1c5e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,6 +10,8 @@ export(computeIndLogml) export(computePersonalAllFreqs) export(computeRows) export(etsiParas) +export(fgetl) +export(fopen) export(greedyMix) export(handleData) export(initPopNames) @@ -21,6 +23,7 @@ export(linkage) export(logml2String) export(lueGenePopData) export(lueNimi) +export(min_MATLAB) export(noIndex) export(ownNum2Str) export(poistaLiianPienet) diff --git a/R/greedyMix.R b/R/greedyMix.R index 3e02d75..ef91b17 100644 --- a/R/greedyMix.R +++ b/R/greedyMix.R @@ -156,8 +156,7 @@ greedyMix <- function( # h0 = findobj('Tag','filename1_text'); # set(h0,'String',filename); clear h0; - browser()#TEMP - list_dranap <- handleData(data) # FIXME: debug + list_dranap <- handleData(data) data <- list_dranap$newData rowsFromInd <- list_dranap$rowsFromInd alleleCodes <- list_dranap$alleleCodes @@ -253,7 +252,7 @@ greedyMix <- function( POP_LOGML <- vector() clearGlobalVars <- vector() # ========================================================================== - + c <- list() c$data <- data c$noalle <- noalle c$adjprior <- adjprior @@ -267,34 +266,34 @@ greedyMix <- function( c$rows <- c(ekat, ekat + rowsFromInd - 1) # partition compare - if (!is.null(partitionCompare)) { - nsamplingunits <- size(c$rows, 1) - partitions <- partitionCompare$partitions - npartitions <- size(partitions, 2) - partitionLogml <- zeros(1, npartitions) - for (i in seq_len(npartitions)) { - # number of unique partition lables - npops <- length(unique(partitions[, i])) + # if (!is.null(partitionCompare)) { + # nsamplingunits <- size(c$rows, 1) + # partitions <- partitionCompare$partitions + # npartitions <- size(partitions, 2) + # partitionLogml <- zeros(1, npartitions) + # for (i in seq_len(npartitions)) { + # # number of unique partition lables + # npops <- length(unique(partitions[, i])) - partitionInd <- zeros(ninds * rowsFromInd, 1) - partitionSample <- partitions[, i] - for (j in seq_len(nsamplingunits)) { - partitionInd[c$rows[j, 1]:c$rows[j, 2]] <- partitionSample[j] - } - # partitionLogml[i] = initialCounts( - # partitionInd, - # data[, seq_len(end - 1)], - # npops, - # c$rows, - # noalle, - # adjprior - # ) #TODO translate - } - # return the logml result - partitionCompare$logmls <- partitionLogml - # set(h1, 'userdata', partitionCompare) # ASK remove? - return() - } + # partitionInd <- zeros(ninds * rowsFromInd, 1) + # partitionSample <- partitions[, i] + # for (j in seq_len(nsamplingunits)) { + # partitionInd[c$rows[j, 1]:c$rows[j, 2]] <- partitionSample[j] + # } + # # partitionLogml[i] = initialCounts( + # # partitionInd, + # # data[, seq_len(end - 1)], + # # npops, + # # c$rows, + # # noalle, + # # adjprior + # # ) #TODO translate + # } + # # return the logml result + # partitionCompare$logmls <- partitionLogml + # # set(h1, 'userdata', partitionCompare) # ASK remove? + # return() + # } # ASK remove (graphical part)? # if (fixedK) { @@ -312,10 +311,11 @@ greedyMix <- function( # h0 = findobj('Tag','filename2_text') # outp = get(h0,'String'); + browser() # TEMP changesInLogml <- writeMixtureInfo( logml, rowsFromInd, data, adjprior, priorTerm, outp, inp, popnames, fixedK - ) # FIXMEL depends on get function above + ) # FIXME: broken # viewMixPartition(PARTITION, popnames) # ASK translate? On graph folder diff --git a/man/fgetl.Rd b/man/fgetl.Rd index cd49776..be0116b 100644 --- a/man/fgetl.Rd +++ b/man/fgetl.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fgetl.R +% Please edit documentation in R/fgetl-fopen.R \name{fgetl} \alias{fgetl} \title{Read line from file, removing newline characters} diff --git a/man/fopen.Rd b/man/fopen.Rd index 3e2d3a7..e1806eb 100644 --- a/man/fopen.Rd +++ b/man/fopen.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fgetl.R +% Please edit documentation in R/fgetl-fopen.R \name{fopen} \alias{fopen} \title{Open file} diff --git a/man/linkage.Rd b/man/linkage.Rd index 4f75835..5014a8b 100644 --- a/man/linkage.Rd +++ b/man/linkage.Rd @@ -7,7 +7,7 @@ linkage(Y, method = "co") } \arguments{ -\item{Y}{data} +\item{Y}{matrix} \item{method}{either 'si', 'av', 'co' 'ce' or 'wa'} } @@ -19,4 +19,9 @@ Z = LINKAGE(Y) creates a hierarchical cluster tree, using the single linkage algorithm. The input Y is a distance matrix such as is generated by PDIST. Y may also be a more general dissimilarity matrix conforming to the output format of PDIST. + +Z = linkage(X) returns a matrix Z that encodes a tree containing hierarchical clusters of the rows of the input data matrix X. +} +\note{ +This is also a base Matlab function. The reason why the source code is also present here is unclear. } diff --git a/man/lueNimi.Rd b/man/lueNimi.Rd index 74cd665..38b9940 100644 --- a/man/lueNimi.Rd +++ b/man/lueNimi.Rd @@ -13,5 +13,5 @@ lueNimi(line) nimi } \description{ -Reads the line name +Returns the part of the line from the beginning that is before the comma. Useful for returning the name of a GenePop area } diff --git a/man/min_MATLAB.Rd b/man/min_MATLAB.Rd new file mode 100644 index 0000000..9376fed --- /dev/null +++ b/man/min_MATLAB.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/min.R +\name{min_MATLAB} +\alias{min_MATLAB} +\title{Minimum (MATLAB version)} +\usage{ +min_MATLAB(X, indices = TRUE) +} +\arguments{ +\item{X}{matrix} + +\item{indices}{return indices?} +} +\value{ +Either a list or a vector +} +\description{ +Finds the minimum value for each column of a matrix, potentially returning the indices instead +} +\author{ +Waldir Leoncio +} diff --git a/man/rivinSisaltamienMjonojenLkm.Rd b/man/rivinSisaltamienMjonojenLkm.Rd index bb7a547..e9a162c 100644 --- a/man/rivinSisaltamienMjonojenLkm.Rd +++ b/man/rivinSisaltamienMjonojenLkm.Rd @@ -13,5 +13,5 @@ rivinSisaltamienMjonojenLkm(line) count } \description{ -Number of M queues +Returns the number of queues contained in the line. There must be a space between the queues. } diff --git a/man/testaaGenePopData.Rd b/man/testaaGenePopData.Rd index 1f8864d..d711514 100644 --- a/man/testaaGenePopData.Rd +++ b/man/testaaGenePopData.Rd @@ -9,6 +9,12 @@ testaaGenePopData(tiedostonNimi) \arguments{ \item{tiedostonNimi}{Filename} } +\value{ +kunnossa (binary "ok" condition value) == 0 if the data is not valid genePop data. Otherwise, kunnossa == 1. +} \description{ Tests GenePop data } +\details{ +GenePop data are textfiles that follow the GenePop format. This function checks if such file is properly formatted as GenePop. +} diff --git a/man/testaaPop.Rd b/man/testaaPop.Rd index 873dd6a..b83bc9f 100644 --- a/man/testaaPop.Rd +++ b/man/testaaPop.Rd @@ -10,7 +10,7 @@ testaaPop(rivi) \item{rivi}{Line} } \value{ -pal +pal = 1 if the line starts with one of the following } \description{ Test a line in the population