Improved handling of BAPS format (#24)

This commit is contained in:
Waldir Leoncio 2024-03-25 16:05:00 +01:00
parent f361975254
commit 26ab0107a8
2 changed files with 24 additions and 11 deletions

View file

@ -27,15 +27,30 @@ greedyMix <- function(
inp = NULL, popnames = NULL, fixedK = FALSE, verbose = FALSE
) {
# Importing and handling data ================================================
data <- importFile(data, format, verbose)
data <- handleData(data, tolower(format))
c <- list(
noalle = data[["noalle"]],
data = data[["newData"]],
adjprior = data[["adjprior"]],
priorTerm = data[["priorTerm"]],
rowsFromInd = data[["rowsFromInd"]]
)
if (tolower(format) %in% "baps") {
data <- process_BAPS_data(data, NULL)
c <- list(
noalle = data[["noalle"]],
data = data[["data"]],
adjprior = data[["adjprior"]],
priorTerm = data[["priorTerm"]],
rowsFromInd = data[["rowsFromInd"]],
Z = data[["Z"]],
dist = data[["dist"]]
)
} else {
data <- importFile(data, format, verbose)
data <- handleData(data, tolower(format))
c <- list(
noalle = data[["noalle"]],
data = data[["newData"]],
adjprior = data[["adjprior"]],
priorTerm = data[["priorTerm"]],
rowsFromInd = data[["rowsFromInd"]],
Z = data[["Z"]],
dist = data[["dist"]]
)
}
# Comparing partitions =======================================================
if (!is.null(partitionCompare)) {

View file

@ -42,8 +42,6 @@ importFile <- function(data, format, verbose) {
} else {
out <- adegenet::read.genepop(data)
}
} else if (format == "baps") {
out <- process_BAPS_data(data, NULL)$data
} else {
stop("Format not supported.")
}