| Title: | Automated Analysis of Multiplex Digital PCR Data |
| Version: | 2.0.1 |
| Description: | The automated clustering and quantification of the digital PCR data is based on the combination of 'DBSCAN' (Hahsler et al. (2019) <doi:10.18637/jss.v091.i01>) and 'c-means' (Bezdek et al. (1981) <doi:10.1007/978-1-4757-0450-1>) algorithms. The analysis is independent of multiplexing geometry, dPCR system, and input amount. The details about input data and parameters are available in the vignette. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.0.0) |
| Imports: | cluster, dbscan, e1071, exactci, ggplot2, ggpubr, graphics,raster, rlist, scales, shiny, shinyjs, stats, stringr, utils |
| RoxygenNote: | 7.2.1 |
| Suggests: | knitr, rmarkdown, testthat |
| VignetteBuilder: | knitr |
| URL: | https://github.com/alfodefalco/dPCP |
| BugReports: | https://github.com/alfodefalco/dPCP/issues |
| NeedsCompilation: | no |
| Packaged: | 2023-08-12 17:53:04 UTC; alfonsodefalco |
| Author: | Alfonso De Falco |
| Maintainer: | Alfonso De Falco <alfonsodefalco90@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2023-08-12 18:20:02 UTC |
Prediction of clusters centroid position
Description
This function calculates the coodintaes of all clusters centroid.
Usage
centers_data(sample.subquality, sample.table, referenceDB)## S3 method for class 'centers_data'plot(x, ..., sample = "all")Arguments
sample.subquality | an object of class |
sample.table | object of class |
referenceDB | an object of class |
x | an object of class |
... | Arguments to be passed to methods |
sample | 'all' to show all samples, or a numeric vector indicatingthe row number of samples in the sample table. |
Value
An object of classcenters_data containing a sublist foreach sample. Each sublist has the following components:
quality | quality threshold used in |
reference | reference ID. |
centers | a data frame with the centroids coordinates. |
data | a data frame with the fluorescence intensities. |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata",package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)#Reference DBSCAN clusteringdbref <- reference_dbscan(ref, sample.table, save.template = FALSE)#Predict position of clusters centroid from reference DBSCAN resultscent <- centers_data(samp, sample.table,dbref)plot(cent, sample = "all")Cluster analysis with fuzzy c-means algorithm
Description
This function carries out the c-means cluster analysis, using the centroidsposition as initial values for cluster centers.
Usage
cmeans_clus(centers.data)## S3 method for class 'cmeans_clus'plot(x, ..., sample = "all", color.blind = FALSE)Arguments
centers.data | an object of class |
x | an object of class |
... | Arguments to be passed to methods |
sample | 'all' to show all samples, or a numeric vector indicatingthe row number of samples in the sample table. |
color.blind | logical. If TRUE colors optimized for colorblind readersare used. |
Value
An object of classcmeans_clus containing a sublist foreach sample. Each sublist has the following components:
quality | quality threshold used in |
reference | reference ID. |
centers | a data frame with the centroids coordinates. |
data | a data frame with the fluorescence intensities and clustersname. |
membership | a matrix with the membership values of the data elementsto the clusters. See also |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata",package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)#Reference DBSCAN clusteringdbref <- reference_dbscan(ref, sample.table, save.template = FALSE)#Predict position of clusters centroid from reference DBSCAN resultscent <- centers_data(samp, sample.table,dbref)#Fuzzy c-means clusteringcmclus <- cmeans_clus(cent)plot(cmclus, sample = "all")Automated analysis of digital PCR data
Description
This function carries out the autometed clustering of digital PCR data.
Usage
dPCP( file, system = NULL, file.location = ".", reference.quality = 0.5, sample.quality = 0.5, eps = 200, minPts = 50, save.template = FALSE, rain = TRUE, QC.reference = FALSE, partition.volume = NULL)## S3 method for class 'dPCP'plot( x, ..., sample = "all", reference = "all", type = "dPCP", color.blind = FALSE)Arguments
file | character. The name or the path of csv file to be read. If itdoes not contain an absolute path, the file name is relative to the currentworking directory, ( |
system | character. The name of digital PCR system used to generatethe data. It must be either Thermo Fisher or Bio-Rad. Abbreviations arealso accepted. |
file.location | character. Full path name to reference and samplefiles location. The default corresponds to the working directory,( |
reference.quality | numeric. Between 0 and 1. Quality threshold tosubset the data. If different thresholds have to be applied to variousreference samples, a vectror of the same length of number of referencesamples has to be provided. Used only when the |
sample.quality | numeric. Between 0 and 1. Quality threshold to subsetdata. If different thresholds have to be applied to various samples, avectror of the same length of number of samples has to be provided. Usedonly when the |
eps | numeric. Input parameter for the DBSCAN algorithm.It represents the maximum distance between the elements within a cluster.See also |
minPts | numeric. Input parameter for the DBSCAN algorithm.It represents the number of minimum elements to assemble a cluster. Seealso |
save.template | logical. If TRUE a template of DBSCAN analysis ofreference samples is saved. When |
rain | logical. If TRUE the rain analysis is carried out. |
QC.reference | logical. If TRUE the fraction of rain elements in thereference samples is carried out. Warning messages are displayed when thepercentage of rain is high. |
partition.volume | numeric. This parameters is taken into account whenthe parameter 'system' is set on Other. Indicate the partion volume inmicroliters spcific to the digital PCR system. |
x | an object of class |
... | Arguments to be passed to methods |
sample | 'all' to show all samples, or a numeric vector indicatingthe row number of samples in the sample table. |
reference | 'all' to show all reference samples, or a character vectorwith chip ID (Thermo Fisher) or the file name (Bio-rad) of referencesamples to be showed. |
type | string. Type of plot to be showed. Available plots:'reference dbscan', 'centers', 'cmeans', 'rain', 'dPCP'.@param color.blind logical. If TRUE colors optimized for colorblindreaders are used. |
color.blind | logical. If TRUE colors optimized for colorblind readersare used. |
Value
An object of classdPCP containing the following components:
referenceDB | an object of class |
samples | a list of samples. Each sample sublist contains theinformation about the cluster analysis. |
results | an object of class |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#dPCP analysisresults <- dPCP(sampleTable, system = "bio-rad", file.location = fileLoc, eps = 200, minPts = 50, save.template = FALSE, rain = TRUE, QC.reference = FALSE)plot(results, sample = 1, type = "dPCP")Test eps and minPts combinations for DBSCAN analysis
Description
This function tests all combinations of eps and minPts for DBSCAN analysisof reference samples indicated in refID. The results are represented inscatterplots exported to a pdf file.
Usage
dbscan_combination( refID, system = NULL, file.location = ".", reference.quality = 0.5, eps = c(120, 150, 180, 200), minPts = c(20, 50, 80, 100))Arguments
refID | a string or a character vector of chipID (Thermo Fisher) orthe complete file name with the extension (Bio-Rad) of reference sample(s)to be analysed. |
system | character. The name of digital PCR system used to generatethe data. It must be either Thermo Fisher or Bio-Rad. Abbreviations arealso accepted. |
file.location | character. Full path name to reference and samplefiles location. The default corresponds to the working directory,( |
reference.quality | numeric. Between 0 and 1. Quality thresholdto subset the data (just for Thermo Fisher). If different thresholds haveto be applied to various reference samples, a vectror of the same lengthof |
eps | a numeric vector of values to be tested. Maximum distancebetween elements within a cluster in a DBSCAN analysis.See also |
minPts | a numeric vector of values to be tested. Number of minimumelements to assemble a cluster in a DBSCAN analysis.See also |
Value
A pdf file containing the scatterplots of DBSCAN analysis performedwith all combinations of eps and minPts.Each reference generates a different pdf file.
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")dbscan_combination("dilution20200313_B01_Amplitude.csv", file.location = fileLoc, system = "bio-rad", eps = c(150, 160, 180, 190), minPts = c(80, 100, 120))unlink("dilution20200313_B01_Amplitude.pdf")Export dPCP analysis results to a csv file
Description
This function exports dPCP analysis results to a csv file.
Usage
export_csv(data, filename)Arguments
data | an object of class |
filename | character. File name (no extension) for csv and pdf files tocreate on disk. |
Value
A csv file with the information and results of dPCP analysis.
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata",package = "dPCP")#dPCP analysisresults <- dPCP(sampleTable, system = "bio-rad", file.location = fileLoc, eps = 200, minPts = 50, save.template = FALSE, rain = TRUE)export_csv(results, filename = "dPCRproject_1")Manual correction of dPCP cluster analysis
Description
This function builds an interactive app to manually correct the dPCPcluster analysis.
Usage
manual_correction( data, filename, save.plot = FALSE, format = "png", dpi = 300, color.blind = FALSE)Arguments
data | an object of class |
filename | character. File name (no extension) for csv and pdf files tocreate on disk. |
save.plot | logical. If TRUE the plots are exported to a file. |
format | a string indicating the file format for the export.Available formats: 'eps', 'ps', 'tex', 'pdf', 'jpeg', 'tiff', 'png','bmp', 'svg', 'wmf'. |
dpi | numeric. Image resolution. |
color.blind | logical. If TRUE colors optimized for colorblindreaders are used. |
Value
A Shiny session.
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata",package = "dPCP")#dPCP analysisresults <- dPCP(sampleTable, system = "bio-rad", file.location = fileLoc, eps = 200, minPts = 50, save.template = FALSE, rain = TRUE)manual_correction(results, filename = "manual_dPCR", save.plot = FALSE)Identification and clustering of "rain" data
Description
This function identifies the "rain" elements and re-clusters them using theMahalanobis distance. Each "rain" element is assigned to the cluster whoseMahalanobis distance is the lowest.
Usage
rain_reclus(cmeans.cluster)## S3 method for class 'rain_reclus'plot(x, ..., sample = "all", color.blind = FALSE)Arguments
cmeans.cluster | an object of class |
x | an object of class |
... | Arguments to be passed to methods |
sample | 'all' to show all samples, or a numeric vector indicatingthe row number of samples in the sample table. |
color.blind | logical. If TRUE colors optimized for colorblind readersare used. |
Value
An object of classrain_reclus containing a sublist foreach sample. Each sublist has the following components:
quality | quality threshold used in |
reference | reference ID. |
centers | a data frame with the centroids coordinates. |
data | a data frame with the fluorescence intensities and clustersname. |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata",package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)#Reference DBSCAN clusteringdbref <- reference_dbscan(ref, sample.table, save.template = FALSE)#Predict position of clusters centroid from reference DBSCAN resultscent <- centers_data(samp, sample.table,dbref)#Fuzzy c-means clusteringcmclus <- cmeans_clus(cent)#Rain classification.rainclus <- rain_reclus(cmclus)plot(rainclus, sample = "all")Read reference files
Description
This function reads the results files of reference samples listed in thesample table. Fluoresce intensity and quality value (just for Thermo Fisher)are collected.If areference_dbscan template file with the same inputparamters (reference ID, eps, minPts) is available, fluorescence data,quality value and dbscan analysis results are retrived from the templatefile.
Usage
read_reference( sample.table, system = NULL, file.location = ".", reference.quality = 0.5, eps = NULL, minPts = NULL)Arguments
sample.table | object of class |
system | character. The name of digital PCR system used to generatethe data. It must be either Thermo Fisher or Bio-Rad. Abbreviations arealso accepted. |
file.location | character. Full path name to reference and samplefiles location. The default corresponds to the working directory,( |
reference.quality | numeric. Between 0 and 1. Quality threshold tosubset the data. If different thresholds have to be applied to variousreference samples, a vectror of the same length of number of referencesamples has to be provided. Used only when the |
eps,minPts | numeric. Input parameters for the DBSCAN algorithm. Ifthey match the paramters of |
Value
An object of classread_reference containing a sublist foreach reference. Each sublist has the following components:
quality | value of the |
data | a matrix with the fluorescence intensities and qualityvalues. |
dbscan | an object of class |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)Read sample files
Description
This function reads the results files of samples listed in the sample table.Fluoresce intensity and quality value (just for Thermo Fisher) arecollected.
Usage
read_sample( sample.table, system = NULL, file.location = ".", sample.quality = 0.5, partition.volume = NULL)Arguments
sample.table | object of class |
system | character. The name of digital PCR system used to generatethe data. It must be either Thermo Fisher or Bio-Rad. Abbreviations arealso accepted. |
file.location | character. Full path name to reference and samplefiles location. The default corresponds to the working directory,( |
sample.quality | numeric. Between 0 and 1. Quality threshold to subsetdata. If different thresholds have to be applied to various samples, avectror of the same length of number of samples has to be provided. Usedonly when the |
partition.volume | numeric. This parameters is taken into account whenthe parameter 'system' is set on Other. Indicate the partion volume inmicroliters spcific to the digital PCR system. |
Value
An object of classread_sample containing a sublist for eachsample. Each sublist has the following components:
quality | value of the |
data | a matrix with the fluorescence intensities and qualityvalues. |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)Read sample table
Description
This function reads a file containing the essential information about thesamples and experimental settings. The file has to be filled out by the userand formatted as described in the vignette.
Usage
read_sampleTable(file, system = NULL, file.location = ".")Arguments
file | character. The name or the path of csv file to be read. If itdoes not contain an absolute path, the file name is relative to the currentworking directory, ( |
system | character. The name of digital PCR system used to generatethe data. It must be either Thermo Fisher or Bio-Rad. Abbreviations arealso accepted. |
file.location | character. Full path name to reference and samplefiles location. The default corresponds to the working directory,( |
Value
An object of classsample_table.
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)Find the empty partitions and single target clusters in the reference sample
Description
This function computes a DBSCAN analysis to identify single target clustersin the reference samples listed in the sample table.If areference_dbscan template file with the same inputparamters (reference ID, eps, minPts) is available, data are retrivedfrom the template file.
Usage
reference_dbscan( reference.subquality, sample.table, eps = 200, minPts = 50, save.template = FALSE)## S3 method for class 'reference_dbscan'plot(x, ..., reference = "all")Arguments
reference.subquality | an object of class |
sample.table | object of class |
eps,minPts | numeric. Input parameters for the DBSCAN algorithm. Ifthey match the paramters of |
save.template | logical. If TRUE a template of DBSCAN analysis ofreference samples is saved. When |
x | an object of class |
... | Arguments to be passed to methods |
reference | 'all' to show all reference samples, or a character vectorwith chip ID (Thermo Fisher) or the file name (Bio-rad) of referencesamples to be showed. |
Value
An object of classreference_dbscan containing a sublist foreach reference. Each sublist has the following components:
quality | quality threshold used in |
data | a matrix with the fluorescence intensities and qualityvalues. |
dbscan | an object of class |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata",package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)#Reference DBSCAN clusteringdbref <- reference_dbscan(ref, sample.table, save.template = FALSE)plot(dbref, reference = "all")Calculation of targets concentration, pooling the sample replicates
Description
This function calculates the concentration of the targets, combining theresults of the replicates of each sample.
Usage
replicates_quant(raw.results, sample.table)Arguments
raw.results | an object of class |
sample.table | object of class |
Value
An object of classreplicates_quant containing a sublist forevery sample. Each sublist has the following components:
quality | quality threshold used in |
reference | reference ID. |
raw results | a data frame with the results of quantification. |
replicates results | a data frame with the results of quantificationof pooled replicates. |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)#Reference DBSCAN clusteringdbref <- reference_dbscan(ref, sample.table, save.template = FALSE)#Predict position of clusters centroid from reference DBSCAN resultscent <- centers_data(samp, sample.table,dbref)#Fuzzy c-means clusteringcmclus <- cmeans_clus(cent)#Rain classification.rainclus <- rain_reclus(cmclus)#Quantificationquantcm <- target_quant(cmclus, sample.table)quant <- target_quant(rainclus, sample.table)#Replicates poolingrep.quant <- replicates_quant(quant, sample.table)Export dPCP analysis results to a pdf report
Description
This function generates a pdf report of the dPCP analysis.
Usage
report_dPCP(data, filename, sample = "all", color.blind = FALSE)Arguments
data | an object of class |
filename | character. File name (no extension) for csv and pdf files tocreate on disk. |
sample | 'all' to show all samples, or a numeric vector indicatingthe row number of samples in the sample table. |
color.blind | logical. If TRUE colors optimized for colorblindreaders are used. |
Value
A pdf file with the information and results of the dPCP analysis.
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#dPCP analysisresults <- dPCP(sampleTable, system = "bio-rad", file.location = fileLoc, eps = 200, minPts = 50, save.template = FALSE, rain = TRUE)report_dPCP(results, filename = "dPCRproject_1")Calculation of targets concentration.
Description
This function calculates the concentration of the targets according to thePoisson distribution.
Usage
target_quant(data.cluster, sample.table)Arguments
data.cluster | an object of class |
sample.table | object of class |
Value
An object of classtarget_quant containing a sublist foreach sample. Each sublist has the following components:
quality | quality threshold used in |
reference | reference ID. |
raw results | a data frame with the results of the quantification. |
Examples
library(dPCP)#Find path of sample table and location of reference and input filessampleTable <- system.file("extdata", "Template_sampleTable.csv", package = "dPCP")fileLoc <- system.file("extdata", package = "dPCP")#Read sample table filesample.table <- read_sampleTable(sampleTable, system = "bio-rad", file.location = fileLoc)#Read reference filesref <- read_reference(sample.table, system = "bio-rad", file.location = fileLoc)#Read samples filessamp <- read_sample(sample.table, system = "bio-rad", file.location = fileLoc)#Reference DBSCAN clusteringdbref <- reference_dbscan(ref, sample.table, save.template = FALSE)#Predict position of clusters centroid from reference DBSCAN resultscent <- centers_data(samp, sample.table,dbref)#Fuzzy c-means clusteringcmclus <- cmeans_clus(cent)#Rain classification.rainclus <- rain_reclus(cmclus)#Quantificationquantcm <- target_quant(cmclus, sample.table)quant <- target_quant(rainclus, sample.table)