ratioFitFromCa {CalciOMatic} | R Documentation |
The function ratioFitFromCa
performs a fit on an intracellular
calcium concentration transient. The transient is fitted with a mono-
or a biexponential decay, depending on the value of type
ratioFitFromCa(Ca, t, tOn, type = "mono", ig = NULL, Plot = FALSE, Fit = TRUE, AfterPeak = FALSE)
Ca |
a vector of calcium concentration (in muM) |
t |
a vector of latencies at which the calcium concentration was obtained (is s) |
tOn |
the time of the calcium concentration jump (in s) |
type |
a character string (either "mono" or "bi" ),
specifying the type of calcium exponential decay to consider |
ig |
an object of class "initial_guess" , giving values of
the calcium dynamics parameters to initiate the fitting process with
using nls . This is a list with the following fields:
("log_Ca0" , "log_dCa" , "log_tau" for a
monoexponential decay, eventually "mu" and "log_dtau"
for a biexponential decay). If ig is not an object of class
"initial_guess" , initial guesses are estimated using the
"igRatio" function |
Plot |
a logical value. Set to TRUE to plot the original
signals, the initial guess and the fit results |
Fit |
a logical value. Set to TRUE to perform the fit, or
to FALSE to compute an initial guess only |
AfterPeak |
a logical or numerical value. Set to FALSE to perform the
fit on the whole fluorescence transients, to TRUE to consider
only the part before the fluorescence jump and the convex part after the
fluorescence peak, for both signals, or to an integer to skip a
given number of samples after the fluorescence jump |
This function can be used to fit any signal made with a first part
corresponding to a baseline signal, then an (almost) instantaneous
rise, and a mono- or bi-exponential return to baseline. Since the
logarithm of all parameters (Ca0
, dCa
and tau
)
are fitted, the baseline and jump must be positive values.
This function uses optim
to minimize the following residual sum
of squares (RSS):
RSS_ratio(theta_Ca) = (ca-[Ca^2+](t,theta_Ca))^T * Omega^-1 * (ca-[Ca^2+](t,theta_Ca))
where theta_Ca stands for the parameters of the calcium dynamics model, ca is the vector of calcium concentration estimated by the ratiometric concentration and Omega is the covariance matrix of the calcium signal. This covariance matrix is obtained with a first-order Taylor expansion of ca (see Joucla et al. (2009) for details).
The initial guesses for the calcium dynamics parameters, if not given
in "ig"
, are calculated with the igRatio
function
An object of class "ratio_fit_optim"
, which has the following
attributes:
"Name" |
a character string telling which type of fit has been performed |
"type" |
a copy of arg type |
"Time" |
a copy of arg t |
"tOn" |
a copy of arg tOn |
"FitFunction" |
the function passed to the optim formula |
"RawData" |
a copy of arg Ca |
"RSSFunction" |
the function that returns the residual sum of squares |
"Subset" |
the indices of the Time vector used for the
fit |
"VocChol" |
the inverse of the Cholesky decomposition of the covariance matrix |
Sebastien Joucla sebastien.joucla@parisdescartes.fr
transientConvexPart
,
caFromDf
,
igRatio
,
ratioFitFromDf
## Load the data from cockroach olfactory interneurons data(inVitro) ## Calibrated parameters R_min <- list(value=0.136, mean=0.136, se=0.00363, USE_se=TRUE) R_max <- list(value=2.701, mean=2.701, se=0.151, USE_se=TRUE) K_eff <- list(value=3.637, mean=3.637, se=0.729, USE_se=TRUE) K_d <- list(value=0.583, mean=0.583, se=0.123, USE_se=TRUE) ## Create the data frame containing the physiological data ## (experiment #2, stimulation #2) ## G and s_ro are the respectively the gain of the CCD camera ## and the standard deviation of its read-out process physioData <- ratioExpPhysio(dataset="inVitro", expe=2, stim=2, idxOn=10, R_min=R_min, R_max=R_max, K_eff=K_eff, K_d=K_d, G=0.146, s_ro=16.4, alphamethod=FALSE) ## Retrieve the calcium concentration from the data frame Ca_noisy <- caFromDf(df = physioData, numTransient = 2, Plot = FALSE) ## Perform a ratiometric fit physioRatioFit <- ratioFitFromCa(Ca = Ca_noisy, t = attr(Ca_noisy,"Time"), tOn = attr(Ca_noisy, "tOn"), type = "mono", AfterPeak = 14)