\HeaderA{snpScreen}{compute model fits over a sequence of SNPs}{snpScreen}
\aliasA{extract\_p}{snpScreen}{extract.Rul.p}
\aliasA{fastAGM}{snpScreen}{fastAGM}
\aliasA{fastHET}{snpScreen}{fastHET}
\aliasA{plot\_mlp}{snpScreen}{plot.Rul.mlp}
\aliasA{show,snpScreenResult-method}{snpScreen}{show,snpScreenResult.Rdash.method}
\aliasA{snpScreen,racExSet,snpMeta,genesym,formula,function,numeric-method}{snpScreen}{snpScreen,racExSet,snpMeta,genesym,formula,function,numeric.Rdash.method}
\aliasA{snpScreenResult-class}{snpScreen}{snpScreenResult.Rdash.class}
\keyword{models}{snpScreen}
\begin{Description}\relax
compute model fits over a sequence of SNPs
\end{Description}
\begin{Usage}
\begin{verbatim}
snpScreen(racExSet, snpMeta, gene, formTemplate, fitter, gran, ...)
extract_p(ssr)
plot_mlp(ssr, snpMeta, ps = NULL, pch = 20, cex = 0.5, local=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{racExSet}] instance of \code{\LinkA{racExSet-class}{racExSet.Rdash.class}}
\item[\code{snpMeta}] instance of \code{\LinkA{snpMeta}{snpMeta}}
\item[\code{gene}] instance of \code{\LinkA{genesym}{genesym}} class identifying
the expression phenotype to be regarded as dependent variable
\item[\code{formTemplate}] a formula having form \code{\textasciitilde{}.} or
\code{\textasciitilde{}factor(.)}, literally, to specify additive or
nonadditive models for effects of rare allele copy number
\item[\code{fitter}] R fitting function that can work with formulas
and data frames, for example \code{\LinkA{lm}{lm}}, or, if not a
fitting function, a special function in the package, either
\code{fastHET}, or \code{fastAGM}, see details below
\item[\code{gran}] a numeric convenience parameter; if not 1, SNPs will
be deterministically selected with frequency 1/\code{gran} along the
linear sequence in the racExSet racAssay structure 
\item[\code{...}] \dots -- not in use
\item[\code{ssr}] \code{snpScreenResult} instance
\item[\code{ps}] a string with a probe set identifier
\item[\code{pch}] for passage to \code{\LinkA{scatterSmooth}{scatterSmooth}}
\item[\code{cex}] for passage to \code{\LinkA{scatterSmooth}{scatterSmooth}}
\item[\code{local}] by default (local=FALSE) the plot is made over the
entire chromosome; if local==TRUE, the plot is made over the
segment of the chromosome within which the snps screened lie;
this only makes a difference if the racExSet used in the screen
has been SNP-filtered relative to the HapMap SNP set. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
for snpScreen:
If \code{options()\$verbose == TRUE} then every 100th index in the
vector of snps is printed to stdout to show rate of progress.

\code{snpScreenResult} is a container for relevant information
about a screen, including a list of fit objects.

For result processing, many SNPs have no variation in observed
samples and statistical tests of association are indeterminate.
NAs will be returned for tests on such SNPs.

\code{fastAGM} is a C routine for simple least square fitting
of an additive genetic model.  \code{fastHET} will compare heterozygous
to homozygous.

\code{plot\_mlp} returns a list of x and y values for the
plotted points.
\end{Details}
\begin{Value}
creates a list of model fit results; \code{\LinkA{try}{try}} is used to
allow failure of fit (e.g., \code{\LinkA{lm}{lm}} may fail if a singular
model matrix is computed
\end{Value}
\begin{Author}\relax
Vince Carey <stvjc@channing.harvard.edu>
\end{Author}
\begin{Examples}
\begin{ExampleCode}
example(make_racExSet)
dem
dem = exclMono(dem)
snpNames(dem)[1:4]
featureNames(dem)[1:4]
data(chr20meta)
scr1 = snpScreen(dem, chr20meta, genesym("DDR1"), ~., lm,  gran=100 )
scr1[[1]]
scr2 = snpScreen(dem, chr20meta, genesym("DDR1"), ~factor(.), lm,  gran=200 )
scr2[[1]]
plot_mlp(scr1, chr20meta)
chr20GGdem = exclMono(chr20GGdem)
ut = unix.time(scr2 <- snpScreen(chr20GGdem, chr20meta, genesym("CPNE1"), ~factor(.), fastAGM, 50))
ut
scr2
plot_mlp(scr2, chr20meta)
\end{ExampleCode}
\end{Examples}

