From a6308041221bb50f137fe21ff837fd3b8e9c7403 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 09:47:27 +0100 Subject: [PATCH 1/6] Increment version number to 0.0.0.9005 --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 04f7a3f..7379aac 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rBAPS Title: Bayesian Analysis of Population Structure -Version: 0.0.0.9004 +Version: 0.0.0.9005 Date: 2020-11-09 Authors@R: c( @@ -40,4 +40,4 @@ RoxygenNote: 7.1.2 Suggests: testthat (>= 2.1.0) Imports: - methods, ape, vcfR, Rsamtools, adegenet + methods, ape, vcfR, Rsamtools, adegenet, matlab2r From a381fde4bdb50681bde9ef6ffe575b70352a79c4 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 10:08:35 +0100 Subject: [PATCH 2/6] Added rBAPS help file with matlab2r imports (#21) --- R/rBAPS-package.R | 10 ++++++++++ man/rBAPS.Rd | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 R/rBAPS-package.R create mode 100644 man/rBAPS.Rd diff --git a/R/rBAPS-package.R b/R/rBAPS-package.R new file mode 100644 index 0000000..15d7715 --- /dev/null +++ b/R/rBAPS-package.R @@ -0,0 +1,10 @@ +#' @title Bayesian Analysis of Population Structure +#' @description This is a partial implementation of the BAPS software +#' @docType package +#' @name rBAPS +#' @note Found a bug? Want to suggest a feature? Contribute to the scientific +#' and open source communities by opening an issue on our home page. +#' Check the "BugReports" field on the package description for the URL. +#' @importFrom matlab2r blanks cell colon inputdlg isempty isfield isspace max min ones rand repmat reshape size sortrows squeeze strcmp times zeros +#' @importFrom stats runif +NULL diff --git a/man/rBAPS.Rd b/man/rBAPS.Rd new file mode 100644 index 0000000..cd92bd6 --- /dev/null +++ b/man/rBAPS.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rBAPS-package.R +\docType{package} +\name{rBAPS} +\alias{rBAPS} +\title{Bayesian Analysis of Population Structure} +\description{ +This is a partial implementation of the BAPS software +} +\note{ +Found a bug? Want to suggest a feature? Contribute to the scientific +and open source communities by opening an issue on our home page. +Check the "BugReports" field on the package description for the URL. +} From 69ca345f111b4ba6523410bf89b0878dd8b98662 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 10:10:36 +0100 Subject: [PATCH 3/6] Removed docs from matlab2r files (#21) --- NAMESPACE | 33 ++++++++++++++++++------------- R/indMix.R | 36 ++++++++++++++++----------------- R/linkage.R | 4 ++-- man/blanks.Rd | 23 ---------------------- man/cell.Rd | 24 ---------------------- man/colon.Rd | 16 --------------- man/find.Rd | 16 --------------- man/fix.Rd | 17 ---------------- man/inputdlg.Rd | 18 ----------------- man/isempty.Rd | 17 ---------------- man/isfield.Rd | 20 ------------------- man/isspace.Rd | 23 ---------------------- man/matlab2r.Rd | 46 ------------------------------------------- man/max_MATLAB.Rd | 22 --------------------- man/min_MATLAB.Rd | 22 --------------------- man/nargin.Rd | 23 ---------------------- man/ones.Rd | 19 ------------------ man/questdlg.Rd | 29 --------------------------- man/rand.Rd | 19 ------------------ man/repmat.Rd | 29 --------------------------- man/reshape.Rd | 27 ------------------------- man/setdiff_MATLAB.Rd | 21 -------------------- man/size.Rd | 23 ---------------------- man/sortrows.Rd | 16 --------------- man/squeeze.Rd | 33 ------------------------------- man/strcmp.Rd | 19 ------------------ man/times.Rd | 22 --------------------- man/uigetfile.Rd | 20 ------------------- man/uiputfile.Rd | 17 ---------------- man/zeros.Rd | 19 ------------------ man/zeros_or_ones.Rd | 27 ------------------------- 31 files changed, 39 insertions(+), 661 deletions(-) delete mode 100644 man/blanks.Rd delete mode 100644 man/cell.Rd delete mode 100644 man/colon.Rd delete mode 100644 man/find.Rd delete mode 100644 man/fix.Rd delete mode 100644 man/inputdlg.Rd delete mode 100644 man/isempty.Rd delete mode 100644 man/isfield.Rd delete mode 100644 man/isspace.Rd delete mode 100644 man/matlab2r.Rd delete mode 100644 man/max_MATLAB.Rd delete mode 100644 man/min_MATLAB.Rd delete mode 100644 man/nargin.Rd delete mode 100644 man/ones.Rd delete mode 100644 man/questdlg.Rd delete mode 100644 man/rand.Rd delete mode 100644 man/repmat.Rd delete mode 100644 man/reshape.Rd delete mode 100644 man/setdiff_MATLAB.Rd delete mode 100644 man/size.Rd delete mode 100644 man/sortrows.Rd delete mode 100644 man/squeeze.Rd delete mode 100644 man/strcmp.Rd delete mode 100644 man/times.Rd delete mode 100644 man/uigetfile.Rd delete mode 100644 man/uiputfile.Rd delete mode 100644 man/zeros.Rd delete mode 100644 man/zeros_or_ones.Rd diff --git a/NAMESPACE b/NAMESPACE index 8b111c8..a25eea6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,9 +2,7 @@ export(addAlleles) export(admix1) -export(blanks) export(calculatePopLogml) -export(colon) export(computeAllFreqs2) export(computeIndLogml) export(computePersonalAllFreqs) @@ -15,8 +13,6 @@ export(fopen) export(greedyMix) export(handleData) export(initPopNames) -export(inputdlg) -export(isfield) export(laskeMuutokset4) export(learn_partition_modified) export(learn_simple_partition) @@ -25,29 +21,20 @@ export(load_fasta) export(logml2String) export(lueGenePopData) export(lueNimi) -export(matlab2r) export(noIndex) export(ownNum2Str) export(poistaLiianPienet) export(proportion2str) -export(questdlg) -export(rand) export(randdir) -export(repmat) export(rivinSisaltamienMjonojenLkm) export(selvitaDigitFormat) export(simulateAllFreqs) export(simulateIndividuals) export(simuloiAlleeli) -export(size) -export(strcmp) export(suoritaMuutos) export(takeLine) export(testaaOnkoKunnollinenBapsData) export(testaaPop) -export(times) -export(uigetfile) -export(uiputfile) export(writeMixtureInfo) import(utils) importFrom(Rsamtools,scanBam) @@ -55,9 +42,27 @@ importFrom(adegenet,.readExt) importFrom(adegenet,read.genepop) importFrom(ape,as.DNAbin) importFrom(ape,read.FASTA) +importFrom(matlab2r,blanks) +importFrom(matlab2r,cell) +importFrom(matlab2r,colon) +importFrom(matlab2r,inputdlg) +importFrom(matlab2r,isempty) +importFrom(matlab2r,isfield) +importFrom(matlab2r,isspace) +importFrom(matlab2r,max) +importFrom(matlab2r,min) +importFrom(matlab2r,ones) +importFrom(matlab2r,rand) +importFrom(matlab2r,repmat) +importFrom(matlab2r,reshape) +importFrom(matlab2r,size) +importFrom(matlab2r,sortrows) +importFrom(matlab2r,squeeze) +importFrom(matlab2r,strcmp) +importFrom(matlab2r,times) +importFrom(matlab2r,zeros) importFrom(methods,is) importFrom(stats,runif) importFrom(stats,sd) importFrom(utils,read.delim) -importFrom(utils,write.table) importFrom(vcfR,read.vcfR) diff --git a/R/indMix.R b/R/indMix.R index 922b764..6040e87 100644 --- a/R/indMix.R +++ b/R/indMix.R @@ -150,8 +150,8 @@ indMix <- function(c, npops, dispText = TRUE) { diffInCounts <- muutokset_diffInCounts$diffInCounts if (round == 1) { - maxMuutos <- max_MATLAB(muutokset)$max - i2 <- max_MATLAB(muutokset)$idx + maxMuutos <- matlab2r::max(muutokset)$max + i2 <- matlab2r::max(muutokset)$idx } if (i1 != i2 & maxMuutos > 1e-5) { @@ -174,7 +174,7 @@ indMix <- function(c, npops, dispText = TRUE) { partitionSummary <- temp_addToSum$partitionSummary added <- temp_addToSum$added if (added == 1) { - temp_minMATLAB <- min_MATLAB( + temp_minMATLAB <- matlab2r::min( partitionSummary[, 2] ) worstLogml <- temp_minMATLAB$mins @@ -195,8 +195,8 @@ indMix <- function(c, npops, dispText = TRUE) { ) muutokset <- muutokset_diffInCounts$muutokset diffInCounts <- muutokset_diffInCounts$diffInCounts - isoin <- max_MATLAB(muutokset)[[1]] - indeksi <- max_MATLAB(muutokset)[[2]] + isoin <- matlab2r::max(muutokset)[[1]] + indeksi <- matlab2r::max(muutokset)[[2]] if (isoin > maxMuutos) { maxMuutos <- isoin i1 <- pop @@ -222,8 +222,8 @@ indMix <- function(c, npops, dispText = TRUE) { partitionSummary <- temp_addToSum$partitionSummary added <- temp_addToSum$added if (added == 1) { - worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]] - worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]] + worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]] + worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]] } } } else { @@ -247,8 +247,8 @@ indMix <- function(c, npops, dispText = TRUE) { muutokset <- laskeMuutokset3( T2, inds2, rows, data, adjprior, priorTerm, pop ) - isoin <- max_MATLAB(muutokset)[[1]] - indeksi <- max_MATLAB(muutokset)[[2]] + isoin <- matlab2r::max(muutokset)[[1]] + indeksi <- matlab2r::max(muutokset)[[2]] if (isoin > maxMuutos) { maxMuutos <- isoin muuttuvaPop2 <- indeksi %% npops2 @@ -289,8 +289,8 @@ indMix <- function(c, npops, dispText = TRUE) { partitionSummary <- temp_addToSum$partitionSummary added <- temp_addToSum$added if (added == 1) { - worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]] - worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]] + worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]] + worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]] } } } else { @@ -334,8 +334,8 @@ indMix <- function(c, npops, dispText = TRUE) { diffInCounts <- muutokset_diffInCounts$diffInCounts muutokset[pop] <- -1e50 # Varmasti ei suurin!!! - maxMuutos <- max_MATLAB(muutokset)[[1]] - i2 <- max_MATLAB(muutokset)[[2]] + maxMuutos <- matlab2r::max(muutokset)[[1]] + i2 <- matlab2r::max(muutokset)[[2]] updateGlobalVariables( ind, i2, diffInCounts, adjprior, priorTerm ) @@ -370,8 +370,8 @@ indMix <- function(c, npops, dispText = TRUE) { partitionSummary <- temp_addToSum$partitionSummary added <- temp_addToSum$added if (added == 1) { - worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]] - worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]] + worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]] + worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]] } } } else { @@ -441,7 +441,7 @@ indMix <- function(c, npops, dispText = TRUE) { pop, emptyPop ) - maxMuutos <- indeksi <- max_MATLAB(muutokset) + maxMuutos <- indeksi <- matlab2r::max(muutokset) muuttuva <- inds2(indeksi) if (PARTITION(muuttuva) == pop) { @@ -474,8 +474,8 @@ indMix <- function(c, npops, dispText = TRUE) { partitionSummary <- temp_addToSum$partitionSummary added <- temp_addToSum$added if (added == 1) { - worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]] - worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]] + worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]] + worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]] } } if (muutoksiaNyt == 0) { diff --git a/R/linkage.R b/R/linkage.R index fdd1e6d..d06c4be 100644 --- a/R/linkage.R +++ b/R/linkage.R @@ -31,8 +31,8 @@ linkage <- function(Y, method = "co") { for (s in 1:(n - 1)) { X <- as.matrix(as.vector(Y), ncol = 1) - v <- min_MATLAB(X)$mins - k <- min_MATLAB(X)$idx + v <- matlab2r::min(X)$mins + k <- matlab2r::min(X)$idx i <- floor(m + 1 / 2 - sqrt(m^2 - m + 1 / 4 - 2 * (k - 1))) j <- k - (i - 1) * (m - i / 2) + i diff --git a/man/blanks.Rd b/man/blanks.Rd deleted file mode 100644 index 87471f4..0000000 --- a/man/blanks.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/blanks.R -\name{blanks} -\alias{blanks} -\title{Blanks} -\usage{ -blanks(n) -} -\arguments{ -\item{n}{length of vector} -} -\value{ -Vector of n blanks -} -\description{ -Create character vector of blanks -} -\details{ -This function emulates the behavior of a homonimous function from Matlab -} -\author{ -Waldir Leoncio -} diff --git a/man/cell.Rd b/man/cell.Rd deleted file mode 100644 index 4b1b3ac..0000000 --- a/man/cell.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/cell.R -\name{cell} -\alias{cell} -\title{Cell array} -\usage{ -cell(n, sz = c(n, n), expandable = FALSE, ...) -} -\arguments{ -\item{n}{a the first dimension (or both, if sz is not passed)} - -\item{sz}{the second dimension (or 1st and 2nd, if not passed)} - -\item{expandable}{if TRUE, output is a list (so it can take different -lengths)} - -\item{...}{Other dimensions} -} -\value{ -An array of zeroes with the dimensions passed on call -} -\description{ -Creates an array of zeros -} diff --git a/man/colon.Rd b/man/colon.Rd deleted file mode 100644 index 4ae3857..0000000 --- a/man/colon.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colon.R -\name{colon} -\alias{colon} -\title{Vector creation} -\usage{ -colon(a, b) -} -\arguments{ -\item{a}{initial number} - -\item{b}{final number} -} -\description{ -Simulates the function `colon()` and its equivalent `:` operator from Matlab, which have a similar but not quite equivalent behavior when compared to `seq()` and `:` in R. -} diff --git a/man/find.Rd b/man/find.Rd deleted file mode 100644 index e429d07..0000000 --- a/man/find.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/find.R -\name{find} -\alias{find} -\title{Find indices and values of nonzero elements} -\usage{ -find(x, sort = TRUE) -} -\arguments{ -\item{x}{object or logic operation on an object} - -\item{sort}{sort output?} -} -\description{ -Emulates behavior of `find` -} diff --git a/man/fix.Rd b/man/fix.Rd deleted file mode 100644 index 91b4678..0000000 --- a/man/fix.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fix.R -\name{fix} -\alias{fix} -\title{Round toward zero} -\usage{ -fix(X) -} -\arguments{ -\item{X}{input element} -} -\description{ -Rounds each element of input to the nearest integer towards zero. Basically the same as trunc() -} -\author{ -Waldir Leoncio -} diff --git a/man/inputdlg.Rd b/man/inputdlg.Rd deleted file mode 100644 index 48c3e4c..0000000 --- a/man/inputdlg.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/inputdlg.R -\name{inputdlg} -\alias{inputdlg} -\title{Gather user input} -\usage{ -inputdlg(prompt, dims = 1, definput = NULL) -} -\arguments{ -\item{prompt}{Text field with user instructions} - -\item{dims}{number of dimensions in the answwers} - -\item{definput}{default value of the input} -} -\description{ -Replicates the functionality of the homonymous function in Matlab (sans dialog box) -} diff --git a/man/isempty.Rd b/man/isempty.Rd deleted file mode 100644 index e4ddc43..0000000 --- a/man/isempty.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/isempty.R -\name{isempty} -\alias{isempty} -\title{Is Array Empty?} -\usage{ -isempty(x) -} -\arguments{ -\item{x}{array} -} -\description{ -Determine whether array is empty. An empty array, table, or timetable has at least one dimension with length 0, such as 0-by-0 or 0-by-5. -} -\details{ -Emulates the behavior of the `isempty` function on Matlab -} diff --git a/man/isfield.Rd b/man/isfield.Rd deleted file mode 100644 index a3ccd17..0000000 --- a/man/isfield.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/isfield.R -\name{isfield} -\alias{isfield} -\title{Checks if a list contains a field} -\usage{ -isfield(x, field) -} -\arguments{ -\item{x}{list} - -\item{field}{name of field} -} -\description{ -This function tries to replicate the behavior of the `isfield` -function in Matlab -} -\references{ -https://se.mathworks.com/help/matlab/ref/isfield.html -} diff --git a/man/isspace.Rd b/man/isspace.Rd deleted file mode 100644 index fba4844..0000000 --- a/man/isspace.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/isspace.R -\name{isspace} -\alias{isspace} -\title{Determine space characters} -\usage{ -isspace(A) -} -\arguments{ -\item{A}{a character array or a string scalar} -} -\value{ -a vector TF such that the elements of TF are logical 1 (true) where corresponding characters in A are space characters, and logical 0 (false) elsewhere -} -\description{ -Determine which characters are space characters -} -\note{ -Recognized whitespace characters are ` ` and `\\t`. -} -\author{ -Waldir Leoncio -} diff --git a/man/matlab2r.Rd b/man/matlab2r.Rd deleted file mode 100644 index e809709..0000000 --- a/man/matlab2r.Rd +++ /dev/null @@ -1,46 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/matlab2r.R -\name{matlab2r} -\alias{matlab2r} -\title{Convert Matlab function to R} -\usage{ -matlab2r( - filename, - output = "diff", - improve_formatting = TRUE, - change_assignment = TRUE, - append = FALSE -) -} -\arguments{ -\item{filename}{name of the file} - -\item{output}{can be "asis", "clean", "save" or "diff"} - -\item{improve_formatting}{if `TRUE` (default), makes minor changes -to conform to best-practice formatting conventions} - -\item{change_assignment}{if `TRUE` (default), uses `<-` as the assignment operator} - -\item{append}{if `FALSE` (default), overwrites file; otherwise, append -output to input} -} -\value{ -text converted to R, printed to screen or replacing input file -} -\description{ -Performs basic syntax conversion from Matlab to R -} -\note{ -This function is intended to expedite the process of converting a -Matlab function to R by making common replacements. It does not have the -immediate goal of outputting a ready-to-use function. In other words, -after using this function you should go back to it and make minor changes. - -It is also advised to do a dry-run with `output = "clean"` and only switching -to `output = "save"` when you are confident that no important code will be -lost (for shorter functions, a careful visual inspection should suffice). -} -\author{ -Waldir Leoncio -} diff --git a/man/max_MATLAB.Rd b/man/max_MATLAB.Rd deleted file mode 100644 index d7fbdf7..0000000 --- a/man/max_MATLAB.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/min_max_MATLAB.R -\name{max_MATLAB} -\alias{max_MATLAB} -\title{Maximum (MATLAB version)} -\usage{ -max_MATLAB(X, indices = TRUE) -} -\arguments{ -\item{X}{matrix} - -\item{indices}{return indices?} -} -\value{ -Either a list or a vector -} -\description{ -Finds the minimum value for each column of a matrix, potentially returning the indices instead -} -\author{ -Waldir Leoncio -} diff --git a/man/min_MATLAB.Rd b/man/min_MATLAB.Rd deleted file mode 100644 index 9825e90..0000000 --- a/man/min_MATLAB.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/min_max_MATLAB.R -\name{min_MATLAB} -\alias{min_MATLAB} -\title{Minimum (MATLAB version)} -\usage{ -min_MATLAB(X, indices = TRUE) -} -\arguments{ -\item{X}{matrix} - -\item{indices}{return indices?} -} -\value{ -Either a list or a vector -} -\description{ -Finds the minimum value for each column of a matrix, potentially returning the indices instead -} -\author{ -Waldir Leoncio -} diff --git a/man/nargin.Rd b/man/nargin.Rd deleted file mode 100644 index a7922a6..0000000 --- a/man/nargin.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nargin.R -\name{nargin} -\alias{nargin} -\title{Number of function input arguments} -\usage{ -nargin() -} -\value{ -An integer -} -\description{ -Returns the number of arguments passed to the parent function -} -\note{ -This function only makes sense inside another function -} -\references{ -https://stackoverflow.com/q/64422780/1169233 -} -\author{ -Waldir Leoncio -} diff --git a/man/ones.Rd b/man/ones.Rd deleted file mode 100644 index 76f3f4a..0000000 --- a/man/ones.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/zeros_ones.R -\name{ones} -\alias{ones} -\title{Matrix of ones} -\usage{ -ones(n1, n2 = n1, ...) -} -\arguments{ -\item{n1}{number of rows} - -\item{n2}{number of columns} - -\item{...}{extra dimensions} -} -\description{ -wrapper of `zeros_or_ones()` that replicates the behavior of -the `ones()` function on Matlab -} diff --git a/man/questdlg.Rd b/man/questdlg.Rd deleted file mode 100644 index e4f5fa9..0000000 --- a/man/questdlg.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/questdlg.R -\name{questdlg} -\alias{questdlg} -\title{Prompt for multiple-choice} -\usage{ -questdlg( - quest, - dlgtitle = "", - btn = c("y", "n"), - defbtn = "n", - accepted_ans = c("y", "yes", "n", "no") -) -} -\arguments{ -\item{quest}{Question} - -\item{dlgtitle}{Title of question} - -\item{btn}{Vector of alternatives} - -\item{defbtn}{Scalar with the name of the default option} - -\item{accepted_ans}{Vector containing accepted answers} -} -\description{ -This function aims to loosely mimic the behavior of the -questdlg function on Matlab -} diff --git a/man/rand.Rd b/man/rand.Rd deleted file mode 100644 index 131a43c..0000000 --- a/man/rand.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rand.R -\name{rand} -\alias{rand} -\title{Generate matrix with U(0, 1) trials} -\usage{ -rand(r = 1, c = 1) -} -\arguments{ -\item{r}{number of rows of output matrix} - -\item{c}{number of columns of output matrix} -} -\value{ -\eqn{r \times c} matrix with random trials from a standard uniform distribution. -} -\description{ -Imitates the behavior of `rand()` on Matlab -} diff --git a/man/repmat.Rd b/man/repmat.Rd deleted file mode 100644 index 0fbaa6e..0000000 --- a/man/repmat.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/repmat.R -\name{repmat} -\alias{repmat} -\title{Repeat matrix} -\usage{ -repmat(mx, n) -} -\arguments{ -\item{mx}{matrix} - -\item{n}{either a scalar with the number of replications in both rows and -columns or a <= 3-length vector with individual repetitions.} -} -\value{ -matrix replicated over `ncol(mx) * n` columns and `nrow(mx) * n` rows -} -\description{ -Repeats a matrix over n columns and rows -} -\details{ -This function was created to replicate the behavior of a homonymous -function on Matlab -} -\note{ -The Matlab implementation of this function accepts `n` with length > 2. - -It should also be noted that a concatenated vector in R, e.g. `c(5, 2)`, becomes a column vector when coerced to matrix, even though it may look like a row vector at first glance. This is important to keep in mind when considering the expected output of this function. Vectors in R make sense to be seen as column vectors, given R's Statistics-oriented paradigm where variables are usually disposed as columns in a dataset. -} diff --git a/man/reshape.Rd b/man/reshape.Rd deleted file mode 100644 index 39d74f9..0000000 --- a/man/reshape.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reshape.R -\name{reshape} -\alias{reshape} -\title{Reshape array} -\usage{ -reshape(A, sz) -} -\arguments{ -\item{A}{input matrix} - -\item{sz}{vector containing the dimensions of the output vector} -} -\description{ -Reshapes a matrix according to a certain number of dimensions -} -\details{ -This function replicates the functionality of the `reshape()` -function on Matlab. This function is basically a fancy wrapper for the -`array()` function in R, but is useful because it saves the user translation -time. Moreover, it introduces validation code that alter the behavior of -`array()` and makes it more similar to `replicate()`. -} -\note{ -The Matlab function also accepts as input the dismemberment of sz as -scalars. -} diff --git a/man/setdiff_MATLAB.Rd b/man/setdiff_MATLAB.Rd deleted file mode 100644 index dcc6c00..0000000 --- a/man/setdiff_MATLAB.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/setdiff_MATLAB.R -\name{setdiff_MATLAB} -\alias{setdiff_MATLAB} -\title{Set differences of two arrays} -\usage{ -setdiff_MATLAB(A, B, legacy = FALSE) -} -\arguments{ -\item{A}{first array} - -\item{B}{second array} - -\item{legacy}{if `TRUE`, preserves the behavior of the setdiff function from MATLAB R2012b and prior releases. (currently not supported)} -} -\description{ -Loosely replicates the behavior of the homonym Matlab function -} -\author{ -Waldir Leoncio -} diff --git a/man/size.Rd b/man/size.Rd deleted file mode 100644 index 3fe1893..0000000 --- a/man/size.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/size.R -\name{size} -\alias{size} -\title{Size of an object} -\usage{ -size(x, d) -} -\arguments{ -\item{x}{object to be evaluated} - -\item{d}{dimension of object to be evaluated} -} -\description{ -This functions tries to replicate the behavior of the base function "size" in Matlab -} -\note{ -On MATLAB, size(1, 100) returns 1. As a matter of fact, if the user -calls for a dimension which x doesn't have `size()` always returns 1. R's -default behavior is more reasonable in those cases (i.e., returning NA), -but since the point of this function is to replicate MATLAB behaviors -(bugs and questionable behaviors included), this function also does this. -} diff --git a/man/sortrows.Rd b/man/sortrows.Rd deleted file mode 100644 index 9680899..0000000 --- a/man/sortrows.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sortrows.R -\name{sortrows} -\alias{sortrows} -\title{Sort rows of matrix or table} -\usage{ -sortrows(A, column = 1) -} -\arguments{ -\item{A}{matrix} - -\item{column}{ordering column} -} -\description{ -Emulates the behavior of the `sortrows` function on Matlab -} diff --git a/man/squeeze.Rd b/man/squeeze.Rd deleted file mode 100644 index 6191ee4..0000000 --- a/man/squeeze.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/squeeze.R -\name{squeeze} -\alias{squeeze} -\title{Squeeze} -\usage{ -squeeze(A) -} -\arguments{ -\item{A}{input or array matrix} -} -\value{ -An array with the same elements as the input array, but with -dimensions of length 1 removed. -} -\description{ -Remove dimensions of length 1 -} -\details{ -This function implements the behavior of the homonimous function on -Matlab. `B = squeeze(A)` returns an array with the same elements as the -input array A, but with dimensions of length 1 removed. For example, if A is -a 3-by-1-by-1-by-2 array, then squeeze(A) returns a 3-by-2 matrix. If A is a -row vector, column vector, scalar, or an array with no dimensions of length -1, then squeeze returns the input A. -} -\note{ -This is basically a wrapper of drop() with a minor adjustment to adapt -the output to what happens on Matlab -} -\author{ -Waldir Leoncio -} diff --git a/man/strcmp.Rd b/man/strcmp.Rd deleted file mode 100644 index b832fa9..0000000 --- a/man/strcmp.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/strcmp.R -\name{strcmp} -\alias{strcmp} -\title{Compare two character elements} -\usage{ -strcmp(s1, s2) -} -\arguments{ -\item{s1}{first character element (string, vector or matrix)} - -\item{s2}{second character element (string, vector or matrix)} -} -\value{ -a logical element of the same type as the input -} -\description{ -Logical test if two character elements are identical -} diff --git a/man/times.Rd b/man/times.Rd deleted file mode 100644 index a52d264..0000000 --- a/man/times.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/times.R -\name{times} -\alias{times} -\title{Element-wise matrix multiplication} -\usage{ -times(a, b) -} -\arguments{ -\item{a}{first factor of the multiplication} - -\item{b}{second factor of the multiplication} -} -\value{ -matrix with dimensions equal to the larger of the two factors -} -\description{ -Emulates the `times()` and `.*` operators from Matlab. -} -\details{ -This function basically handles elements of different length better than the `*` operator in R, at least as far as behavior from a Matlab user is expecting. -} diff --git a/man/uigetfile.Rd b/man/uigetfile.Rd deleted file mode 100644 index 21594ba..0000000 --- a/man/uigetfile.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/uigetfile.R -\name{uigetfile} -\alias{uigetfile} -\title{Select a file for loading} -\usage{ -uigetfile(filter = "", title = "") -} -\arguments{ -\item{filter}{Filter listed files} - -\item{title}{Pre-prompt message} -} -\description{ -Loosely mimics the functionality of the `uigetfile` function on -Matlab. -} -\references{ -https://se.mathworks.com/help/matlab/ref/uigetfile.html -} diff --git a/man/uiputfile.Rd b/man/uiputfile.Rd deleted file mode 100644 index 7b37f76..0000000 --- a/man/uiputfile.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/uiputfile.R -\name{uiputfile} -\alias{uiputfile} -\title{Save file} -\usage{ -uiputfile(filter = ".rda", title = "Save file") -} -\arguments{ -\item{filter}{accepted file extension} - -\item{title}{Title} -} -\description{ -This function intends to loosely mimic the behaviour of the -homonymous Matlab function. -} diff --git a/man/zeros.Rd b/man/zeros.Rd deleted file mode 100644 index c027e24..0000000 --- a/man/zeros.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/zeros_ones.R -\name{zeros} -\alias{zeros} -\title{Matrix of zeros} -\usage{ -zeros(n1, n2 = n1, ...) -} -\arguments{ -\item{n1}{number of rows} - -\item{n2}{number of columns} - -\item{...}{extra dimensions} -} -\description{ -wrapper of `zeros_or_ones()` that replicates the behavior of -the `zeros()` function on Matlab -} diff --git a/man/zeros_or_ones.Rd b/man/zeros_or_ones.Rd deleted file mode 100644 index a9ec7f7..0000000 --- a/man/zeros_or_ones.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/zeros_ones.R -\name{zeros_or_ones} -\alias{zeros_or_ones} -\title{Matrix of zeros or ones} -\usage{ -zeros_or_ones(n, x) -} -\arguments{ -\item{n}{scalar or 2D vector} - -\item{x}{value to fill matrix with} -} -\value{ -n-by-n matrix filled with `x` -} -\description{ -Generates a square or rectangular matrix of zeros or ones -} -\details{ -This is a wrapper function to replicate the behavior of the -`zeros()` and the `ones()` functions on Matlab -} -\note{ -Actually works for any `x`, but there's no need to bother imposing -validation controls here. -} From b872760f813065f99493170510025150bf572d24 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 10:29:32 +0100 Subject: [PATCH 4/6] Fixed linkage function --- R/linkage.R | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/R/linkage.R b/R/linkage.R index d06c4be..37dddce 100644 --- a/R/linkage.R +++ b/R/linkage.R @@ -8,17 +8,19 @@ #' Z = linkage(X) returns a matrix Z that encodes a tree containing hierarchical clusters of the rows of the input data matrix X. #' @param Y matrix #' @param method either 'si', 'av', 'co' 'ce' or 'wa' -#' @note This is also a base Matlab function. The reason why the source code is also present here is unclear. +#' @note This is also a base MATLAB function. The reason why the BAPS +#' source code also contains a LINKAGE function is unclear. One could speculate +#' that BAPS should use this function instead of the base one, so this is why +#' this function is part of this package (instead of a MATLAB-replicating +#' package such as matlab2r) #' @export linkage <- function(Y, method = "co") { - # TODO: compare R output with MATLAB output k <- size(Y)[1] n <- size(Y)[2] m <- (1 + sqrt(1 + 8 * n)) / 2 if ((k != 1) | (m != trunc(m))) { stop( - "The first input has to match the output", - "of the PDIST function in size." + "The first input has to match the output of the PDIST function in size." ) } method <- tolower(substr(method, 1, 2)) # simplify the switch string. @@ -30,7 +32,6 @@ linkage <- function(Y, method = "co") { R <- 1:n for (s in 1:(n - 1)) { X <- as.matrix(as.vector(Y), ncol = 1) - v <- matlab2r::min(X)$mins k <- matlab2r::min(X)$idx @@ -70,9 +71,9 @@ linkage <- function(Y, method = "co") { # I <- I[I > 0 & I <= length(Y)] # J <- J[J > 0 & J <= length(Y)] switch(method, - "si" = Y[I] <- apply(cbind(Y[I], Y[J]), 1, min), # single linkage + "si" = Y[I] <- apply(cbind(Y[I], Y[J]), 1, base::min), # single linkage "av" = Y[I] <- Y[I] + Y[J], # average linkage - "co" = Y[I] <- apply(cbind(Y[I], Y[J]), 1, max), # complete linkage + "co" = Y[I] <- apply(cbind(Y[I], Y[J]), 1, base::max), # complete linkage "ce" = { K <- N[R[i]] + N[R[j]] # centroid linkage Y[I] <- (N[R[i]] * Y[I] + N[R[j]] * Y[J] - From 9ad4fa8c76e00fede0058c327564c9800432c7cc Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 10:43:34 +0100 Subject: [PATCH 5/6] Resolved conflicts involving homonymous functions --- NAMESPACE | 2 +- R/addToSummary.R | 2 +- R/admix1.R | 24 ++++++++++++------------ R/admixture_initialization.R | 4 ++-- R/arvoSeuraavaTi.R | 2 +- R/computeDiffInCounts.R | 2 +- R/computeLogml.R | 4 ++-- R/etsiParas.R | 8 ++++---- R/findEmptyPop.R | 2 +- R/getDistances.R | 12 ++++++------ R/globals.R | 2 -- R/handleData.R | 24 ++++++++++++------------ R/indMix.R | 14 +++++++------- R/initialCounts.R | 8 ++++---- R/initialPopCounts.R | 6 +++--- R/laskeMuutokset12345.R | 8 ++++---- R/learn_partition_modified.R | 6 +++--- R/newGetDistances.R | 10 +++++----- R/poistaTyhjatPopulaatiot.R | 4 ++-- R/rBAPS-package.R | 2 +- R/rand_disc.R | 2 +- R/simuloiAlleeli.R | 2 +- R/testaaOnkoKunnollinenBapsData.R | 2 +- R/updateGlobalVariables.R | 8 ++++---- R/writeMixtureInfo.R | 16 ++++++++-------- man/linkage.Rd | 6 +++++- 26 files changed, 92 insertions(+), 90 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index a25eea6..73534fe 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -36,7 +36,6 @@ export(takeLine) export(testaaOnkoKunnollinenBapsData) export(testaaPop) export(writeMixtureInfo) -import(utils) importFrom(Rsamtools,scanBam) importFrom(adegenet,.readExt) importFrom(adegenet,read.genepop) @@ -45,6 +44,7 @@ importFrom(ape,read.FASTA) importFrom(matlab2r,blanks) importFrom(matlab2r,cell) importFrom(matlab2r,colon) +importFrom(matlab2r,find) importFrom(matlab2r,inputdlg) importFrom(matlab2r,isempty) importFrom(matlab2r,isfield) diff --git a/R/addToSummary.R b/R/addToSummary.R index a1861d8..b1ee36e 100644 --- a/R/addToSummary.R +++ b/R/addToSummary.R @@ -4,7 +4,7 @@ addToSummary <- function(logml, partitionSummary, worstIndex) { # annettua logml arvoa, niin lis�t��n worstIndex:in kohtaan uusi logml ja # nykyist� partitiota vastaava nclusters:in arvo. Muutoin ei tehd� mit��n. - apu <- find(abs(partitionSummary[, 2] - logml) < 1e-5) + apu <- matlab2r::find(abs(partitionSummary[, 2] - logml) < 1e-5) if (isempty(apu)) { # Nyt l�ydetty partitio ei ole viel� kirjattuna summaryyn. npops <- length(unique(PARTITION)) diff --git a/R/admix1.R b/R/admix1.R index fb59911..e3f1491 100644 --- a/R/admix1.R +++ b/R/admix1.R @@ -130,8 +130,8 @@ admix1 <- function(tietue) { osuusTaulu[q] <- 1 arvot[q] <- computeIndLogml(omaFreqs, osuusTaulu) } - iso_arvo <- max(arvot) - isoimman_indeksi <- match(max(arvot), arvot) + iso_arvo <- base::max(arvot) + isoimman_indeksi <- match(base::max(arvot), arvot) osuusTaulu <- zeros(1, npops) osuusTaulu[isoimman_indeksi] <- 1 PARTITION[ind] <- isoimman_indeksi @@ -149,7 +149,7 @@ admix1 <- function(tietue) { } # Analyze further only individuals who have log-likelihood ratio larger than 3: - to_investigate <- t(find(likelihood > 3)) + to_investigate <- t(matlab2r::find(likelihood > 3)) cat("Possibly admixed individuals:\n") for (i in 1:length(to_investigate)) { cat(as.character(to_investigate[i])) @@ -200,8 +200,8 @@ admix1 <- function(tietue) { osuusTaulu[q] <- 1 arvot[q] <- computeIndLogml(omaFreqs, osuusTaulu) } - iso_arvo <- max(arvot) - isoimman_indeksi <- match(max(arvot), arvot) + iso_arvo <- base::max(arvot) + isoimman_indeksi <- match(base::max(arvot), arvot) osuusTaulu <- zeros(1, npops) osuusTaulu[isoimman_indeksi] <- 1 PARTITION[ind] <- isoimman_indeksi @@ -233,13 +233,13 @@ admix1 <- function(tietue) { missing_levels <- zeros(npops, 3) # the mean values for different levels. missing_level_partition <- zeros(ninds, 1) # level of each individual (one of the levels of its population). for (i in 1:npops) { - inds <- find(PARTITION == i) + inds <- matlab2r::find(PARTITION == i) # Proportions of non-missing data for the individuals: non_missing_data <- zeros(length(inds), 1) for (j in 1:length(inds)) { ind <- inds[j] non_missing_data[j] <- length( - find(data[(ind - 1) * rowsFromInd + 1:ind * rowsFromInd, ] > 0) + matlab2r::find(data[(ind - 1) * rowsFromInd + 1:ind * rowsFromInd, ] > 0) ) / (rowsFromInd * nloci) } if (all(non_missing_data > 0.9)) { @@ -258,7 +258,7 @@ admix1 <- function(tietue) { n_levels <- length(unique(part)) n_missing_levels[i] <- n_levels for (j in 1:n_levels) { - missing_levels[i, j] <- mean(non_missing_data[find(part == j)]) + missing_levels[i, j] <- mean(non_missing_data[matlab2r::find(part == j)]) } } } @@ -269,7 +269,7 @@ admix1 <- function(tietue) { for (pop in t(admix_populaatiot)) { for (level in 1:n_missing_levels[pop]) { potential_inds_in_this_pop_and_level <- - find( + matlab2r::find( PARTITION == pop & missing_level_partition == level & likelihood > 3 ) # Potential admix individuals here. @@ -338,8 +338,8 @@ admix1 <- function(tietue) { # In case of a rounding error, the sum is made equal to unity by # fixing the largest value. if ((PARTITION[ind] > 0) & (sum(proportionsIt[ind, ]) != 1)) { - isoin <- max(proportionsIt[ind, ]) - indeksi <- match(isoin, max(proportionsIt[ind, ])) + isoin <- base::max(proportionsIt[ind, ]) + indeksi <- match(isoin, base::max(proportionsIt[ind, ])) erotus <- sum(proportionsIt[ind, ]) - 1 proportionsIt[ind, indeksi] <- isoin - erotus } @@ -352,7 +352,7 @@ admix1 <- function(tietue) { pop <- PARTITION[ind] if (pop == 0) { # Individual is outlier uskottavuus[ind] <- 1 - } else if (isempty(find(to_investigate == ind))) { + } else if (isempty(matlab2r::find(to_investigate == ind))) { # Individual had log-likelihood ratio<3 uskottavuus[ind] <- 1 } else { diff --git a/R/admixture_initialization.R b/R/admixture_initialization.R index a5e98b5..0c46f9c 100644 --- a/R/admixture_initialization.R +++ b/R/admixture_initialization.R @@ -6,12 +6,12 @@ admixture_initialization <- function(data_matrix, nclusters, Z) { size_data <- size(data_matrix) nloci <- size_data[2] - 1 - n <- max(data_matrix[, ncol(data_matrix)]) + n <- base::max(data_matrix[, ncol(data_matrix)]) T <- cluster_own(Z, nclusters) initial_partition <- zeros(size_data[1], 1) for (i in 1:n) { kori <- T[i] - here <- find(data_matrix[, ncol(data_matrix)] == i) + here <- matlab2r::find(data_matrix[, ncol(data_matrix)] == i) for (j in 1:length(here)) { initial_partition[here[j], 1] <- kori } diff --git a/R/arvoSeuraavaTi.R b/R/arvoSeuraavaTi.R index ccdfbd5..c2fcfdd 100644 --- a/R/arvoSeuraavaTi.R +++ b/R/arvoSeuraavaTi.R @@ -2,7 +2,7 @@ arvoSeuraavaTila <- function(muutokset, logml) { # Suorittaa yksil�n seuraavan tilan arvonnan y <- logml + muutokset # siirron j�lkeiset logml:t - y <- y - max(y) + y <- y - base::max(y) y <- exp(y) summa <- sum(y) y <- y / summa diff --git a/R/computeDiffInCounts.R b/R/computeDiffInCounts.R index 103261a..c8abbfa 100644 --- a/R/computeDiffInCounts.R +++ b/R/computeDiffInCounts.R @@ -6,7 +6,7 @@ computeDiffInCounts <- function(rows, max_noalle, nloci, data) { diffInCounts <- zeros(max_noalle, nloci) for (i in seq_len(nrow(data))) { row <- data[i, ] - notEmpty <- as.matrix(find(row >= 0)) + notEmpty <- as.matrix(matlab2r::find(row >= 0)) if (length(notEmpty) > 0) { diffInCounts[row(notEmpty) + (notEmpty - 1) * max_noalle] <- diff --git a/R/computeLogml.R b/R/computeLogml.R index b67fb87..a6dc228 100644 --- a/R/computeLogml.R +++ b/R/computeLogml.R @@ -1,10 +1,10 @@ computeLogml <- function(counts, sumcounts, noalle, data, rowsFromInd) { nloci <- size(counts, 2) npops <- size(counts, 3) - adjnoalle <- zeros(max(noalle), nloci) + adjnoalle <- zeros(base::max(noalle), nloci) for (j in 1:nloci) { adjnoalle[1:noalle[j], j] <- noalle(j) - if ((noalle(j) < max(noalle))) { + if ((noalle(j) < base::max(noalle))) { adjnoalle[noalle[j] + 1:ncol(adjnoalle), j] <- 1 } } diff --git a/R/etsiParas.R b/R/etsiParas.R index 6de1c0d..74b5e35 100644 --- a/R/etsiParas.R +++ b/R/etsiParas.R @@ -10,13 +10,13 @@ etsiParas <- function(osuus, osuusTaulu, omaFreqs, logml) { while (ready != 1) { muutokset <- laskeMuutokset4(osuus, osuusTaulu, omaFreqs, logml) - # Work around R's max() limitation on complex numbers + # Work around R's base::max() limitation on complex numbers if (any(sapply(muutokset, class) == "complex")) { - maxRe <- max(Re(as.vector(muutokset))) - maxIm <- max(Im(as.vector(muutokset))) + maxRe <- base::max(Re(as.vector(muutokset))) + maxIm <- base::max(Im(as.vector(muutokset))) maxMuutos <- complex(real = maxRe, imaginary = maxIm) } else { - maxMuutos <- max(as.vector(muutokset)) + maxMuutos <- base::max(as.vector(muutokset)) } indeksi <- which(muutokset == maxMuutos) if (Re(maxMuutos) > 0) { diff --git a/R/findEmptyPop.R b/R/findEmptyPop.R index 8d57702..f9d8e48 100644 --- a/R/findEmptyPop.R +++ b/R/findEmptyPop.R @@ -6,7 +6,7 @@ findEmptyPop <- function(npops) { emptyPop <- -1 } else { popDiff <- diff(c(0, pops, npops + 1)) - emptyPop <- min(find(popDiff > 1)) + emptyPop <- base::min(matlab2r::find(popDiff > 1)) } return(list(emptyPop = emptyPop, pops = pops)) } diff --git a/R/getDistances.R b/R/getDistances.R index 1919b17..1efa730 100644 --- a/R/getDistances.R +++ b/R/getDistances.R @@ -9,26 +9,26 @@ getDistances <- function(data_matrix, nclusters) { size_data <- size(data_matrix) nloci <- size_data[2] - 1 - n <- max(data_matrix[, ncol(data_matrix)]) + n <- base::max(data_matrix[, ncol(data_matrix)]) distances <- zeros(choose(n, 2), 1) pointer <- 1 for (i in 1:n - 1) { i_data <- data_matrix[ - find(data_matrix[, ncol(data_matrix)] == i), + matlab2r::find(data_matrix[, ncol(data_matrix)] == i), 1:nloci ] for (j in (i + 1):n) { d_ij <- 0 - j_data <- data_matrix[find(data_matrix[, ncol()] == j), 1:nloci] + j_data <- data_matrix[matlab2r::find(data_matrix[, ncol()] == j), 1:nloci] vertailuja <- 0 for (k in 1:size(i_data, 1)) { for (l in 1:size(j_data, 1)) { - here_i <- find(i_data[k, ] >= 0) - here_j <- find(j_data[l, ] >= 0) + here_i <- matlab2r::find(i_data[k, ] >= 0) + here_j <- matlab2r::find(j_data[l, ] >= 0) here_joint <- intersect(here_i, here_j) vertailuja <- vertailuja + length(here_joint) d_ij <- d_ij + length( - find(i_data[k, here_joint] != j_data[l, here_joint]) + matlab2r::find(i_data[k, here_joint] != j_data[l, here_joint]) ) } } diff --git a/R/globals.R b/R/globals.R index 0e340cb..d96ba00 100644 --- a/R/globals.R +++ b/R/globals.R @@ -5,8 +5,6 @@ POP_LOGML <- array(1, dim = 100) LOGDIFF <- array(1, dim = c(100, 100)) # If handling globas break, try other ideas from https://stackoverflow.com/a/65252740/1169233 - -#' @import utils utils::globalVariables( c("PARTITION", "COUNTS", "SUMCOUNTS", "LOGDIFF", "POP_LOGML", "GAMMA_LN") ) diff --git a/R/handleData.R b/R/handleData.R index a65781e..637d62a 100644 --- a/R/handleData.R +++ b/R/handleData.R @@ -24,9 +24,9 @@ handleData <- function(raw_data) { nloci <- size(raw_data, 2) - 1 dataApu <- data[, 1:nloci] - nollat <- find(dataApu == 0) + nollat <- matlab2r::find(dataApu == 0) if (!isempty(nollat)) { - isoinAlleeli <- max(max(dataApu)) + isoinAlleeli <- base::max(max(dataApu)) dataApu[nollat] <- isoinAlleeli + 1 data[, 1:nloci] <- dataApu } @@ -39,16 +39,16 @@ handleData <- function(raw_data) { for (i in 1:nloci) { alleelitLokuksessaI <- unique(data[, i]) alleelitLokuksessa[[i]] <- sort(alleelitLokuksessaI[ - find( + matlab2r::find( alleelitLokuksessaI >= 0 ) ]) noalle[i] <- length(alleelitLokuksessa[[i]]) } - alleleCodes <- zeros(max(noalle), nloci) + alleleCodes <- zeros(base::max(noalle), nloci) for (i in 1:nloci) { alleelitLokuksessaI <- alleelitLokuksessa[[i]] - puuttuvia <- max(noalle) - length(alleelitLokuksessaI) + puuttuvia <- base::max(noalle) - length(alleelitLokuksessaI) alleleCodes[, i] <- as.matrix( c(alleelitLokuksessaI, zeros(puuttuvia, 1)) ) @@ -56,21 +56,21 @@ handleData <- function(raw_data) { for (loc in seq_len(nloci)) { for (all in seq_len(noalle[loc])) { - data[find(data[, loc] == alleleCodes[all, loc]), loc] <- all + data[matlab2r::find(data[, loc] == alleleCodes[all, loc]), loc] <- all } } - nind <- max(data[, ncol(data)]) + nind <- base::max(data[, ncol(data)]) nrows <- size(data, 1) ncols <- size(data, 2) rowsFromInd <- zeros(nind, 1) for (i in 1:nind) { - rowsFromInd[i] <- length(find(data[, ncol(data)] == i)) + rowsFromInd[i] <- length(matlab2r::find(data[, ncol(data)] == i)) } - maxRowsFromInd <- max(rowsFromInd) + maxRowsFromInd <- base::max(rowsFromInd) a <- -999 emptyRow <- repmat(a, c(1, ncols)) - lessThanMax <- find(rowsFromInd < maxRowsFromInd) + lessThanMax <- matlab2r::find(rowsFromInd < maxRowsFromInd) missingRows <- maxRowsFromInd * nind - nrows data <- rbind(data, zeros(missingRows, ncols)) pointer <- 1 @@ -81,12 +81,12 @@ handleData <- function(raw_data) { newData <- data rowsFromInd <- maxRowsFromInd - adjprior <- zeros(max(noalle), nloci) + adjprior <- zeros(base::max(noalle), nloci) priorTerm <- 0 for (j in 1:nloci) { adjprior[, j] <- as.matrix(c( repmat(1 / noalle[j], c(noalle[j], 1)), - ones(max(noalle) - noalle[j], 1) + ones(base::max(noalle) - noalle[j], 1) )) priorTerm <- priorTerm + noalle[j] * lgamma(1 / noalle[j]) } diff --git a/R/indMix.R b/R/indMix.R index 6040e87..e7a51ee 100644 --- a/R/indMix.R +++ b/R/indMix.R @@ -48,7 +48,7 @@ indMix <- function(c, npops, dispText = TRUE) { return() } else { npopsTaulu <- as.numeric(npopstext) - ykkoset <- find(npopsTaulu == 1) + ykkoset <- matlab2r::find(npopsTaulu == 1) npopsTaulu[ykkoset] <- NA # Mik�li ykk�si� annettu yl�rajaksi, ne poistetaan (if ones are given as an upper limit, they are deleted) if (isempty(npopsTaulu)) { logml <- 1 @@ -233,13 +233,13 @@ indMix <- function(c, npops, dispText = TRUE) { maxMuutos <- 0 ninds <- size(rows, 1) for (pop in 1:npops) { - inds2 <- find(PARTITION == pop) + inds2 <- matlab2r::find(PARTITION == pop) ninds2 <- length(inds2) if (ninds2 > 2) { dist2 <- laskeOsaDist(inds2, dist, ninds) Z2 <- linkage(t(dist2)) if (round == 3) { - npops2 <- max(min(20, floor(ninds2 / 5)), 2) + npops2 <- base::max(base::min(20, floor(ninds2 / 5)), 2) } else if (round == 4) { npops2 <- 2 # Moneenko osaan jaetaan } @@ -253,7 +253,7 @@ indMix <- function(c, npops, dispText = TRUE) { maxMuutos <- isoin muuttuvaPop2 <- indeksi %% npops2 if (muuttuvaPop2 == 0) muuttuvaPop2 <- npops2 - muuttuvat <- inds2[find(T2 == muuttuvaPop2)] + muuttuvat <- inds2[matlab2r::find(T2 == muuttuvaPop2)] i2 <- ceiling(indeksi / npops2) } } @@ -310,7 +310,7 @@ indMix <- function(c, npops, dispText = TRUE) { j <- j + 1 pop <- pops[j] totalMuutos <- 0 - inds <- find(PARTITION == pop) + inds <- matlab2r::find(PARTITION == pop) if (round == 5) { aputaulu <- c(inds, rand(length(inds), 1)) aputaulu <- sortrows(aputaulu, 2) @@ -398,7 +398,7 @@ indMix <- function(c, npops, dispText = TRUE) { while (j < npops) { j <- j + 1 pop <- pops[j] - inds2 <- find(PARTITION == pop) + inds2 <- matlab2r::find(PARTITION == pop) ninds2 <- length(inds2) if (ninds2 > 5) { partition <- PARTITION @@ -410,7 +410,7 @@ indMix <- function(c, npops, dispText = TRUE) { dist2 <- laskeOsaDist(inds2, dist, ninds) Z2 <- linkage(t(dist2)) T2 <- cluster_own(Z2, 2) - muuttuvat <- inds2[find(T2 == 1)] + muuttuvat <- inds2[matlab2r::find(T2 == 1)] muutokset <- laskeMuutokset3( T2, inds2, rows, data, adjprior, priorTerm, pop diff --git a/R/initialCounts.R b/R/initialCounts.R index fabc7b5..b40df09 100644 --- a/R/initialCounts.R +++ b/R/initialCounts.R @@ -3,18 +3,18 @@ initialCounts <- function(partition, data, npops, rows, noalle, adjprior) { ninds <- size(rows, 1) koot <- rows[, 1] - rows[, 2] + 1 - maxSize <- max(koot) + maxSize <- base::max(koot) - counts <- zeros(max(noalle), nloci, npops) + counts <- zeros(base::max(noalle), nloci, npops) sumcounts <- zeros(npops, nloci) for (i in 1:npops) { for (j in 1:nloci) { - havainnotLokuksessa <- find(partition == i & data[, j] >= 0) + havainnotLokuksessa <- matlab2r::find(partition == i & data[, j] >= 0) sumcounts[i, j] <- length(havainnotLokuksessa) for (k in 1:noalle[j]) { alleleCode <- k N_ijk <- length( - find(data[havainnotLokuksessa, j] == alleleCode) + matlab2r::find(data[havainnotLokuksessa, j] == alleleCode) ) counts[k, j, i] <- N_ijk } diff --git a/R/initialPopCounts.R b/R/initialPopCounts.R index bc6b62d..10a7da5 100644 --- a/R/initialPopCounts.R +++ b/R/initialPopCounts.R @@ -1,16 +1,16 @@ initialPopCounts <- function(data, npops, rows, noalle, adjprior) { nloci <- size(data, 2) - counts <- zeros(max(noalle), nloci, npops) + counts <- zeros(base::max(noalle), nloci, npops) sumcounts <- zeros(npops, nloci) for (i in 1:npops) { for (j in 1:nloci) { i_rivit <- rows(i, 1):rows(i, 2) - havainnotLokuksessa <- find(data[i_rivit, j] >= 0) + havainnotLokuksessa <- matlab2r::find(data[i_rivit, j] >= 0) sumcounts[i, j] <- length(havainnotLokuksessa) for (k in 1:noalle[j]) { alleleCode <- k - N_ijk <- length(find(data[i_rivit, j] == alleleCode)) + N_ijk <- length(matlab2r::find(data[i_rivit, j] == alleleCode)) counts[k, j, i] <- N_ijk } } diff --git a/R/laskeMuutokset12345.R b/R/laskeMuutokset12345.R index cbe724b..bd93243 100644 --- a/R/laskeMuutokset12345.R +++ b/R/laskeMuutokset12345.R @@ -68,7 +68,7 @@ laskeMuutokset <- function(ind, globalRows, data, adjprior, priorTerm) { COUNTS[, , i1] <- COUNTS[, , i1] + diffInCounts SUMCOUNTS[i1, ] <- SUMCOUNTS[i1, ] + diffInSumCounts - i2 <- find(muutokset == -Inf) # Etsit��n populaatiot jotka muuttuneet viime kerran j�lkeen. (Searching for populations that have changed since the last time) + i2 <- matlab2r::find(muutokset == -Inf) # Etsit��n populaatiot jotka muuttuneet viime kerran j�lkeen. (Searching for populations that have changed since the last time) i2 <- setdiff(i2, i1) i2_logml <- POP_LOGML[i2] @@ -95,7 +95,7 @@ laskeMuutokset2 <- function(i1, globalRows, data, adjprior, priorTerm) { i1_logml <- POP_LOGML[i1] - inds <- find(PARTITION == i1) + inds <- matlab2r::find(PARTITION == i1) ninds <- length(inds) if (ninds == 0) { @@ -138,7 +138,7 @@ laskeMuutokset2 <- function(i1, globalRows, data, adjprior, priorTerm) { laskeMuutokset3 <- function(T2, inds2, globalRows, data, adjprior, priorTerm, i1) { # Palauttaa length(unique(T2))*npops taulun, jossa (i,j):s alkio # kertoo, mik� olisi muutos logml:ss�, jos populaation i1 osapopulaatio - # inds2(find(T2==i)) siirret��n koriin j. + # inds2(matlab2r::find(T2==i)) siirret��n koriin j. npops <- size(COUNTS, 3) npops2 <- length(unique(T2)) @@ -146,7 +146,7 @@ laskeMuutokset3 <- function(T2, inds2, globalRows, data, adjprior, priorTerm, i1 i1_logml <- POP_LOGML[i1] for (pop2 in 1:npops2) { - inds <- inds2[find(T2 == pop2)] + inds <- inds2[matlab2r::find(T2 == pop2)] ninds <- length(inds) if (ninds > 0) { rows <- list() diff --git a/R/learn_partition_modified.R b/R/learn_partition_modified.R index 76b78c9..03f8e5a 100644 --- a/R/learn_partition_modified.R +++ b/R/learn_partition_modified.R @@ -11,9 +11,9 @@ learn_partition_modified <- function(ordered) { part <- learn_simple_partition(ordered, 0.05) nclust <- length(unique(part)) if (nclust == 3) { - mini_1 <- min(ordered(which(part == 1))) - mini_2 <- min(ordered(which(part == 2))) - mini_3 <- min(ordered(which(part == 3))) + mini_1 <- base::ordered(which(part == 1)) + mini_2 <- base::min(ordered(which(part == 2))) + mini_3 <- base::min(ordered(which(part == 3))) if (mini_1 > 0.9 & mini_2 > 0.9) { part[part == 2] <- 1 part[part == 3] <- 2 diff --git a/R/newGetDistances.R b/R/newGetDistances.R index bd07623..cf62722 100644 --- a/R/newGetDistances.R +++ b/R/newGetDistances.R @@ -1,11 +1,11 @@ newGetDistances <- function(data, rowsFromInd) { - ninds <- max(data[, ncol(data)]) + ninds <- base::max(data[, ncol(data)]) nloci <- size(data, 2) - 1 riviLkm <- choose(ninds, 2) - empties <- find(data < 0) + empties <- matlab2r::find(data < 0) data[empties] <- 0 - data <- apply(data, 2, as.numeric) # max(noalle) oltava <256 + data <- apply(data, 2, as.numeric) # base::max(noalle) oltava <256 pariTaulu <- zeros(riviLkm, 2) aPointer <- 1 @@ -51,10 +51,10 @@ newGetDistances <- function(data, rowsFromInd) { } rm(x, y, vertailutNyt) - nollat <- find(vertailuja == 0) + nollat <- matlab2r::find(vertailuja == 0) dist <- zeros(length(vertailuja), 1) dist[nollat] <- 1 - muut <- find(vertailuja > 0) + muut <- matlab2r::find(vertailuja > 0) dist[muut] <- summa[muut] / vertailuja[muut] rm(summa, vertailuja) Z <- linkage(t(dist)) diff --git a/R/poistaTyhjatPopulaatiot.R b/R/poistaTyhjatPopulaatiot.R index c48a139..c1974f6 100644 --- a/R/poistaTyhjatPopulaatiot.R +++ b/R/poistaTyhjatPopulaatiot.R @@ -1,13 +1,13 @@ poistaTyhjatPopulaatiot <- function(npops) { # % Poistaa tyhjentyneet populaatiot COUNTS:ista ja # % SUMCOUNTS:ista. P�ivitt�� npops:in ja PARTITION:in. - notEmpty <- find(any(SUMCOUNTS, 2)) + notEmpty <- matlab2r::find(any(SUMCOUNTS, 2)) COUNTS <- COUNTS[, , notEmpty] SUMCOUNTS <- SUMCOUNTS[notEmpty, ] LOGDIFF <- LOGDIFF[, notEmpty] for (n in 1:length(notEmpty)) { - apu <- find(PARTITION == notEmpty(n)) + apu <- matlab2r::find(PARTITION == notEmpty(n)) PARTITION[apu] <- n } npops <- length(notEmpty) diff --git a/R/rBAPS-package.R b/R/rBAPS-package.R index 15d7715..ee56dc4 100644 --- a/R/rBAPS-package.R +++ b/R/rBAPS-package.R @@ -5,6 +5,6 @@ #' @note Found a bug? Want to suggest a feature? Contribute to the scientific #' and open source communities by opening an issue on our home page. #' Check the "BugReports" field on the package description for the URL. -#' @importFrom matlab2r blanks cell colon inputdlg isempty isfield isspace max min ones rand repmat reshape size sortrows squeeze strcmp times zeros +#' @importFrom matlab2r blanks cell colon find inputdlg isempty isfield isspace max min ones rand repmat reshape size sortrows squeeze strcmp times zeros #' @importFrom stats runif NULL diff --git a/R/rand_disc.R b/R/rand_disc.R index dfd46d7..2acb021 100644 --- a/R/rand_disc.R +++ b/R/rand_disc.R @@ -1,7 +1,7 @@ rand_disc <- function(CDF) { # %returns an index of a value from a discrete distribution using inversion method slump <- rand - har <- find(CDF > slump) + har <- matlab2r::find(CDF > slump) svar <- har(1) return(svar) } diff --git a/R/simuloiAlleeli.R b/R/simuloiAlleeli.R index e711cdd..d87868a 100644 --- a/R/simuloiAlleeli.R +++ b/R/simuloiAlleeli.R @@ -26,6 +26,6 @@ simuloiAlleeli <- function(allfreqs, pop, loc) { cumsumma <- cumsum(freqs) arvo <- runif(1) isommat <- which(cumsumma > arvo) - all <- min(isommat) + all <- base::min(isommat) return(all) } diff --git a/R/testaaOnkoKunnollinenBapsData.R b/R/testaaOnkoKunnollinenBapsData.R index 446258a..5296dcb 100644 --- a/R/testaaOnkoKunnollinenBapsData.R +++ b/R/testaaOnkoKunnollinenBapsData.R @@ -12,7 +12,7 @@ testaaOnkoKunnollinenBapsData <- function(data) { return(ninds) } lastCol <- data[, ncol(data)] - ninds <- max(lastCol) + ninds <- base::max(lastCol) if (any(1:ninds != unique(lastCol))) { ninds <- 0 return(ninds) diff --git a/R/updateGlobalVariables.R b/R/updateGlobalVariables.R index 9a3f831..3eada6d 100644 --- a/R/updateGlobalVariables.R +++ b/R/updateGlobalVariables.R @@ -14,7 +14,7 @@ updateGlobalVariables <- function(ind, i2, diffInCounts, adjprior, priorTerm) { ) LOGDIFF[, c(i1, i2)] <- -Inf - inx <- c(find(PARTITION == i1), find(PARTITION == i2)) + inx <- c(matlab2r::find(PARTITION == i1), matlab2r::find(PARTITION == i2)) LOGDIFF[inx, ] <- -Inf } @@ -22,7 +22,7 @@ updateGlobalVariables2 <- function(i1, i2, diffInCounts, adjprior, priorTerm) { # % Suorittaa globaalien muuttujien muutokset, kun kaikki # % korissa i1 olevat yksil�t siirret��n koriin i2. - inds <- find(PARTITION == i1) + inds <- matlab2r::find(PARTITION == i1) PARTITION[inds] <- i2 COUNTS[, , i1] <- COUNTS[, , i1] - diffInCounts @@ -34,7 +34,7 @@ updateGlobalVariables2 <- function(i1, i2, diffInCounts, adjprior, priorTerm) { POP_LOGML[i2] <- computePopulationLogml(i2, adjprior, priorTerm) LOGDIFF[, c(i1, i2)] <- -Inf - inx <- c(find(PARTITION == i1), find(PARTITION == i2)) + inx <- c(matlab2r::find(PARTITION == i1), matlab2r::find(PARTITION == i2)) LOGDIFF[inx, ] <- -Inf } @@ -56,6 +56,6 @@ updateGlobalVariables3 <- function(muuttuvat, diffInCounts, adjprior, priorTerm, ) LOGDIFF[, c(i1, i2)] <- -Inf - inx <- c(find(PARTITION == i1), find(PARTITION == i2)) + inx <- c(matlab2r::find(PARTITION == i1), matlab2r::find(PARTITION == i2)) LOGDIFF[inx, ] <- -Inf } diff --git a/R/writeMixtureInfo.R b/R/writeMixtureInfo.R index 44a7e9f..1c2cb2d 100644 --- a/R/writeMixtureInfo.R +++ b/R/writeMixtureInfo.R @@ -64,7 +64,7 @@ writeMixtureInfo <- function(logml, rowsFromInd, data, adjprior, priorTerm, outP append(fid, c("Best Partition: ", "\n")) } for (m in 1:cluster_count) { - indsInM <- find(PARTITION == m) + indsInM <- matlab2r::find(PARTITION == m) length_of_beginning <- 11 + floor(log10(m)) cluster_size <- length(indsInM) @@ -139,8 +139,8 @@ writeMixtureInfo <- function(logml, rowsFromInd, data, adjprior, priorTerm, outP nimi <- as.character(popnames[i]) nameSizes[i] <- length(nimi) } - maxSize <- max(nameSizes) - maxSize <- max(maxSize, 5) + maxSize <- base::max(nameSizes) + maxSize <- base::max(maxSize, 5) erotus <- maxSize - 5 alku <- blanks(erotus) ekarivi <- c(alku, " ind", blanks(6 + erotus)) @@ -193,8 +193,8 @@ writeMixtureInfo <- function(logml, rowsFromInd, data, adjprior, priorTerm, outP nloci <- size(COUNTS, 2) d <- zeros(maxnoalle, nloci, npops) prior <- adjprior - prior[find(prior == 1)] <- 0 - nollia <- find(all(prior == 0)) # Loci in which only one allele was detected. + prior[matlab2r::find(prior == 1)] <- 0 + nollia <- matlab2r::find(all(prior == 0)) # Loci in which only one allele was detected. prior[1, nollia] <- 1 for (pop1 in 1:npops) { d[, , pop1] <- (squeeze(COUNTS[, , pop1]) + prior) / @@ -261,7 +261,7 @@ writeMixtureInfo <- function(logml, rowsFromInd, data, adjprior, priorTerm, outP partitionSummary <- sortrows(partitionSummary, 2) partitionSummary <- partitionSummary[size(partitionSummary, 1):1, ] - partitionSummary <- partitionSummary[find(partitionSummary[, 2] > -1e49), ] + partitionSummary <- partitionSummary[matlab2r::find(partitionSummary[, 2] > -1e49), ] if (size(partitionSummary, 1) > 10) { vikaPartitio <- 10 } else { @@ -298,12 +298,12 @@ writeMixtureInfo <- function(logml, rowsFromInd, data, adjprior, priorTerm, outP len <- length(npopsTaulu) probs <- zeros(len, 1) partitionSummary[, 2] <- partitionSummary[, 2] - - max(partitionSummary[, 2]) + base::max(partitionSummary[, 2]) sumtn <- sum(exp(partitionSummary[, 2])) for (i in 1:len) { npopstn <- sum( exp( - partitionSummary[find( + partitionSummary[matlab2r::find( partitionSummary[, 1] == npopsTaulu[i] ), 2] ) diff --git a/man/linkage.Rd b/man/linkage.Rd index 5014a8b..850864b 100644 --- a/man/linkage.Rd +++ b/man/linkage.Rd @@ -23,5 +23,9 @@ output format of PDIST. Z = linkage(X) returns a matrix Z that encodes a tree containing hierarchical clusters of the rows of the input data matrix X. } \note{ -This is also a base Matlab function. The reason why the source code is also present here is unclear. +This is also a base MATLAB function. The reason why the BAPS +source code also contains a LINKAGE function is unclear. One could speculate +that BAPS should use this function instead of the base one, so this is why +this function is part of this package (instead of a MATLAB-replicating +package such as matlab2r) } From e36b656629e2cac0be042797ee8d696deba9b3a8 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 10:49:48 +0100 Subject: [PATCH 6/6] Updated badges --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e9f75f..6ea53f6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -[![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) -[![](https://img.shields.io/github/last-commit/ocbe-uio/rBAPS.svg)](https://github.com/ocbe-uio/rBAPS/commits/master) -[![](https://img.shields.io/github/languages/code-size/ocbe-uio/rBAPS.svg)](https://github.com/ocbe-uio/rBAPS) -[![R build status](https://github.com/ocbe-uio/rBAPS/workflows/R-CMD-check/badge.svg)](https://github.com/ocbe-uio/rBAPS/actions) -[![](https://codecov.io/gh/ocbe-uio/rBAPS/branch/develop/graph/badge.svg)](https://codecov.io/gh/ocbe-uio/rBAPS) +[![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) +[![last commit](https://img.shields.io/github/last-commit/ocbe-uio/rBAPS.svg)](https://github.com/ocbe-uio/rBAPS/commits/master) +[![code size](https://img.shields.io/github/languages/code-size/ocbe-uio/rBAPS.svg)](https://github.com/ocbe-uio/rBAPS) +[![check status](https://github.com/ocbe-uio/rBAPS/workflows/R-CMD-check/badge.svg)](https://github.com/ocbe-uio/rBAPS/actions) +[![codecov](https://codecov.io/gh/ocbe-uio/rBAPS/branch/develop/graph/badge.svg)](https://codecov.io/gh/ocbe-uio/rBAPS) +[![CodeFactor](https://www.codefactor.io/repository/github/ocbe-uio/rBAPS/badge)](https://www.codefactor.io/repository/github/ocbe-uio/rBAPS) # rBAPS R implementation of the compiled Matlab BAPS software for Bayesian Analysis of Population Structure.