1 Introduction

PoDCall (Positive Droplet Caller) is a package that aims to provide a robust calling of positive droplets in DNA methylation droplet digital PCR (ddPCR) experiments performed on the Bio-Rad platform. PoDCall provides functions that reads files exported from QuantaSoft containing amplitudes from a run of ddPCR (one 96 well plate), sets thresholds for both channels of each individual well and calculates concentrations and normalized concentration for each well. The resulting threshold table can optionally be written to file automatically by the main workflow function. PoDCall also offers functionality for plotting, both individual wells and multiple well plots. Plots for individual wells can be made and saved as .pdf-files as part of the main workflow function podcallDdpcr(), or by calling the various plotting functions individually.

1.1 Gaussian Mixture Models

DdPCR experiments generate a mixture of droplets, positive droplets which contain the target that will be amplified, and negative droplets that does not contain the target and show no amplification. PoDCall relies on fitting Gaussian mixture models to set thresholds for each individual well that will be used to classify the droplets as either positive or negative. For more details on the concepts of PoDCall, see the application note.

1.2 Input Data

The input data is .csv-files exported from ‘QuantaSoft’, and each file contains the amplitude values of droplets from one well of a 96 well plate. The first two columns of the files should have headers ‘Ch1 Amplitude’ and ‘Ch2 Amplitude’. To read in data, use the function importAmplitudeData, which will read all amplitude files in the directory given as argument. Each file will be stored as a named data frame in a list, where the name will be the well ID. For this reason, all raw data files in the directory given as argument should be from the same 96 well plate to avoid well coordinate duplicates.

2 Installation

PoDCall requires some packages to be installed, and if any required packages are not yet installed, the installation of PoDCall should take care of it (you will be prompted to install the packages that are missing).

The released version of PoDCall can be installed from BIOCONDUCTOR using

## Install from Bioconductor
if (!requireNamespace("BiocManager", quietly = TRUE))


## Alternatively install PoDCall from GitHub

## Install PoDCall from source file

After installing PoDCall and the required packages, PoDCall can be loaded with:


3 Example / Usage

One step of setting thresholds includes a random sampling of droplets to greatly reduce running time. To ensure reproducible results it is recommended to set a seed using set.seed(). To run the full PoDCall workflow, call the function podcallDdpcr():

## Run PoDCall
thresholdTable <- podcallDdpcr(dataDirectory="path/to/data/")

Where “path/to/data/” is the path of the directory that contains amplitude files from a well plate, in which the files have names that end with "_wellID_amplitude.csv".

3.1 Optional arguments

The following arguments have default values, but can be given other values if desired. For example to write results to file, which is disabled by default.

3.1.1 sampleSheetFile

Path to sample sheet file. Must be a .csv file exported from QuantaSoft and must include the following columns: Well, Sample, TargetType and Target. The entries in the column TargetType must be either ‘Ch1Unknown’ or ‘Ch2Unknown’, and is used to extract rows with information from either channel 1 or channel 2. An example file has been included in the package, which can be found using system.file("extdata", "Sample_names.csv", package="PoDCall")

3.1.2 B

The number of permutations used by the likelihood ratio test (LRT) which decides the number of components in the model fitted from the data. Default value B=200.

3.1.3 Q

A parameter used for calling outliers. Q is multiplied with the interquartile range of the distribution of amplitude values to determine if droplets of extreme amplitude values are to be considered outliers. The default value is Q=9, which has been determined through cell line experiments and testing. A higher Q will generally result in a higher or more strict threshold. Q provides an option to adjust how thresholds are set in a systematic and reproducible way. It is recommended to try a few different values and visually inspect the results.

3.1.4 refwell

The well used as reference when calculating the shift in baseline between wells. By default refwell=1, but can be changed in cases where the first well is not suited to be used.

3.1.5 ch2

If channel 2 is not in use, set ch2 = FALSE to avoid error caused by empty channel 2 column. Default is ch2=TRUE.

3.1.6 resultsToFile

The user can choose to let PoDCall save the results table as a .csv-file by setting resultsToFile=TRUE (default: resultsToFile = FALSE). When resultsToFile is set to TRUE, a results directory will be created where the result file will be saved. The results directory will have the same name as the data directory with "_results" added: "path/to/data_results/

3.1.7 plots

The user can choose to make plots that are written to file by setting plots=TRUE (default: plots=FALSE). Plots will be saved to the results directory created when resultsToFile=TRUE. The results directory will also be created if only plots=TRUE.

3.1.8 resPath

Optional argument to specify a directory for writing results file(s) to other than the results directory created by default. Requires resultsToFile=TRUE.

3.2 Threshold table columns

The table that is returned when running podcallDdpcr() contains columns with more or less self-explanatory column names, and well ID (well coordinates) as rownames:

3.2.1 sample_id

If a sample sheet file is provided, this will have the sample ID from the sample sheet. Otherwise empty

3.2.2 thr_target

the threshold set for channel 1, assumed to be the target

3.2.3 thr_ctrl

The threshold set for channel 2, assumed to be the control

3.2.4 pos_dr_target

The number of positive droplets in channel 1 (target)

3.2.5 pos_dr_ctrl

The number of positive droplets in channel 2 (control)

3.2.6 tot_droplets

Number of droplets.

3.2.7 c_target

