% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dot-permTestDiffAsso.R
\name{.permTestDiffAsso}
\alias{.permTestDiffAsso}
\title{Permutation Tests for Determining Differential Associations}
\usage{
.permTestDiffAsso(
  countMat1,
  countMat2,
  countsJoint,
  normCounts1,
  normCounts2,
  assoMat1,
  assoMat2,
  paramsNetConstruct,
  method = c("connect.pairs", "connect.variables", "connect.network"),
  fisherTrans = TRUE,
  pvalsMethod = "pseudo",
  adjust = "lfdr",
  adjust2 = "holm",
  trueNullMethod = "convest",
  alpha = 0.05,
  lfdrThresh = 0.2,
  nPerm = 1000,
  matchDesign = NULL,
  callNetConstr = NULL,
  cores = 4,
  verbose = TRUE,
  logFile = "log.txt",
  seed = NULL,
  fileLoadAssoPerm = NULL,
  fileLoadCountsPerm = NULL,
  storeAssoPerm = FALSE,
  fileStoreAssoPerm = "assoPerm",
  storeCountsPerm = FALSE,
  fileStoreCountsPerm = c("countsPerm1", "countsPerm2"),
  assoPerm = NULL
)
}
\arguments{
\item{countMat1, countMat2}{matrices containing microbiome data (read counts)
of group 1 and group 2 (rows represent samples and columns taxonomic units,
respectively).}

\item{countsJoint}{joint count matrices before preprocessing}

\item{normCounts1, normCounts2}{normalized count matrices.}

\item{assoMat1, assoMat2}{association matrices corresponding to the two count
matrices. The associations must have been estimated from the count matrices
\code{countMat1} and \code{countMat2}.}

\item{paramsNetConstruct}{parameters used for network construction.}

\item{method}{character vector indicating the tests to be performed. Possible
values are \code{"connect.pairs"} (differentially correlated taxa pairs),
\code{"connect.variables"} (one taxon to all other) and
\code{"connect.network"} (differentially connected networks). By default,
all three tests are conducted.}

\item{fisherTrans}{logical indicating whether the correlation values should
be Fisher-transformed.}

\item{pvalsMethod}{currently only \code{"pseudo"} is available, where 1 is
added to the number of permutations and the permutation test statistics
being more extreme than the observed one in order to avoid zero p-values.}

\item{adjust}{multiple testing adjustment for the tests for differentially
correlated pairs of taxa; possible values are "lfdr" (default) for local
false discovery rate correction (via \code{\link[fdrtool]{fdrtool}}) or one
of the methods provided by \code{\link[stats]{p.adjust}}}

\item{adjust2}{multiple testing adjustment for the tests if a taxa pair is
differentially correlated to all other taxa; possible methods are those
provided by \code{\link[stats]{p.adjust}} (a few hundred tests are
necessary for the local fdr correction)}

\item{trueNullMethod}{character indicating the method used for estimating the
proportion of true null hypotheses from a vector of p-values. Used for the
adaptive Benjamini-Hochberg method for multiple testing adjustment (chosen
by \code{adjust = "adaptBH"}).}

\item{alpha}{significance level}

\item{lfdrThresh}{defines a threshold for the local fdr if "lfdr" is chosen
as method for multiple testing correction; defaults to 0.2, which means
that correlations with a corresponding local fdr less than or equal to 0.2
are identified as significant}

\item{nPerm}{number of permutations}

\item{matchDesign}{Numeric vector with two elements specifying an optional 
matched-group (i.e. matched-pair) design, which is used for the permutation 
tests in \code{\link{netCompare}} and \code{\link{diffnet}}. \code{c(1,1)} 
corresponds to a matched-pair design. A 1:2 matching, for instance, is 
defined by \code{c(1,2)}, which means that the first sample of group 1 is 
matched to the first two samples of group 2 and so on. 
The appropriate order of samples must be ensured. If 
\code{NULL}, the group memberships are shuffled randomly while group sizes
identical to the original data set are ensured.}

\item{callNetConstr}{call inherited from \code{netConstruct()}.}

\item{cores}{number of CPU cores (permutation tests are executed parallel)}

\item{verbose}{if \code{TRUE}, status messages and numbers of SparCC
iterations are printed}

\item{logFile}{character string naming the log file within which the current
iteration number is stored}

\item{seed}{an optional seed for reproducibility of the results}

\item{fileLoadAssoPerm}{character giving the name (without extenstion) 
or path of the file storing the "permuted" association/dissimilarity 
matrices that have been exported by setting \code{storeAssoPerm} to 
\code{TRUE}. Only used for permutation tests. Set to \code{NULL} if no 
existing associations should be used.}

\item{fileLoadCountsPerm}{character giving the name (without extenstion) 
or path of the file storing the "permuted" count matrices that have been 
exported by setting \code{storeCountsPerm} to \code{TRUE}. 
Only used for permutation tests, and if \code{fileLoadAssoPerm = NULL}. 
Set to \code{NULL} if no existing count matrices should be used.}

\item{storeAssoPerm}{logical indicating whether the association (or
dissimilarity) matrices for the permuted data should be stored in a file.
The filename is given via \code{fileStoreAssoPerm}. If \code{TRUE}, 
the computed "permutation" association/dissimilarity matrices can be reused
via \code{fileLoadAssoPerm} to save runtime. Defaults to \code{FALSE}.}

\item{fileStoreAssoPerm}{character giving the file name to store a matrix
containing a matrix with associations/dissimilarities for the permuted 
data. Can also be a path.}

\item{storeCountsPerm}{logical indicating whether the permuted count matrices
should be stored in an external file. Defaults to \code{FALSE}.}

\item{fileStoreCountsPerm}{character vector with two elements giving the 
names of two files storing the permuted count matrices belonging to the 
two groups.}

\item{assoPerm}{not used anymore.}
}
\description{
The function implements procedures to test whether pairs of taxa
  are differentially associated, whether a taxon is differentially associated
  to all other taxa, or whether two networks are differentially associated
  between two groups as proposed  by \cite{Gill et al.(2010)}.
}
\references{
\insertRef{gill2010statistical}{NetCoMi}\cr\cr
  \insertRef{knijnenburg2009fewer}{NetCoMi}\cr\cr
}
\seealso{
\code{\link{diffnet}}
}
