sdRain {twoddpcr} | R Documentation

## Add rain to a classification by using a chosen multiple of standard deviation.

### Description

Although we can use various algorithms to classify all droplets in a ddPCR experiment, there will be some variation between the classifications. We can perhaps have a relatively high confidence that droplets near the centres of clusters do indeed belong to that cluster, whereas we probably have a lower confidence in the classification of those further away, say, near the 'boundary' of two clusters. We may view these droplets (or a subset of them) as having an ambiguous class. This function allows us to only consider droplets classified within a certain distance of the means of each cluster and label the rest as "Rain".

### Usage

    sdRain(droplets, cMethod, errorLevel = 5, ...)

    ## S4 method for signature 'data.frame'
    sdRain(droplets, cMethod, errorLevel = 5, fullTable = TRUE)

    ## S4 method for signature 'ddpcrWell'
    sdRain(droplets, cMethod, errorLevel = 5)

    ## S4 method for signature 'ddpcrPlate'
    sdRain(droplets, cMethod, errorLevel = 5)

### Arguments

`droplets` | A `ddpcrWell` or `ddpcrPlate` object, or a droplet data frame including a classification column.
`cMethod` | The name or column number of the classification for which we want to add rain to.
`errorLevel` | How many multiples of standard deviation from the mean of each cluster to retain. Can be a list where each item corresponds to a class name and the multiple for that class. Can also be a numeric vector of length 1, which is equivalent to a list with all the same entries. Defaults to 5.
`...` | Other options depending on the type of `droplets`.
`fullTable` | If `TRUE`, returns a full data frame of droplets with an extra column of rainy data; if `FALSE`, simply returns a factor where each entry corresponds to an entry in the original classification column with added rain. Defaults to `FALSE`.

### Value

If `droplets` is a data frame, return a data frame or factor (depending on `fullTable`) where droplets with ambiguous classifications are labelled as "Rain".

If `droplets` is a `ddpcrWell` object, return a `ddpcrWell` object with a rainy classification.

If `droplets` is a `ddpcrPlate` object, return a `ddpcrPlate` object with a rainy classifications.

### Author(s)

Anthony Chiu, anthony.chiu@cruk.manchester.ac.uk

### References

This approach was described in Jones, M., Williams, J., Gaertner, K., Phillips, R., Hurst, J., & Frater, J. (2014). Low copy target detection by Droplet Digital PCR through application of a novel open access bioinformatic pipeline, "definetherain." Journal of Virological Methods, 202(100), 46–53. http://doi.org/10.1016/j.jviromet.2014.02.020

### Examples

    ## Compare the types of droplets in a single well for the "Cluster" class
    ## and then with rain.
    aWell <- ddpcrWell(well=KRASdata[["E03"]])
    aWell <- sdRain(aWell, cMethod="Cluster")
    cl <- wellClassification(aWell)
    table(cl$Cluster)
    table(cl$ClusterSdRain)

    ## Compare the types of droplets in multiple wells for the "Cluster" class
    ## and then with rain.
    krasPlate <- ddpcrPlate(wells=KRASdata[c("E03", "H03", "C04", "F04")])
    krasPlate <- sdRain(krasPlate, cMethod="Cluster")
    plateSummary(krasPlate, cMethod="Cluster")[, c(1:5)]
    plateSummary(krasPlate, cMethod="ClusterSdRain")[, c(1:5)]

    ## The 'errorLevel' parameter can changed.
    krasPlate <- sdRain(krasPlate, cMethod="Cluster", errorLevel=4)
    plateSummary(krasPlate, cMethod="ClusterSdRain")[, c(1:5)]

    ## The 'errorLevel' parameter can also be changed for each cluster.
    krasPlate <- sdRain(krasPlate, cMethod="Cluster",
                        errorLevel=list(NN=5, NP=5, PN=4, PP=3))
    plateSummary(krasPlate, cMethod="ClusterSdRain")[, c(1:5)]

[Package twoddpcr version 1.12.0 Index]