setCategory {HTqPCR} | R Documentation

## Assign categories to Ct values from qPCR data.

### Description

Data in qPCRset objects will have feature categories ("Unreliable", "Undetermined") assigned to them based on different Ct criteria.

### Usage

    setCategory(q, Ct.max = 35, Ct.min = 10, replicates = TRUE, quantile = 0.9, groups, flag = TRUE, flag.out = "Failed", verbose = TRUE, plot = FALSE, ...)

### Arguments

`q` | qPCRset object.
`Ct.max` | numeric, the maximum tolerated Ct value. Everything above this will be "Undetermined".
`Ct.min` | numeric, the minimum tolerated Ct value. Everything below this will be "Unreliable".
`replicates` | logical, should Ct values from genes replicated within each sample be collapsed for the standard deviation.
`quantile` | numeric from 0 to 1, the quantile interval accepted for standard deviations. See details. `NULL` means that variation between replicates is not used for setting the categories.
`groups` | vector, grouping of cards, for example biological or technical replicates. `NULL` means that variation between groups os samples is not assessed, same as for setting `quantile=NULL`.
`flag` | logical, should categories also be set to "Unreliable" according to the content of `flag(q)`.
`flag.out` | character vector, if `flag=TRUE`, what are the flag(s) to be set as "Unreliable".
`verbose` | logical, should a summary about category counts per sample be printed to the prompt.
`plot` | logical, should some plots of the standard deviations be created.
`...` | any other arguments are passed to `plot`.

### Details

Categories can be assigned to the `featureCategory` of the qPCRset using either just simple criteria (max/min of Ct values or `flag` of `q`) or by looking at the standard deviation of Ct values across biological and technical replicates for each gene.

When looking at replicates, the standard deviation and mean are calculated and a normal distribution following these parameters is generated. Individual Ct values that are outside the interval set by `quantile` are set as "Unreliable". So if e.g. `quantile=90` the values outside the top 5% and lower 5% of the normal distribution with the given mean and standard deviation are removed.

"Undetermined" has priority over "Unreliable", so if a value is outside `quantile` but also above `Ct.max` it will be "Undetermined".

NB: When setting categories based on replicates, the Ct values are assumed to follow a normal distribution. This might not be the case if the number of samples within each group is small, and there are no replicates on the genes within each sample.

If the number of replicates vary significantly between biological groups, this will influence the thresholds used for determining the range of "OK" Ct values.

### Value

If `plot=TRUE` one figure per sample group is returned to the current graphics device. A qPCRset with the new feature categories is returned invisibly.

### Note

It's adviced to try several different values for `quantile`, depending on the input data set. Using the function `PlotCtCategory(..., by.feature=FALSE)` or `plotCtCategory(..., by.feature=TRUE)` might help assess the result of different `quantile` choices.

### Author(s)

Heidi Dvinge

### See Also

`filterCategory`, `plotCtCategory`

### Examples

    # Load example data
    data(qPCRraw)
    exFiles <- read.delim(file.path(system.file("exData", package="HTqPCR"), "files.txt"))
     # Set categories in various ways
    setCategory(qPCRraw, flag=FALSE, quantile=NULL)

[Package HTqPCR version 1.42.0 Index]