\name{AStream-package}
\alias{AStream-package}
\alias{AStream}
\docType{package}
\title{AStream: An R package for annotating LC/MS metabolomic feature data}
\description{An R package for the annotation of LC/MS metabolomic data. Identifies isotope, adduct and fragment peaks corresponding to the same molecular compound using 
intensity correlation, retention time and m/z differences between feature pairs.}
\details{
\tabular{ll}{
Package: \tab AStream\cr
Type: \tab Package\cr
Version: \tab 2.0\cr
Date: \tab 2013-12-01\cr
License: \tab GPL (>=2)\cr
LazyLoad: \tab no\cr
}
}
\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{printresults}}, \code{\link{plotcompound}}.}
\examples{
## Analysis of metabolomic LC/MS data from 20 human serum samples

## Loading example data: This command loads an example dataset on 
## a list containing two objects, \code{data} and \code{class}.
data(astream.data,package="AStream")

## Normalize intensities, search for outliers and feature pairs selection. 
## A feature pair is selected if the correlation between the two features exceeds 0.7 and
## their retetion time difference is less than the default (3).
feat <- data.norm(input, min.corr = 0.7)

## Extra pre-filtering based on expected m/z differences can be performed using extra arguments.
## In this example feature pairs must also fulfill an expected m/z difference depending on the
## related isotopes and adducts differences. \code{adducts = c()} uses the default list of isotopic
## and adduct patterns for positive ionization mode \code{mode = "+"}. \code{mz.tol} defines a 
## tolerance window for m/z measurements.
feat <- data.norm(input, min.corr = 0.7, mode = "+", mz.tol = 1e-2, adducts = c())

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

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

## Format and export results: \code{range} defines the window aroung the feature m/z value where HMDB compounds
## are searched. In this example, HMDB search is restricted to blood and urine compounds. \code{nfg_min = 1} rules out
## features with any related feature meeting an isotopic or adduct pattern.
data  <- astream.annotate(feat, res, range = 1e-2, mode = "+", nfg_min = 1, output = "results.txt", location = c("blood","urine"))

## Create web report
web.report(feat,res,"results.txt",dataset.name="AStream example", output.dir = "web_report")

## Check compound profiles along all samples from any particular identified compound of interest
plotcompound(1338, feat, res)
plotcompound(158, feat, res)
plotcompound(285, feat, res)
plotcompound(733, feat, res)
plotcompound(818, feat, res)
}
