\HeaderA{gwSnpTests}{methods for iterating association tests (expression vs SNP)
across genomes or chromosomes}{gwSnpTests}
\aliasA{chunksize}{gwSnpTests}{chunksize}
\aliasA{chunksize-class}{gwSnpTests}{chunksize.Rdash.class}
\aliasA{gwSnpTests,formula,smlSet,cnumOrMissing,ANY-method}{gwSnpTests}{gwSnpTests,formula,smlSet,cnumOrMissing,ANY.Rdash.method}
\aliasA{gwSnpTests,formula,smlSet,cnumOrMissing-method}{gwSnpTests}{gwSnpTests,formula,smlSet,cnumOrMissing.Rdash.method}
\aliasA{gwSnpTests,formula,smlSet,snpdepth,ANY-method}{gwSnpTests}{gwSnpTests,formula,smlSet,snpdepth,ANY.Rdash.method}
\aliasA{gwSnpTests,formula,smlSet,snpdepth,chunksize-method}{gwSnpTests}{gwSnpTests,formula,smlSet,snpdepth,chunksize.Rdash.method}
\aliasA{gwSnpTests,formula,smlSet,snpdepth-method}{gwSnpTests}{gwSnpTests,formula,smlSet,snpdepth.Rdash.method}
\aliasA{residTests}{gwSnpTests}{residTests}
\aliasA{residTests,cwSnpScreenResult,smlSet,formula,missing-method}{gwSnpTests}{residTests,cwSnpScreenResult,smlSet,formula,missing.Rdash.method}
\keyword{models}{gwSnpTests}
\begin{Description}\relax
methods for iterating association tests (expression vs SNP)
across genomes or chromosomes
\end{Description}
\begin{Usage}
\begin{verbatim}
gwSnpTests(sym, sms, cnum, cs, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{sym}] genesym, probeId, or formula instance
\item[\code{sms}] \LinkA{smlSet}{smlSet} instance
\item[\code{cnum}] chrnum instance or missing
\item[\code{cs}] chunksize specification 
\item[\code{...}] \dots
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
invokes \code{snpMatrix} package test procedures 
(e.g., \code{\LinkA{snp.rhs.tests}{snp.rhs.tests}} as appropriate


\code{chunksize} can be specified to divide
task up into chunks of chromosomes; \code{gc()} will be run
between each chunk -- this may lead to some benefits
when memory capacity is exceeded

The dependent variable in the formula can have class
genesym (chip annotation package used for lookup),
probeId (direct specification using chip annotation vocabulary),
or phenoVar (here we use a phenoData variable as dependent variable).
If you want to put expression values on the right-hand side
of the model, add them to the phenoData and enter them in the
formula.
\end{Details}
\begin{Value}
\code{\LinkA{gwSnpScreenResult-class}{gwSnpScreenResult.Rdash.class}} or 
\code{\LinkA{cwSnpScreenResult-class}{cwSnpScreenResult.Rdash.class}} instance
\end{Value}
\begin{Author}\relax
Vince Carey \textless{}stvjc@channing.harvard.edu\textgreater{}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
if (!exists("hmceuB36.2021")) data(hmceuB36.2021)
# condense to founders only
hmFou = hmceuB36.2021[, which(hmceuB36.2021$isFounder)]
# show basic formula fit
f1 = gwSnpTests(genesym("CPNE1")~male, hmFou, chrnum(20))
f1
plot(f1)
# show how to avoid adjusted fit
f1b = gwSnpTests(genesym("CPNE1")~1-1, hmFou, chrnum(20))
# show gene set modeling on chromosome
library(GSEABase)
gs1 = GeneSet(c("CPNE1", "ADA"))
geneIdType(gs1) = SymbolIdentifier()
f2 = gwSnpTests(gs1~male, hmFou, chrnum(20))
f2
names(f2)
plot(f2[["ADA"]])
# show 'smlSet-wide' fit
f3 = gwSnpTests(gs1~male, hmFou)
f3
# now use a phenoVar
f3b = gwSnpTests(phenoVar("persid")~male, hmFou, chrnum(20))
topSnps(f3b)
## Not run: 
# in example() we run into a problem with sys.call(2); works
# in interpreter
f4 = gwSnpTests(gs1~male, hmFou, snpdepth(250), chunksize(1))
f4
  
## End(Not run)
\end{ExampleCode}
\end{Examples}

