Compute the posterior distributions of RNA synthesis and degradation from snapshot experiments for each condition

## Usage

```
FitKineticsSnapshot(
data,
name.prefix = "Kinetics",
reference.columns = NULL,
slot = DefaultSlot(data),
conditions = NULL,
time.labeling = Design$dur.4sU,
time.experiment = NULL,
sample.f0.in.ss = TRUE,
N = 10000,
N.max = N * 10,
CI.size = 0.95,
seed = 1337,
dispersion = NULL,
sample.level = 2,
correct.labeling = FALSE,
verbose = FALSE
)
```

## Arguments

- data
the grandR object

- name.prefix
the prefix for the new analysis name; a dot and the column names of the contrast matrix are appended; can be NULL (then only the contrast matrix names are used)

- reference.columns
a reference matrix usually generated by FindReferences to define reference samples for each sample (see details), can be NULL if all conditions are at steady state

- slot
the data slot to take f0 and totals from

- conditions
character vector of all condition names to estimate kinetics for; can be NULL (i.e. all conditions)

- time.labeling
the column in the column annotation table denoting the labeling duration or the labeling duration itself

- time.experiment
the column in the column annotation table denoting the experimental time point (can be NULL, see details)

- sample.f0.in.ss
whether or not to sample f0 under steady state conditions

- N
the sample size

- N.max
the maximal number of samples (necessary if old RNA > f0); if more are necessary, a warning is generated

- CI.size
A number between 0 and 1 representing the size of the credible interval

- seed
Seed for the random number generator

- dispersion
overdispersion parameter for each gene; if NULL this is estimated from data

- sample.level
Define how the NTR is sampled from the hierarchical Bayesian model (must be 0,1, or 2; see details)

- correct.labeling
Labeling times have to be unique; usually execution is aborted, if this is not the case; if this is set to true, the median labeling time is assumed

- verbose
Vebose output

## Value

a new grandR object including new analysis tables (one per condition). The columns of the new analysis table are

- "s"
the posterior mean synthesis rate

- "HL"
the posterior mean RNA half-life

- "s.cred.lower"
the lower CI boundary of the synthesis rate

- "s.cred.upper"
the upper CI boundary of the synthesis rate

- "HL.cred.lower"
the lower CI boundary of the half-life

- "HL.cred.upper"
the upper CI boundary of the half-life

## Details

The kinetic parameters s and d are computed using TransformSnapshot. For that, the sample either must be in steady state (this is the case if defined in the reference.columns matrix), or if the levels at an earlier time point are known from separate samples, so called temporal reference samples. Thus, if s and d are estimated for a set of samples x_1,...,x_k (that must be from the same time point t), we need to find (i) the corresponding temporal reference samples from time t0, and (ii) the time difference between t and t0.

The temporal reference samples are identified by the reference.columns matrix. This is a square matrix of logicals, rows and columns correspond to all samples
and TRUE indicates that the row sample is a temporal reference of the columns sample. This time point is defined by `time.experiment`

. If `time.experiment`

is NULL, then the labeling time of the A or B samples is used (e.g. useful if labeling was started concomitantly with the perturbation, and the steady state samples
are unperturbed samples).

By default, the hierarchical Bayesian model is estimated. If sample.level = 0, the NTRs are sampled from a beta distribution that approximates the mixture of betas from the replicate samples. If sample.level = 1, only the first level from the hierarchical model is sampled (corresponding to the uncertainty of estimating the biological variability). If sample.level = 2, the first and second levels are estimated (corresponding to the full hierarchical model).

if N is set to 0, then no sampling from the posterior is performed, but the transformed MAP estimates are returned