\name{astream.annotate}
\alias{astream.annotate}
\title{FORMATTING AND EXPORTING RESULTS}
\description{Function for formatting and exporting the obtained results}
\usage{
astream.annotate(ftlist, results, range = 0.01, mode = "+", location = c(), nfg_min = 0, output = "")
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{ftlist }{ list returned by \code{\link{isotope.search}}.}
  \item{results }{ matrix returned by \code{\link{adduct.search}}.}
  \item{range }{ m/z tolerance around the identified features m/z for identifying compounds within the HMDB database.}
  \item{mode}{ ionization mode ("+" or "-").}
  \item{location}{ Allowed biofluid and tissue metabolite locations.}
  \item{nfg_min}{ Minimum number of related features (isotopic/adduct patterns) to export a given feature.}
  \item{output }{ filename where results will be saved.}
}
\details{
}
\value{
%%  ~Describe the value returned
%%  If it is a LIST, use
%%  \item{comp1 }{Description of 'comp1'}
%%  \item{comp2 }{Description of 'comp2'}
%% ...
  \item{id }{ Feature ID.}
  \item{MZ }{ Feature m/z value.}
  \item{MassSubmitted }{ Expected feature monoisotopic mass (i.e. MZ-H in positive ionization mode).}
  \item{RT }{ Feature retention time value.}
  \item{FoldChange }{ Intensity fold change between groups.}
  \item{N1 }{ Number of samples (group 1).}
  \item{N2 }{ Number of samples (group 2).}
  \item{P-value }{ P-Value.}
  \item{Metlin }{ Link to Metlin.}
  \item{REF.NFG }{ Number of related features (isotopic/adduct patterns).}
  \item{REF.13C#1-isotope }{ Related 13C1 isotopic feature.}
  \item{REF.13C#2-isotope }{ Related 13C2 isotopic feature.}
  \item{REF.Adducts }{ Related adduct features.}
  \item{NOTREF.NFG }{ Number of times the feature has been related to another feature.}
  \item{NOTREF.LABELS }{ Related isotopic/adduct features.}
  \item{HMDB.N }{ Number of HMDB hits.}
  \item{HMDB.MATCHS }{ HMDB hits.}
}
\references{
  http://www.hmdb.ca
}
\author{A.Alonso, et al. Grup de Recerca de Reumatologia 2010, bioinformatics@urr.cat.}
\seealso{\code{\link{xcms.import}}, \code{\link{data.norm}}, \code{\link{isotope.search}}, \code{\link{adduct.search}}, \code{\link{plotcompound}}.}
\examples{
## Load example data
data(astream.data, package="AStream")

## Normalize intensities, search for outliers and feature pairs selection
feat <- data.norm(input, min.corr = 0.7, mode = "+", mz.tol = 1e-2, adducts = c())

## Identify Carbon isotopes
feat <- isotope.search(feat, mz.tol = 1e-2)

## Search for adducts
res   <- adduct.search(feat, mz.tol = 1e-2, onlyIsotopes = FALSE, mode = "+")

## Save results to file
data  <- astream.annotate(feat, res, range = 1e-2, mode = "+", nfg = 1, output = "results.txt", location = c("blood","urine"))
}