Incorporated handleData() on greedyMix() (#25)
This commit is contained in:
parent
f47e13d3a9
commit
3537f18d2c
2 changed files with 20 additions and 25 deletions
|
|
@ -27,28 +27,26 @@
|
||||||
#' data <- system.file("extdata", "FASTA_clustering_haploid.fasta", package = "rBAPS")
|
#' data <- system.file("extdata", "FASTA_clustering_haploid.fasta", package = "rBAPS")
|
||||||
#' greedyMix(data, "fasta")
|
#' greedyMix(data, "fasta")
|
||||||
greedyMix <- function(
|
greedyMix <- function(
|
||||||
data, format, partitionCompare = NULL, ninds = NULL, rowsFromInd = NULL,
|
data, format, partitionCompare = NULL, ninds = NULL, npops = 1L,
|
||||||
noalle = NULL, adjprior = NULL, npops = 1L, priorTerm = NULL, counts = NULL,
|
counts = NULL, sumcounts = NULL, max_iter = 100L, alleleCodes = NULL,
|
||||||
sumcounts = NULL, max_iter = 100L, alleleCodes = NULL, inp = NULL,
|
inp = NULL, popnames = NULL, fixedK = FALSE, verbose = FALSE
|
||||||
popnames = NULL, fixedK = FALSE, verbose = FALSE
|
|
||||||
) {
|
) {
|
||||||
# Importing and handling data ================================================
|
# Importing and handling data ================================================
|
||||||
data <- importFile(data, format, verbose)
|
data <- importFile(data, format, verbose)
|
||||||
|
data <- handleData(data, tolower(format))
|
||||||
c <- list(
|
c <- list(
|
||||||
# TODO: get elements from handleData()?
|
noalle = data[["noalle"]],
|
||||||
noalle = noalle,
|
data = data[["newData"]],
|
||||||
rows = NA,
|
adjprior = data[["adjprior"]],
|
||||||
data = data,
|
priorTerm = data[["priorTerm"]],
|
||||||
adjprior = adjprior,
|
rowsFromInd = data[["rowsFromInd"]]
|
||||||
priorTerm = priorTerm,
|
|
||||||
rowsFromInd = rowsFromInd
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Comparing partitions =======================================================
|
# Comparing partitions =======================================================
|
||||||
if (!is.null(partitionCompare)) {
|
if (!is.null(partitionCompare)) {
|
||||||
logmls <- comparePartitions(
|
logmls <- comparePartitions(
|
||||||
data, nrow(data), partitionCompare[["partitions"]], ninds, rowsFromInd,
|
c[["data"]], nrow(c[["data"]]), partitionCompare[["partitions"]], ninds,
|
||||||
noalle, adjprior
|
c[["rowsFromInd"]], c[["noalle"]], c[["adjprior"]]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,9 +59,9 @@ greedyMix <- function(
|
||||||
|
|
||||||
# Generating output object ===================================================
|
# Generating output object ===================================================
|
||||||
out <- list(
|
out <- list(
|
||||||
"alleleCodes" = alleleCodes, "adjprior" = adjprior, "popnames" = popnames,
|
"alleleCodes" = alleleCodes, "adjprior" = c[["adjprior"]], "popnames" = popnames,
|
||||||
"rowsFromInd" = rowsFromInd, "data" = data, "npops" = npops,
|
"rowsFromInd" = c[["rowsFromInd"]], "data" = data, "npops" = npops,
|
||||||
"noalle" = noalle, "mixtureType" = "mix", "logml" = logml
|
"noalle" = c[["noalle"]], "mixtureType" = "mix", "logml" = logml
|
||||||
)
|
)
|
||||||
if (logml == 1) {
|
if (logml == 1) {
|
||||||
return(out)
|
return(out)
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ greedyMix(
|
||||||
format,
|
format,
|
||||||
partitionCompare = NULL,
|
partitionCompare = NULL,
|
||||||
ninds = NULL,
|
ninds = NULL,
|
||||||
rowsFromInd = NULL,
|
|
||||||
noalle = NULL,
|
|
||||||
adjprior = NULL,
|
|
||||||
npops = 1L,
|
npops = 1L,
|
||||||
priorTerm = NULL,
|
priorTerm = NULL,
|
||||||
counts = NULL,
|
counts = NULL,
|
||||||
|
|
@ -33,12 +30,6 @@ greedyMix(
|
||||||
|
|
||||||
\item{ninds}{number of individuals}
|
\item{ninds}{number of individuals}
|
||||||
|
|
||||||
\item{rowsFromInd}{a list of rows for each individual}
|
|
||||||
|
|
||||||
\item{noalle}{number of alleles}
|
|
||||||
|
|
||||||
\item{adjprior}{ajuster prior probabilities}
|
|
||||||
|
|
||||||
\item{npops}{number of populations}
|
\item{npops}{number of populations}
|
||||||
|
|
||||||
\item{priorTerm}{prior terms}
|
\item{priorTerm}{prior terms}
|
||||||
|
|
@ -58,6 +49,12 @@ greedyMix(
|
||||||
\item{fixedK}{if \code{TRUE}, the number of populations is fixed}
|
\item{fixedK}{if \code{TRUE}, the number of populations is fixed}
|
||||||
|
|
||||||
\item{verbose}{if \code{TRUE}, prints extra output information}
|
\item{verbose}{if \code{TRUE}, prints extra output information}
|
||||||
|
|
||||||
|
\item{rowsFromInd}{a list of rows for each individual}
|
||||||
|
|
||||||
|
\item{noalle}{number of alleles}
|
||||||
|
|
||||||
|
\item{adjprior}{ajuster prior probabilities}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Clustering of individuals
|
Clustering of individuals
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue