\Header{resolveMaps}{Functions to obtain unified mappings between ids}
\alias{getNoDup}{resolveMaps}
\alias{getUnified}{resolveMaps}
\alias{getVote}{resolveMaps}
\alias{hasDelimit}{resolveMaps}
\keyword{manip}{resolveMaps}
\begin{Description}\relax
These functions are used to obtained unified mappings between between
two sets of ids based on the mappings available from different
sources. Each source provide mappings between two sets of ids.\end{Description}
\begin{Usage}
\begin{verbatim}
resolveMaps(maps, trusted, srcs, colNames = NULL, outName = "", asFile = TRUE)
getVote(voters, sep = "\t")
getUnified(voters)
getNoDup(voters)
hasDelimit(entry, deli = ";") 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{maps}] \code{maps} a matrix with mappings for a set of key ids to
another set of ids provided by different sources. The first column
is assumed to the key ids and the rest are mappings to another set
of ids provided by different sources
\item[\code{trusted}] \code{trusted} a vector of characters to indicate the
column number of "maps" whose mappings are more reliable and should
be used when there are conflicts
\item[\code{srcs}] \code{srcs} a vector of character strings for the names of
columns that contain mappings from different sources
\item[\code{colNames}] \code{colNames} a vector of character strings for the
names of columns in "maps"
\item[\code{outName}] \code{outName} a character string for the name of the
file to contain the unified mappings
\item[\code{asFile}] \code{asFile} a boolean to indicate whether the unfied
mappings will be saved as a file
\item[\code{voters}] \code{voters} a vector containing mappings from
different sources
\item[\code{entry}] \code{entry} a character string to be checked for the
existence of a separater
\item[\code{deli}] \code{deli} a character string for a separator
\item[\code{sep}] \code{sep} same as deli
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Each source may have different mappings from the key ids to another
set of ids. \code{\Link{resolveMaps}} resolves the confilicts and
derives a set of unified mappings based on the mappings provided from
several sources.

\code{\Link{getVote}} resolves the mappings for a given key id and
returns a vector with unified mapping and the number of sources that
agree with the unified mapping.

\code{\Link{getUnified}} finds agreement among values in a vactor
passed. If some values agree, get the one agreed by mose sources.

\code{\Link{getNoDup}} gets a value based on predefined rules when
values from different sources do not agree.

\code{\Link{hasDelimit}} checks to see if a delimiter exists\end{Details}
\begin{Value}
\code{\Link{resolveMaps}} returns a matrix with the first colum being
the key id set, second being the unified mappings to another id set,
and third the total number of agreements found among sources.

\code{\Link{getVote}} returns a two element vector.

\code{\Link{getUnified}} returns a character string.

\code{\Link{getNoDup}} returns a character string.

\code{\Link{hasDelimit}} returns TRUE or FALSE.\end{Value}
\begin{Note}\relax
The functions are part of the Bioconductor project at Dana-Farber
Cancer Institute to provide Bioinformatics functionalities through R\end{Note}
\begin{Author}\relax
Jianhua Zhang\end{Author}
\begin{SeeAlso}\relax
\code{\Link{LL-class}}, \code{\Link{UG-class}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
maps <- matrix(c("id1", "a", "a", "b", "id2", "c","d", "c",
"id3", "e","e", "e", "id4", NA, "f", NA, "id5", "g", NA, "h", "id6", NA,
"NA", "i", "id7", NA, NA, NA), ncol = 4, byrow = TRUE)
unified <- resolveMaps(maps, c("srcll", "srcug"),
c("srcll", "srcug", "srcgeo"),
colNames = c("key1", "srcll", "srcug", "srcgeo"), outName = "",
asFile = FALSE)
\end{ExampleCode}
\end{Examples}

