kmeansClassify {twoddpcr} | R Documentation |
ddpcrWell
or
ddpcrPlate
object, or in a data frame.If droplets
is a data frame, the droplets are classified
using the k-means clustering algorithm.
For ddpcrWell
, the droplets are classified by using the
k-means clustering algorithm.
For ddpcrPlate
, all of the wells are combined and
classified, with this new classification assigned to the
ddpcrPlate
object.
kmeansClassify(droplets, centres = matrix(c(0, 0, 10000, 0, 0, 7000, 10000, 7000), ncol = 2, byrow = TRUE), ...) ## S4 method for signature 'data.frame' kmeansClassify(droplets, centres = matrix(c(0, 0, 10000, 0, 0, 7000, 10000, 7000), ncol = 2, byrow = TRUE), fullTable = TRUE) ## S4 method for signature 'ddpcrWell' kmeansClassify(droplets, centres = matrix(c(0, 0, 10000, 0, 0, 7000, 10000, 7000), ncol = 2, byrow = TRUE)) ## S4 method for signature 'ddpcrPlate' kmeansClassify(droplets, centres = matrix(c(0, 0, 10000, 0, 0, 7000, 10000, 7000), ncol = 2, byrow = TRUE))
droplets |
A |
centres |
Either:
Defaults to |
... |
Other options depending on the type of |
fullTable |
If |
An object with the new classification.
If droplets
is a data frame, a list is returned with the
following components:
data |
A data frame or vector corresponding to the classification. |
centres |
A data frame listing the final centre points from the k-means algorithm with the corresponding cluster labels. |
Anthony Chiu, anthony.chiu@cruk.manchester.ac.uk
This method uses the kmeans
function.
To manually set and retrieve classifications, use the
wellClassification
, plateClassification
and
plateClassificationMethod
methods.
For a supervised classification approach, one may want to consider
knnClassify
.
### Use the KRASdata dataset for all of these examples. ## Use K-means clustering to classify droplets into four (the default ## number) classes. aWell <- kmeansClassify(KRASdata[["E03"]]) ## We can look the the classification or the centres. head(aWell$data) aWell$centres ## Specify 3 centres for a different sample in KRASdata. aWell <- kmeansClassify(KRASdata[["H04"]], centres=3) head(aWell$data) ## We can be more specific with the choice of centres. aWell <- kmeansClassify(KRASdata[["H04"]], centres=matrix(c(5000, 1500, 5500, 7000, 10000, 2000), ncol=2, byrow=TRUE)) ## We can use \code{ddpcrWell} objects directly as a parameter. aWell <- ddpcrWell(well=KRASdata[["E03"]]) kmeansClassify(aWell) ## We can take multiple samples in a \code{ddpcrPlate} object and ## classify everything together. krasPlate <- ddpcrPlate(wells=KRASdata) kmeansClassify(krasPlate)