Minor changes for clean build
This commit is contained in:
parent
7ad4fc43df
commit
1e5fa0ea91
10 changed files with 34 additions and 9 deletions
|
|
@ -39,3 +39,5 @@ LazyData: true
|
|||
RoxygenNote: 7.0.2
|
||||
Suggests:
|
||||
testthat (>= 2.1.0)
|
||||
Imports:
|
||||
methods
|
||||
|
|
|
|||
|
|
@ -26,4 +26,5 @@ export(size)
|
|||
export(strcmp)
|
||||
export(suoritaMuutos)
|
||||
export(times)
|
||||
importFrom(methods,is)
|
||||
importFrom(stats,runif)
|
||||
|
|
|
|||
17
R/admix1.R
17
R/admix1.R
|
|
@ -4,6 +4,11 @@
|
|||
#' will the required variables be retrieved from the record fields?
|
||||
#' `tietue`should contain the following elements: PARTITION, COUNTS, SUMCOUNTS,
|
||||
#' alleleCodes, adjprior, popnames, rowsFromInd, data, npops, noalle
|
||||
#' @param tietue tietue
|
||||
#' @param PARTITION PARTITION
|
||||
#' @param COUNTS COUNTS
|
||||
#' @param SUMCOUNTS SUMCOUNTS
|
||||
#' @importFrom methods is
|
||||
#' @export
|
||||
admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
|
||||
COUNTS = matrix(NA, 0, 0), SUMCOUNTS = NA) {
|
||||
|
|
@ -20,7 +25,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
|
|||
cat('---------------------------------------------------\n');
|
||||
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?
|
||||
# h0 = findobj('Tag','filename1_text');
|
||||
|
|
@ -79,7 +84,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
|
|||
),
|
||||
definput = 5
|
||||
)
|
||||
alaRaja <- as.num(answers)
|
||||
alaRaja <- as.numeric(answers)
|
||||
npops <- poistaLiianPienet(npops, rowsFromInd, alaRaja)
|
||||
|
||||
nloci <- size(COUNTS, 2)
|
||||
|
|
@ -116,7 +121,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
|
|||
# Yksil?on outlier
|
||||
} else if (PARTITION[ind] != 0) {
|
||||
if (PARTITION[ind] > 0) {
|
||||
osuusTaulu(PARTITION[ind]) <- 1
|
||||
osuusTaulu[PARTITION[ind]] <- 1
|
||||
} else {
|
||||
# Yksilöt, joita ei ole sijoitettu mihinkään koriin.
|
||||
arvot <- zeros(1, npops)
|
||||
|
|
@ -181,12 +186,12 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0),
|
|||
omaFreqs <- computePersonalAllFreqs(
|
||||
ind, data, allfreqs, rowsFromInd
|
||||
)
|
||||
osuusTaulu = zeros(1, npops)
|
||||
osuusTaulu <- zeros(1, npops)
|
||||
if (PARTITION[ind] == 0) {
|
||||
# Yksil?on outlier
|
||||
} else if (PARTITION[ind] != 0) {
|
||||
if (PARTITION[ind] > 0) {
|
||||
osuusTaulu(PARTITION[ind]) <- 1
|
||||
osuusTaulu[PARTITION[ind]] <- 1
|
||||
} else {
|
||||
# Yksilöt, joita ei ole sijoitettu mihinkään koriin.
|
||||
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$pvalue <- uskottavuus # Added by Jing
|
||||
c$mixtureType <- 'admix' # Jing
|
||||
|
|
|
|||
1
R/find.R
1
R/find.R
|
|
@ -1,5 +1,6 @@
|
|||
#' @title Find indices and values of nonzero elements
|
||||
#' @description Emulates behavior of `find`
|
||||
#' @param x object or logic operation on an object
|
||||
find <- function(x) {
|
||||
if (is.logical(x)) {
|
||||
return(which(x))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#' @title Gather user input
|
||||
#' @description Replicates the functionality of the homonymous function in Matlab (sans dialog box)
|
||||
#' @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
|
||||
#' @export
|
||||
inputdlg <- function(prompt, definput=NULL, dims=1) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#' @details As input, this function takes two variables from a mixture/admixture
|
||||
#' result structure.
|
||||
#' @return puredata: a data contains no index column.
|
||||
#' @param data data
|
||||
#' @param noalle noalle
|
||||
#' @export
|
||||
noIndex <- function (data, noalle) {
|
||||
limit <- ifelse(is(noalle, "matrix"), ncol(noalle), length(noalle))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,13 @@ admix1(
|
|||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{tietue}{a named record list}
|
||||
\item{tietue}{tietue}
|
||||
|
||||
\item{PARTITION}{PARTITION}
|
||||
|
||||
\item{COUNTS}{COUNTS}
|
||||
|
||||
\item{SUMCOUNTS}{SUMCOUNTS}
|
||||
}
|
||||
\description{
|
||||
Admixture analysis
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
\usage{
|
||||
find(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{object or logic operation on an object}
|
||||
}
|
||||
\description{
|
||||
Emulates behavior of `find`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ inputdlg(prompt, definput = NULL, dims = 1)
|
|||
|
||||
\item{definput}{default value of the input}
|
||||
|
||||
\item{dim}{number of dimensions in the answwers}
|
||||
\item{dims}{number of dimensions in the answwers}
|
||||
}
|
||||
\description{
|
||||
Replicates the functionality of the homonymous function in Matlab (sans dialog box)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@
|
|||
\usage{
|
||||
noIndex(data, noalle)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{data}
|
||||
|
||||
\item{noalle}{noalle}
|
||||
}
|
||||
\value{
|
||||
puredata: a data contains no index column.
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue