Minor changes for clean build

This commit is contained in:
Waldir Leoncio 2020-03-18 15:02:38 +01:00
parent 7ad4fc43df
commit 1e5fa0ea91
10 changed files with 34 additions and 9 deletions

View file

@ -39,3 +39,5 @@ LazyData: true
RoxygenNote: 7.0.2 RoxygenNote: 7.0.2
Suggests: Suggests:
testthat (>= 2.1.0) testthat (>= 2.1.0)
Imports:
methods

View file

@ -26,4 +26,5 @@ export(size)
export(strcmp) export(strcmp)
export(suoritaMuutos) export(suoritaMuutos)
export(times) export(times)
importFrom(methods,is)
importFrom(stats,runif) importFrom(stats,runif)

View file

@ -4,6 +4,11 @@
#' will the required variables be retrieved from the record fields? #' will the required variables be retrieved from the record fields?
#' `tietue`should contain the following elements: PARTITION, COUNTS, SUMCOUNTS, #' `tietue`should contain the following elements: PARTITION, COUNTS, SUMCOUNTS,
#' alleleCodes, adjprior, popnames, rowsFromInd, data, npops, noalle #' alleleCodes, adjprior, popnames, rowsFromInd, data, npops, noalle
#' @param tietue tietue
#' @param PARTITION PARTITION
#' @param COUNTS COUNTS
#' @param SUMCOUNTS SUMCOUNTS
#' @importFrom methods is
#' @export #' @export
admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
COUNTS = matrix(NA, 0, 0), SUMCOUNTS = NA) { COUNTS = matrix(NA, 0, 0), SUMCOUNTS = NA) {
@ -20,7 +25,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
cat('---------------------------------------------------\n'); cat('---------------------------------------------------\n');
message('Reading mixture result from: ', pathname_filename, '...') message('Reading mixture result from: ', pathname_filename, '...')
} }
sys.sleep(0.0001) #ASK: what for? Sys.sleep(0.0001) #ASK: what for?
# ASK: what is this supposed to do? What do graphic obj have to do here? # ASK: what is this supposed to do? What do graphic obj have to do here?
# h0 = findobj('Tag','filename1_text'); # h0 = findobj('Tag','filename1_text');
@ -79,7 +84,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
), ),
definput = 5 definput = 5
) )
alaRaja <- as.num(answers) alaRaja <- as.numeric(answers)
npops <- poistaLiianPienet(npops, rowsFromInd, alaRaja) npops <- poistaLiianPienet(npops, rowsFromInd, alaRaja)
nloci <- size(COUNTS, 2) nloci <- size(COUNTS, 2)
@ -116,7 +121,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
# Yksil?on outlier # Yksil?on outlier
} else if (PARTITION[ind] != 0) { } else if (PARTITION[ind] != 0) {
if (PARTITION[ind] > 0) { if (PARTITION[ind] > 0) {
osuusTaulu(PARTITION[ind]) <- 1 osuusTaulu[PARTITION[ind]] <- 1
} else { } else {
# Yksilöt, joita ei ole sijoitettu mihinkään koriin. # Yksilöt, joita ei ole sijoitettu mihinkään koriin.
arvot <- zeros(1, npops) arvot <- zeros(1, npops)
@ -181,12 +186,12 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
omaFreqs <- computePersonalAllFreqs( omaFreqs <- computePersonalAllFreqs(
ind, data, allfreqs, rowsFromInd ind, data, allfreqs, rowsFromInd
) )
osuusTaulu = zeros(1, npops) osuusTaulu <- zeros(1, npops)
if (PARTITION[ind] == 0) { if (PARTITION[ind] == 0) {
# Yksil?on outlier # Yksil?on outlier
} else if (PARTITION[ind] != 0) { } else if (PARTITION[ind] != 0) {
if (PARTITION[ind] > 0) { if (PARTITION[ind] > 0) {
osuusTaulu(PARTITION[ind]) <- 1 osuusTaulu[PARTITION[ind]] <- 1
} else { } else {
# Yksilöt, joita ei ole sijoitettu mihinkään koriin. # Yksilöt, joita ei ole sijoitettu mihinkään koriin.
arvot <- zeros(1, npops) arvot <- zeros(1, npops)
@ -388,7 +393,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
} }
} }
if (!isstruct(tietue)) { if (!is(tietue, "list")) {
c$proportionsIt <- proportionsIt c$proportionsIt <- proportionsIt
c$pvalue <- uskottavuus # Added by Jing c$pvalue <- uskottavuus # Added by Jing
c$mixtureType <- 'admix' # Jing c$mixtureType <- 'admix' # Jing

View file

@ -1,5 +1,6 @@
#' @title Find indices and values of nonzero elements #' @title Find indices and values of nonzero elements
#' @description Emulates behavior of `find` #' @description Emulates behavior of `find`
#' @param x object or logic operation on an object
find <- function(x) { find <- function(x) {
if (is.logical(x)) { if (is.logical(x)) {
return(which(x)) return(which(x))

View file

@ -1,7 +1,7 @@
#' @title Gather user input #' @title Gather user input
#' @description Replicates the functionality of the homonymous function in Matlab (sans dialog box) #' @description Replicates the functionality of the homonymous function in Matlab (sans dialog box)
#' @param prompt Text field with user instructions #' @param prompt Text field with user instructions
#' @param dim number of dimensions in the answwers #' @param dims number of dimensions in the answwers
#' @param definput default value of the input #' @param definput default value of the input
#' @export #' @export
inputdlg <- function(prompt, definput=NULL, dims=1) { inputdlg <- function(prompt, definput=NULL, dims=1) {

View file

@ -3,6 +3,8 @@
#' @details As input, this function takes two variables from a mixture/admixture #' @details As input, this function takes two variables from a mixture/admixture
#' result structure. #' result structure.
#' @return puredata: a data contains no index column. #' @return puredata: a data contains no index column.
#' @param data data
#' @param noalle noalle
#' @export #' @export
noIndex <- function (data, noalle) { noIndex <- function (data, noalle) {
limit <- ifelse(is(noalle, "matrix"), ncol(noalle), length(noalle)) limit <- ifelse(is(noalle, "matrix"), ncol(noalle), length(noalle))

View file

@ -12,7 +12,13 @@ admix1(
) )
} }
\arguments{ \arguments{
\item{tietue}{a named record list} \item{tietue}{tietue}
\item{PARTITION}{PARTITION}
\item{COUNTS}{COUNTS}
\item{SUMCOUNTS}{SUMCOUNTS}
} }
\description{ \description{
Admixture analysis Admixture analysis

View file

@ -6,6 +6,9 @@
\usage{ \usage{
find(x) find(x)
} }
\arguments{
\item{x}{object or logic operation on an object}
}
\description{ \description{
Emulates behavior of `find` Emulates behavior of `find`
} }

View file

@ -11,7 +11,7 @@ inputdlg(prompt, definput = NULL, dims = 1)
\item{definput}{default value of the input} \item{definput}{default value of the input}
\item{dim}{number of dimensions in the answwers} \item{dims}{number of dimensions in the answwers}
} }
\description{ \description{
Replicates the functionality of the homonymous function in Matlab (sans dialog box) Replicates the functionality of the homonymous function in Matlab (sans dialog box)

View file

@ -6,6 +6,11 @@
\usage{ \usage{
noIndex(data, noalle) noIndex(data, noalle)
} }
\arguments{
\item{data}{data}
\item{noalle}{noalle}
}
\value{ \value{
puredata: a data contains no index column. puredata: a data contains no index column.
} }