\name{isotope.search}
\alias{isotope.search}
\title{Method for identifying Carbon isotope patterns}
\description{
Identification of Carbon isotope patterns corresponding to the Carbon-12 and the two first Carbon-13 isotope peaks from the same molecular compound.
}
\usage{
isotope.search(ftlist, mz.tol = 3e-3, min_samples = 5, max_ratio = 0.8, n_std = 5, fplot = TRUE)
}
\arguments{
  \item{ftlist }{ feature list as returned by \code{\link{data.norm}}.}
  \item{mz.tol }{ tolerance for M/Z values.}
  \item{min_samples }{ Minimum number of feature pairs matching the isotopic pattern to fit a linear regression model between m/z and intensity ratio.}
  \item{max_ratio }{ Upper intensity ratio threshold to consider a feature pair as an isotopic pattern.}
  \item{n_std }{ inclusion threeshold for the LR model. Linear regression fitting is performed iteratively until any feature pair resulting residuals exceed n_std times the residuals standar deviation.}
  \item{fplot }{ logical, if \code{'TRUE'} summary figures are plotted.}
}
\details{
\code{isotope.search} returns the same list as the introduced input argurment \code{'ftlist'}. A list of identified 
isotope patterns is added to the list.
}
\value{
  \item{isotopes }{ matrix of isotope patterns is included in the input argument \code{'ftlist'}. Each line is related to a matched isotope pattern.}
}
\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{adduct.search}}, \code{\link{printresults}}, \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)
## Identify Carbon isotopes
feat <- isotope.search(feat, mz.tol = 1e-2)
## Show results
feat$isotopes[1:min(15,dim(feat$isotopes)[1]),]
## Plot fitting residuals of the 13C1 isotopic patterns
plot(feat$isotopes[,7],xlab="isotopic pattern (13C1)",ylab="residuals/std(residuals))")
## Plot fitting residuals of the 13C2 isotopic patterns
plot(feat$isotopes[,8],xlab="isotopic pattern (13C2)",ylab="residuals/std(residuals))")
}
