From 3069577ebdc05008320bfc825bd979fa22a26ee5 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Wed, 9 Aug 2023 12:50:29 +0200 Subject: [PATCH] Removing handleData() from greedyMix() (#25) Apparently that function is only used if the input is Genepop or BAPS format. However, its code might be useful for reducing some of the input of greedyMix(), as it contains the calculation for them. --- R/greedyMix.R | 13 ++++--------- R/handleData.R | 7 ++----- man/greedyMix.Rd | 6 +++++- man/handleData.Rd | 4 ++-- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/R/greedyMix.R b/R/greedyMix.R index 0c06935..6fc17ce 100644 --- a/R/greedyMix.R +++ b/R/greedyMix.R @@ -13,17 +13,12 @@ #' data <- system.file("extdata", "FASTA_clustering_haploid.fasta", package = "rBAPS") #' greedyMix(data) greedyMix <- function( - data, format, c.rows, partitionCompare.partitions, ninds, inp, popnames, - fixedK = FALSE, partition_compare = FALSE, verbose = TRUE + data, format, c.rows, partitionCompare.partitions, ninds, rowsFromInd, noalle, + adjprior, priorTerm, alleleCodesinp, popnames, fixedK = FALSE, + partition_compare = FALSE, verbose = TRUE ) { # Importing and handling data ================================================ - raw_data <- importFile(data, format, verbose) - data <- handleData(raw_data) - alleleCodes <- data[["alleleCodes"]] - noalle <- data[["noalle"]] - rowsFromInd <- data[["rowsFromInd"]] - adjprior <- data[["adjprior"]] - priorTerm <- data[["priorTerm"]] + data <- importFile(data, format, verbose) if (partition_compare) { logmls <- comparePartitions( diff --git a/R/handleData.R b/R/handleData.R index 03a6191..636a6e2 100644 --- a/R/handleData.R +++ b/R/handleData.R @@ -1,5 +1,5 @@ #' @title Handle Data -#' @param raw_data Raw data +#' @param raw_data Raw data in Genepop or BAPS format #' @details The last column of the original data tells you from which #' individual that line is from. The function first examines how many line #' maximum is from one individual giving know if it is haploid, diploid, etc. @@ -7,7 +7,7 @@ #' maximum. If the code of an allele is = 0, the function changes that allele #' code to the smallest code that is larger than any code in use. After this, #' the function changes the allele codes so that one locus j -#' codes get values between? 1, ..., Noah (j). +#' codes get values between? 1, ..., noalle(j). handleData <- function(raw_data) { # Alkuper?isen datan viimeinen sarake kertoo, milt?yksil?lt? # kyseinen rivi on per?isin. Funktio tutkii ensin, ett?montako @@ -29,9 +29,6 @@ handleData <- function(raw_data) { dataApu[nollat] <- isoinAlleeli + 1 data[, 1:nloci] <- dataApu } - # dataApu <- [] - # nollat <- [] - # isoinAlleeli <- [] noalle <- zeros(1, nloci) alleelitLokuksessa <- cell(nloci, 1, expandable = TRUE) diff --git a/man/greedyMix.Rd b/man/greedyMix.Rd index 8c78333..d170ab5 100644 --- a/man/greedyMix.Rd +++ b/man/greedyMix.Rd @@ -10,7 +10,11 @@ greedyMix( c.rows, partitionCompare.partitions, ninds, - inp, + rowsFromInd, + noalle, + adjprior, + priorTerm, + alleleCodesinp, popnames, fixedK = FALSE, partition_compare = FALSE, diff --git a/man/handleData.Rd b/man/handleData.Rd index 527cc32..1f72708 100644 --- a/man/handleData.Rd +++ b/man/handleData.Rd @@ -7,7 +7,7 @@ handleData(raw_data) } \arguments{ -\item{raw_data}{Raw data} +\item{raw_data}{Raw data in Genepop or BAPS format} } \description{ Handle Data @@ -20,5 +20,5 @@ After this function. Add blank lines for individuals with fewer rows as maximum. If the code of an allele is = 0, the function changes that allele code to the smallest code that is larger than any code in use. After this, the function changes the allele codes so that one locus j -codes get values between? 1, ..., Noah (j). +codes get values between? 1, ..., noalle(j). }