flatPlot: Plot droplet amplitudes with all droplets classified as "N/A"...

Description Usage Arguments Value Author(s) Examples

View source: R/flatPlot.R

Description

There are occasions where classification algorithms fail for various reasons (such as poor choice/number of centres in k-means clustering). In these cases, it may be helpful to the user if an app draws a 'flat' plot with just one colour rather than nothing at all.

If a ddpcrWell object is given as a parameter, plot the droplets in the well and colour them according to a given class.

If a ddpcrPlate object is given as a parameter, plot the droplets in all wells and colour them according to a given class.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
flatPlot(
  droplets,
  ch1Label = "Ch1 Amplitude",
  ch2Label = "Ch2 Amplitude",
  classString = ddpcr$na,
  initialCentres = NULL,
  selectedCentre = NULL,
  plotLimits = list(x = c(1000, 9000), y = c(3000, 13500))
)

## S4 method for signature 'data.frame'
flatPlot(
  droplets,
  ch1Label = "Ch1 Amplitude",
  ch2Label = "Ch2 Amplitude",
  classString = ddpcr$na,
  initialCentres = NULL,
  selectedCentre = NULL,
  plotLimits = list(x = c(1000, 9000), y = c(3000, 13500))
)

## S4 method for signature 'ddpcrWell'
flatPlot(
  droplets,
  ch1Label = "Ch1 Amplitude",
  ch2Label = "Ch2 Amplitude",
  classString = ddpcr$na,
  initialCentres = NULL,
  selectedCentre = NULL,
  plotLimits = list(x = c(1000, 9000), y = c(3000, 13500))
)

## S4 method for signature 'ddpcrPlate'
flatPlot(
  droplets,
  ch1Label = "Ch1 Amplitude",
  ch2Label = "Ch2 Amplitude",
  classString = ddpcr$na,
  initialCentres = NULL,
  selectedCentre = NULL,
  plotLimits = list(x = c(1000, 9000), y = c(3000, 13500))
)

Arguments

droplets

A data frame of droplet amplitudes, or a ddpcrWell or ddpcrPlate object.

ch1Label

The label for the channel 1 target. Defaults to "Ch1 Amplitude".

ch2Label

The label for the channel 2 target. Defaults to "Ch2 Amplitude".

classString

The class that all droplets should be classified as. Defaults to the ddpcr$na ("N/A") character string.

initialCentres

A data frame of initial centres to plot (e.g. initial cluster centres used in the k-means). This is _not_ restricted to the class classString only. If NULL, nothing is plotted. Defaults to NULL.

selectedCentre

An initial centre to highlight. This should be either "NN", "PN", "NP" or "PP", but is _not_ restricted to the class 'classString' only. If NULL, nothing is highlighted. Defaults to NULL.

plotLimits

A list of 2-element vectors with names x and y. These are used to fix the x and y limits of the plot, which is especially useful for comparing plots. Defaults to list(x=c(1000, 9000), y=c(3000, 13500)).

Value

A ggplot object in just one colour corresponding to classString.

Author(s)

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Plot the data frame with no classification.
aWell <- KRASdata[["E03"]]
flatPlot(aWell)

## Take a ddpcrWell object that is mostly classified as "NN" and colour it
## as such.
aWell <- KRASdata[["H04"]]
emptiedWell <- aWell[aWell$Cluster == 1, ]
emptiedWell <- ddpcrWell(well=emptiedWell)
flatPlot(emptiedWell, classString="NN")

## Plotting all of a ddpcrPlate object works the same way.
krasPlate <- ddpcrPlate(wells=KRASdata)
flatPlot(krasPlate)

CRUKMI-ComputationalBiology/twoddpcr documentation built on Feb. 14, 2021, 9:18 p.m.