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 inp = NULL, popnames = NULL, fixedK = FALSE, verbose = FALSE
) { ) {
# Importing and handling data ================================================ # Importing and handling data ================================================
data <- importFile(data, format, verbose) if (tolower(format) %in% "baps") {
data <- handleData(data, tolower(format)) data <- process_BAPS_data(data, NULL)
c <- list( c <- list(
noalle = data[["noalle"]], noalle = data[["noalle"]],
data = data[["newData"]], data = data[["data"]],
adjprior = data[["adjprior"]], adjprior = data[["adjprior"]],
priorTerm = data[["priorTerm"]], priorTerm = data[["priorTerm"]],
rowsFromInd = data[["rowsFromInd"]] 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 ======================================================= # Comparing partitions =======================================================
if (!is.null(partitionCompare)) { if (!is.null(partitionCompare)) {

View file

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