\HeaderA{HM2rac}{compute rare allele count from a hapmap file}{HM2rac}
\aliasA{countRare}{HM2rac}{countRare}
\aliasA{df2snpMeta}{HM2rac}{df2snpMeta}
\aliasA{getRare}{HM2rac}{getRare}
\aliasA{thinHM2meta}{HM2rac}{thinHM2meta}
\aliasA{thinHM2rac}{HM2rac}{thinHM2rac}
\keyword{models}{HM2rac}
\begin{Description}\relax
compute rare allele count from a hapmap file
\end{Description}
\begin{Usage}
\begin{verbatim}
HM2rac(fn, comment.char="", kppref="NA")
thinHM2rac(gzfn)
countRare(x)
getRare(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{fn}] filename string identifying hapmap genotyping file
\item[\code{gzfn}] filename string identifying gzipped hapmap genotyping file
\item[\code{x}] string vector of simple genotype calls (e.g., "AA") 
\item[\code{comment.char}] string identifying comment character
token for read.table, should not be sharp sign because hapmap
will use this in the header line 
\item[\code{kppref}] a character token that must be present to
identify a sample header column.  I.e., if kppref is "NA"
then a column with header tag NAnnnnn will be kept but
a column with header chrom will be dropped.
\end{ldescription}
\end{Arguments}
\begin{Value}
HM2rac returns a list including elements
raremat: named character matrix with one row per snp and one column
per sample, with snps named by rs numbers

alleles: named vector showing existing alleles at snp

rarealleles: named vector identifying base of rare allele

anno: character string for annotation indirection

countRare and getRare are simple string processing functions

\code{thinHM2meta} will create a \code{\LinkA{snpMeta-class}{snpMeta.Rdash.class}} structure from a HapMap gzipped genotyping
file.
\end{Value}
\begin{Author}\relax
Vince Carey <stvjc@channing.harvard.edu>
\end{Author}
\begin{Examples}
\begin{ExampleCode}
fi = system.file("fileDemos/geno20demo.txt.gz", package="GGtools")
racstr =  thinHM2rac(fi)
names(racstr)
racstr$rarecount[1:5,1:7]
racstr$rarebase[1:6]
racstr$alleles[1:6]
getRare(c("AA", "AG", "GG", "GG"))
countRare(c("AA", "AG", "GG", "GG"))
\end{ExampleCode}
\end{Examples}