Concentration of target, calculated by the formula \(-\ln\dfrac{\dfrac{\text{neg_drop_tar}}{\text{tot_droplets}}}{0.000851}\) (where does 0.000851 come from from and what is the name of this parameter) where neg_drop_tar is number of negative droplets in channel 1 (target).

3.2.8 c_ctrl

Concentration of control, calculated by the formula \(-\ln\dfrac{\dfrac{\text{neg_drop_ctrl}}{\text{tot_droplets}}}{0.000851}\) where neg_drop_ctrl is number of negative droplets in channel 2 (control).

3.2.9 c_norm_4Plex

Normalized concentration with 4Plex as control, calculated by the formula \(\dfrac{\text{c_target}}{\text{c_ctrl}}\cdot400\)

3.2.10 c_norm_sg

Normalized concentration with single gene as control, calculated by the formula \(\dfrac{\text{c_target}}{\text{c_ctrl}}\cdot100\)

3.2.11 q

The value used for Q

3.2.12 target_assay

The assay used for target channel, provided via sample sheet.

3.2.13 ctrl_assay

The assay used for control channel, provided via sample sheet.

3.2.14 ref_well

The well used as reference well for setting threshold.

4 PoDCall functions

podcallDdpcr() is the main wrapper function that returns a table with the results of PoDCall to the user. This function uses a set of functions that read the amplitude data from file, set thresholds and make plots. All functions involved can be used individually should the user only want to use some of the functionality of PoDCall. Also see help files for more details about the functions and their arguments.

4.1 importAmplitudeData()

Reads .csv-files with amplitude data outputted from QuantaSoft and store the data in a list, one data frame per well. Each element in the list will be named using it’s well ID (coordinate) of the 96 well plate that the sample belong to.

## Path to example data files included in PoDCall
path <- system.file("extdata", "Amplitudes/", package="PoDCall")

## Read in data files
dataList <- importAmplitudeData(dataDirectory=path)
#> List of 5
#>  $ A04:'data.frame': 18739 obs. of  2 variables:
#>   ..$ Ch1: num [1:18739] 940 971 971 976 985 ...
#>   ..$ Ch2: num [1:18739] 11795 7868 8377 10007 9523 ...
#>  $ B04:'data.frame': 16933 obs. of  2 variables:
#>   ..$ Ch1: num [1:16933] 980 995 1002 1007 1014 ...
#>   ..$ Ch2: num [1:16933] 9524 7999 7686 7799 9510 ...
#>  $ D04:'data.frame': 11713 obs. of  2 variables:
#>   ..$ Ch1: num [1:11713] 1042 1070 1094 1112 1112 ...
#>   ..$ Ch2: num [1:11713] 7826 9934 7698 7605 7743 ...
#>  $ D05:'data.frame': 12642 obs. of  2 variables:
#>   ..$ Ch1: num [1:12642] 1045 1057 1063 1068 1079 ...
#>   ..$ Ch2: num [1:12642] 9722 7752 9103 7716 7738 ...
#>  $ H05:'data.frame': 19638 obs. of  2 variables:
#>   ..$ Ch1: num [1:19638] 1043 1094 1098 1104 1119 ...
#>   ..$ Ch2: num [1:19638] 7231 7063 7161 6863 7416 ...

4.2 importSampleSheet()

Reads a .csv-file outputted from QuantaSoft to get information about the samples: Sample name/id, Assay for target and control.

## Path to example files included in PoDCall
path <- system.file("extdata", "Sample_names.csv", package="PoDCall")

## Select wells to get information for
well_id <- c("A04", "B04", "D04")

## Read in sample sheet information for selected wells
sampleSheet <- importSampleSheet(sampleSheet=path, well_id=well_id)
#>   well_id sample_id target_assay ctrl_assay
#> 1     A04    SW1463          VIM   new4Plex
#> 2     B04     SW403          VIM   new4Plex
#> 3     D04     SW480          VIM   new4Plex

4.3 podcallThresholds()

Takes a list of data frames, one for each well, as argument and sets individual thresholds for each channel of each well. It returns a table with thresholds, number of positive droplets, concentrations etc. The number of permutations for likelihood ratio test is by default set to B=400 as a compromise between run time and stability of the results. The parameter for calling outliers is by default set to Q=9. Higher Q means more conservative (higher) thresholds, lower Q will result in over all lower thresholds.

## Path to example data files included in PoDCall
path <- system.file("extdata", "Amplitudes/", package="PoDCall")

## Read in data files
ampData <- importAmplitudeData(dataDirectory=path)

## Calculate thresholds, metrics, concentrations
thresholdTable <- podcallThresholds(plateData=ampData)

4.4 podcallChannelPlot()

Takes the threshold and amplitude values corresponding to a channel of a well as arguments, calls functions that makes scatter plot and histogram and draws a plot with both.

## Read in data and threshold table
path <- system.file("extdata", "Amplitudes/", package="PoDCall")
ampData <- importAmplitudeData(dataDirectory=path)
thresholdTable <- thrTable

## Select channel and well to plot
ch <- 1 # target channel
well_id <- names(ampData)[1] # First well in list

## Plot title
plotTitle <- paste0(well_id, ", Ch", ch)

## Create plot
                    thr=thresholdTable[well_id, "thr_target"],