\HeaderA{Strains2rac}{convert a Wellcome 'Strains' genotyping file to rare allele count form}{Strains2rac}
\aliasA{INB34snpMeta}{Strains2rac}{INB34snpMeta}
\aliasA{INBREDSworkflow}{Strains2rac}{INBREDSworkflow}
\keyword{models}{Strains2rac}
\begin{Description}\relax
convert a Wellcome 'Strains' genotyping file to rare allele count form,
or create a racExSet using such a file
\end{Description}
\begin{Usage}
\begin{verbatim}
Strains2rac(strfile)
INBREDSworkflow(inbfile, emat, estrains, pd, mi, anno, fixup= NULL, fixchr =
     function(x) gsub("_random", "", x))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{strfile}] name of the text file to be converted
\item[\code{inbfile}] name of the text file to be converted
\item[\code{emat}] matrix of expression data 
\item[\code{estrains}] character vector of strains corresponding to
columns of \code{emat}
\item[\code{pd}] \code{\LinkA{AnnotatedDataFrame-class}{AnnotatedDataFrame.Rdash.class}} instance for \code{emat}
\item[\code{mi}] \code{\LinkA{MIAME-class}{MIAME.Rdash.class}} instance
\item[\code{anno}] character string for annotation environment package
\item[\code{fixup}] transformation from columns of strain genotype file \code{strfile}
to \code{estrains} tokens, if necessary
\item[\code{fixchr}] modify the chromosome tags if necessary 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\end{Details}
\begin{Value}
\code{Strains2rac} creates a list with genotype matrix, chr and pos

\code{INBREDSworkflow} creates a list with components \code{\LinkA{racExSet}{racExSet}} and
\code{\LinkA{snpMetaWhole}{snpMetaWhole}} (because the INBREDS files are whole-genome, not
chromosome specific)
\end{Value}
\begin{Note}\relax
See the commented example for build 34 Wellcome Inbreds file for
BXD strains, \code{INB34snpMeta}.
\end{Note}
\begin{Author}\relax
Vince Carey <stvjc@channing.harvard.edu>
\end{Author}
\begin{References}\relax
\end{References}
\begin{SeeAlso}\relax
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
fi = system.file("fileDemos/StrainInit.txt", package="GGtools")
dem = Strains2rac(fi)
names(dem)
dim(dem[[1]])
data(gse2031GG)
fixbxd = function(x) {
# because such various labels are used in the INBREDS file
 gsub("BXD\\.", "BXD", gsub(".Ty", "", gsub(".TyJ", "", x)))
}
INBREDSworkflow( fi, exprs(gse2031GG), as.character(gse2031GG$str),
        phenoData(gse2031GG), new("MIAME"), "mgu74av2", fixbxd )
#
# the real INB34snpMeta structure is built by
# fixchr = function(x) gsub("_random", "", x)
#INBREDSworkflow( "Strains-0.09052005.txt", exprs(gse2031GG), as.character(gse2031GG$str),
#       phenoData(gse2031GG), new("MIAME"), "mgu74av2", fixbxd, fixchr )
\end{ExampleCode}
\end{Examples}

