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.
This commit is contained in:
parent
cae1fe4c1e
commit
3069577ebd
4 changed files with 13 additions and 17 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ greedyMix(
|
|||
c.rows,
|
||||
partitionCompare.partitions,
|
||||
ninds,
|
||||
inp,
|
||||
rowsFromInd,
|
||||
noalle,
|
||||
adjprior,
|
||||
priorTerm,
|
||||
alleleCodesinp,
|
||||
popnames,
|
||||
fixedK = FALSE,
|
||||
partition_compare = FALSE,
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue