gridClassify {twoddpcr} | R Documentation |
Classify droplets as "NN", "NP", "PN" or "PP". The
classification is based on upper bounds for negative readings and lower
bounds for positive readings; see the details and parameters for more
detail. If required (see the trainingData
parameter), droplets that
are not classified will be given the label "N/A".
gridClassify( droplets, ch1NNThreshold = 6500, ch2NNThreshold = 1900, ch1NPThreshold = 6500, ch2NPThreshold = 5000, ch1PNThreshold = 10000, ch2PNThreshold = 2900, ch1PPThreshold = 7500, ch2PPThreshold = 5000, ... ) ## S4 method for signature 'data.frame' gridClassify( droplets, ch1NNThreshold = 6500, ch2NNThreshold = 1900, ch1NPThreshold = 6500, ch2NPThreshold = 5000, ch1PNThreshold = 10000, ch2PNThreshold = 2900, ch1PPThreshold = 7500, ch2PPThreshold = 5000, trainingData = TRUE, fullTable = TRUE, naLabel = ddpcr$rain ) ## S4 method for signature 'ddpcrWell' gridClassify( droplets, ch1NNThreshold = 6500, ch2NNThreshold = 1900, ch1NPThreshold = 6500, ch2NPThreshold = 5000, ch1PNThreshold = 10000, ch2PNThreshold = 2900, ch1PPThreshold = 7500, ch2PPThreshold = 5000, classMethodLabel = "grid", naLabel = ddpcr$rain ) ## S4 method for signature 'ddpcrPlate' gridClassify( droplets, ch1NNThreshold = 6500, ch2NNThreshold = 1900, ch1NPThreshold = 6500, ch2NPThreshold = 5000, ch1PNThreshold = 10000, ch2PNThreshold = 2900, ch1PPThreshold = 7500, ch2PPThreshold = 5000, classMethodLabel = "grid", naLabel = ddpcr$rain )
droplets |
A |
ch1NNThreshold |
The channel 1 upper bound for the NN class. Defaults to 6500. |
ch2NNThreshold |
The channel 2 upper bound for the NN class. Defaults to 1900. |
ch1NPThreshold |
The channel 1 upper bound for the NP class. Defaults to 6500. |
ch2NPThreshold |
The channel 2 lower bound for the NP class. Defaults to 5000. |
ch1PNThreshold |
The channel 1 lower bound for the PN class. Defaults to 10000. |
ch2PNThreshold |
The channel 2 upper bound for the PN class. Defaults to 2900. |
ch1PPThreshold |
The channel 1 lower bound for the PP class. Defaults to 7500. |
ch2PPThreshold |
The channel 2 lower bound for the PP class. Defaults to 5000. |
... |
Other options depending on the type of |
trainingData |
Whether to use the output as training data. If
|
fullTable |
Whether to return a data frame including amplitude
figures. If |
naLabel |
The label to use for unclassified droplets. Should be either ddpcr$na ("N/A") or ddpcr$rain ("Rain"). Defaults to ddpcr$rain. |
classMethodLabel |
A name (as a character string) of the classification method. Defaults to "grid". |
The threshold
parameters correspond to those in the
following diagram:
Ch1 ^ | | | | | | PN | | | | | PP e|________| | g|........:..|_________ | : : c|.............._______ a|______ : : | | | : : | NP | NN | : : | | | : : | ---------------------> b f h d Ch2
Specifically:
ch1NNThreshold
,
ch2NNThreshold
,
ch1PNThreshold
,
ch2PNThreshold
,
ch1NPThreshold
,
ch2NPThreshold
,
ch1PPThreshold
,
ch2PPThreshold
.
If droplets
is a data frame, return a data frame or factor
(depending on the trainingData
and fullTable
parameters) with
a classification for droplets in the chosen regions.
If droplets
is a ddpcrWell
object, return
a ddpcrWell
object with the appropriate classification.
If droplets
is a ddpcrPlate
object, return
a ddpcrPlate
object with the appropriate classification.
Anthony Chiu, anthony.chiu@cruk.manchester.ac.uk
thresholdClassify
is a special case of this
function.
removeDropletClasses
retrieves a data frame with the
"N/A" (and "Rain") droplets removed. This can used for transforming
a grid-like classification into usable training data.
## Use a grid to set training data for a data frame. sgCl <- gridClassify(KRASdata[["E03"]], ch1NNThreshold=5700, ch2NNThreshold=1700, ch1NPThreshold=5400, ch2NPThreshold=5700, ch1PNThreshold=9700, ch2PNThreshold=2050, ch1PPThreshold=7200, ch2PPThreshold=4800) str(sgCl) ## For data frame only, we can set the trainingData flag to FALSE so that ## the unclassified droplets are retained but labelled as "N/A" sgCl <- gridClassify(KRASdata[["E03"]], ch1NNThreshold=5700, ch2NNThreshold=1700, ch1NPThreshold=5400, ch2NPThreshold=5700, ch1PNThreshold=9700, ch2PNThreshold=2050, ch1PPThreshold=7200, ch2PPThreshold=4800, trainingData=FALSE) dropletPlot(sgCl, cMethod="class") ## The same works for ddpcrWell objects. aWell <- ddpcrWell(well=KRASdata[["E03"]]) aWell <- gridClassify(aWell, ch1NNThreshold=5700, ch2NNThreshold=1700, ch1NPThreshold=5400, ch2NPThreshold=5700, ch1PNThreshold=9700, ch2PNThreshold=2050, ch1PPThreshold=7200, ch2PPThreshold=4800) str(aWell) ## ddpcrPlate objects work in exactly the same way. krasPlate <- ddpcrPlate(wells=KRASdata) krasPlate <- gridClassify(krasPlate) lapply(plateClassification(krasPlate, withAmplitudes=TRUE), head, n=1) ## The default classification method (column name) is 'gridClassify', ## which may be a bit long. It can be changed. krasPlate <- gridClassify(krasPlate, classMethodLabel="training") lapply(plateClassification(krasPlate, withAmplitudes=TRUE), head, n=1)