\HeaderA{searchMetlin}{Search Metlin Online Database}{searchMetlin}
\aliasA{searchMetlin,xcmsFragments-method}{searchMetlin}{searchMetlin,xcmsFragments.Rdash.method}
\keyword{methods}{searchMetlin}
\begin{Description}\relax
A method for searching \eqn{MS^2}{} data against the accurate \eqn{MS^2}{} METLIN database
\end{Description}
\begin{Usage}
\begin{verbatim}
searchMetlin(object, ppmfrag=10, ppmMZ= 5, file, MS1data=FALSE,
metXML="metlin", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] An xcmsFragment object generated by xcmsRaw.collect
\item[\code{ppmfrag}] Error in ppm for each fragment
\item[\code{ppmMZ}] Error in ppm for precursor mass
\item[\code{file}] Name of the results file
\item[\code{MS1data}] Should accurate mass alone be search as well
\item[\code{metXML}] location of metlin like XML file or "metlin" as a
default
\item[\code{...}] Arguments to plot.metlin()
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This method automates the task of MS/MS comparison to a reference library. By default the METLIN database is used however this can be changed with the \code{metXML} parameter. 

The search first identifies precursors that match entries in the current METLIN databass using the specified error given by \code{ppmMZ}. Once a matching m/z value is found, MS/MS data is searched. Each fragment is identified and comparied to the reference fragments with error specified by\code{ppmfrag}. Each match is done using a score schema of the difference and similarity of the two spectra. This value is the equiovacated against the possible maximum and minimum.

For each match a plot of the two MS/MS spectra are given. These are found using the \code{A} and \code{B} parameter
\end{Details}
\begin{Value}
A data frame with the following columns:

\begin{ldescription}
\item[\code{A}] Location of the plot
\item[\code{B}] Seconded number locator for plot
\item[\code{Precursor Ion}] M/Z of the precursor Ion
\item[\code{rtmin}] Start of rt window
\item[\code{rtmax}] End of rt window
\item[\code{CollisionEnergy experiment"}] Collision energy of the experiment
\item[\code{CollisionEnergy Reference}] Collision energy of the reference
\item[\code{Percentage Match"}] Match percentage of the reference spectra to the experimental spectra
\item[\code{Metlin Mass}] The mass of the reference precursor ion
\item[\code{\# matching"}] The number of matching fragment
\item[\code{\# non-matching}] The number of non-matching fragments
\item[\code{Total \# Ref ion}] The total number of fragment reference ions
\item[\code{Metlin ID Name}] Name of the identified meatbolite
\item[\code{Ionization}] Is the reference spectra in '-' mode or '+' mode
\item[\code{Adduct}] Is the reference spectra an adduct of the precursor
\end{ldescription}
\end{Value}
\begin{Author}\relax
H. Paul Benton, \email{hpbenton@scripps.edu}
\end{Author}
\begin{References}\relax
H. Paul Benton, D.M. Wong, S.A.Strauger, G. Siuzdak "XC\eqn{MS^2}{}"
Analytical Chemistry 2008
\end{References}

