\name{dbCalculateRegulations}
\alias{dbCalculateRegulations}
\title{Calculate regulation values from expression values in the database}
\description{
  \code{dbCalculateRegulations} calculates regulation values (M values, log2 fold change values) from expression values retrieved from the database and inserts these regulation values in the according database table (database tables \code{comparisons} and \code{regulation\_values}, see the vignette for more information (\code{\link{openMadbVignette}})).
}
\usage{
dbCalculateRegulations(Con,exp.title,comparisons,v=TRUE)
}
\arguments{
  \item{Con}{The connection to the database (see \code{dbConnect} from the
  \pkg{RdbiPgSQL} package).} 
  \item{exp.title}{The tile of the microarray experiment (data set) for which
  the regulation values should be calculated. Note that it is only possible to
  calculate regulation values for comparisons of arrays within a microarray
  experiment, which means that this regulation values can only be  calculated
  for two color arrays or Affymetrix GeneChips which were normalized
  together.} 
  \item{comparisons}{A list of comparisons for which M and A values should be
  calculated. To calculate regulation values for the first three chips of an
  experiment (comparing the expression values of the features/probe sets of
  the second signal channel (array) with those of the first (control) and of
  the third chip to those of the first) submit \code{list(c(2,1),c(3,1))}. Use
  the function \code{\link{dbGetExperimentInfo}} to get information of the
  arrays/signal channels of a experiment and the according index of the signal
  channels in this experiment. }
  \item{v}{If \code{TRUE} the progress of the calculation is shown using a
  progress bar.} 
}
\details{
This function allows to calculate regulation values comparing expression
values from two signal channels of a microarray experiment (dataset) in the
maDB database. The according comparisons will be inserted into a database
table called \code{comparisons} whichs attribute \code{r\_signal\_channel}
links to the signal channel that was used as sample and whichs attribute
\code{g\_signal\_channel} links to the signal channel that was used as control
sample. The regulation values are calculated using the formula \code{M=r-g}
and \code{A=0.5*(r+g)} where \code{r} and \code{g} are the expression values
in log2 scale. The regulation values (M and A values) are inserted into a
database table called \code{regulation\_values}. 
Regulation values can be fetched from the database using the
\code{\link{getMDB}} function. The function \code{\link{dbGetComparisons}} can
be used to get informations which samples were compared in the comparisons in
the database. 
}
\author{Johannes Rainer}

\seealso{
	\code{\link{dbGetExperimentInfo}}
	\code{\link{dbGetComparisons}}
}


\keyword{data}