Droplet Digital PCR (ddPCR) data analysis scripts

##########################################################################################
#   TITLE : drops.pl : Data processing for droplet digital PCR data (ddPCR v1.01)        #
##########################################################################################
##########################################################################################
#
#    This Perl script is designed to process data from the Bio-Rad DX100 platform in to a
#   format that is more compatible with R than are the raw files that are output from
#   the quantalife software.
#
#   The quantalife software is able to export raw fluorescence data.
#   After performing a run, you should go to the setup screen and select options, then
#   export raw data. This will generate one CSV file for each well of the sample plate.
#
#   Each file has two columns, the first is the fluorescence intensity for the
#   FAM channel, the second the same for VIC/HEX. Each row is a separate droplet.
#
#   This script will collect individual files from a subfolder “in” and will process
#   them in to a single output file “ddPCRout.txt” in the current working directory
#   which contains a concatenation of the total data, with well names appended to the
#   FI data. You will be asked for a plate number and this will be appended to
#   downstream workflows. This script will automatically spawn an R session and run the
#   R script.
#
#    Script will allow you to choose droplet positive/negative threshold values for
#      sample using point and click. (runs R script : dropletR_man_thresholds.R)
#
#   R script     should be in the current working directory
#
#   Data is read from ~/in and written to ~/out                                          #
#   Please ensure that you make these directories before running the script for the
#   first time
#
#
#    To run these scripts you will need a copy of R and perl.
#   Perl is usually installed as standard on unix machines (including Apple Mac)
#   For Windows PCs, use “strawberry perl” which is available as a free download
#
#   To run the script, open a terminal (command prompt) in the directory that contains
#   the three script files and the ~/in and ~/out directories. Then at the prompt
#   ($ or C:/) type
#
#    $ perl drops.pl [enter]
#
#   follow the onscreen commands.
#
#
#    The data output contains a number of items
#
#    000_average_beadcounts.pdf                | Plot of droplet counts for the samples
#   000_average_fam_FI.pdf                    | Plot of average Fam FI for positive and
#                                              negative populations of each sample
#   000_average_vic_FI.pdf                    | Plot of average VIC/HEX FI for positive and
#                                              negative populations of each sample
#   000_concentration_fam.pdf                | Summary of FAM channel concentration per
#                                              swab (copies/uL)
#   000_concentration_vic.pdf                | Summary of VIC/HEX channel concentration
#                                              per swab (copies/uL)
#   000_results_full.txt                    | Table containing all calculated data
#   000_results_concise.txt                    | Table containing concise data
#    000_A01.pdf                                | Scatterplot for FI values, well A01
#    000_A02.pdf                                | Scatterplot for FI values, well A02
#    …                                        | …
#    platesummary.pdf                        | Scatterplot of all data points (can be big)#
#
#
##########################################################################################
#                                   Open source license
##########################################################################################
# To attribute this work, you must cite the name of the original source, the name of
# the author (Chrissy h. Roberts) and their contact details
# (chrissyhroberts@yahoo.co.uk). This work is licensed under the Creative Commons
# Attribution-ShareAlike 3.0 Unported License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/
# or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View,
# California, 94041, USA.
##########################################################################################

ddPCR_scripts

#!/usr/bin/env perl
# do not delete the preceding line

##########################################################################################
# TITLE : drops.pl : Data processing for droplet digital PCR data (ddPCR v1.01)
##########################################################################################
##########################################################################################
# #
# This Perl script is designed to process data from the Bio-Rad DX100 platform in to a #
# format that is more compatible with R than are the raw files that are output from #
# the quantalife software. #
# #
# The quantalife software is able to export raw fluorescence data. #
# After performing a run, you should go to the setup screen and select options, then #
# export raw data. This will generate one CSV file for each well of the sample plate. #
# #
# Each file has two columns, the first is the fluorescence intensity for the #
# FAM channel, the second the same for VIC/HEX. Each row is a separate droplet. #
# #
# This script will collect individual files from a subfolder “in” and will process #
# them in to a single output file “ddPCRout.txt” in the current working directory #
# which contains a concatenation of the total data, with well names appended to the #
# FI data. You will be asked for a plate number and this will be appended to #
# downstream workflows. This script will automatically spawn an R session and run the #
# R script. #
# #
# Script will allow you to choose droplet positive/negative threshold values for #
# sample using point and click. (runs R script : dropletR_man_thresholds.R) #
# #
# R script should be in the current working directory #
# #
# Data is read from ~/in and written to ~/out #
# Please ensure that you make these directories before running the script for the #
# first time #
# #
# #
# To run these scripts you will need a copy of R and perl. #
# Perl is usually installed as standard on unix machines (including Apple Mac) #
# For Windows PCs, use “strawberry perl” which is available as a free download #
# #
# To run the script, open a terminal (command prompt) in the directory that contains #
# the three script files and the ~/in and ~/out directories. Then at the prompt #
# ($ or C:/) type #
# #
# $ perl drops.pl [enter] #
# #
# follow the onscreen commands. #
# #
#  #
# The data output contains a number of items #
# #
# 000_average_beadcounts.pdf | Plot of droplet counts for the samples #
# 000_average_fam_FI.pdf | Plot of average Fam FI for positive and #
# negative populations of each sample #
# 000_average_vic_FI.pdf | Plot of average VIC/HEX FI for positive and#
# negative populations of each sample #
# 000_concentration_fam.pdf | Summary of FAM channel concentration per #
# swab (copies/uL) #
# 000_concentration_vic.pdf | Summary of VIC/HEX channel concentration #
# per swab (copies/uL) #
# 000_results_full.txt | Table containing all calculated data #
# 000_results_concise.txt | Table containing concise data #
# 000_A01.pdf | Scatterplot for FI values, well A01 #
# 000_A02.pdf | Scatterplot for FI values, well A02 #
# … | … #
# platesummary.pdf | Scatterplot of all data points (can be big)# #
# #
# #
##########################################################################################
# Open source license #
##########################################################################################
# To attribute this work, you must cite the name of the original source, the name of #
# the author (Chrissy h. Roberts) and their contact details #
# (chrissyhroberts@yahoo.co.uk). This work is licensed under the Creative Commons #
# Attribution-ShareAlike 3.0 Unported License. #
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ #
# or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, #
# California, 94041, USA. #
##########################################################################################
#
##########################################################################################
#START OF SCRIPT
##########################################################################################

use warnings;
use Cwd;
#get current working directory
my $dir = getcwd();
print “##########################################################################################
# TITLE : drops.pl : Data processing for droplet digital PCR data (ddPCR v1.01) #
##########################################################################################
# Open source license #
##########################################################################################
# To attribute this work, you must cite the name of the original source, the name of #
# the author (Chrissy h. Roberts) and their contact details #
# (chrissyhroberts\@yahoo.co.uk). This work is licensed under the Creative Commons #
# Attribution-ShareAlike 3.0 Unported License. #
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ #
# or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, #
# California, 94041, USA. #
##########################################################################################\n\n”;
print “\n$dir\n”;
#get plate number/name
print”\n”;
print “what is the plate number/name : “;

chomp(my $platenumber = );
print “\n\nthanks, the plate number is $platenumber\n\n”;

#get method for calling positive/negative droplets

$test = 1;

#get list of files in the cwd/in folder (these should be CSV files that were exported from Quantalife software)
@files = <$dir/in/*>;
print”files: “.@files.”\n”;
#create new file for output data
open OUT,”>”,”ddPCRout.txt”;
my $colour = 1;

#for each file, add current plate and well names to fluorescence intensity data and write output to file
select OUT;
print “SAMPLE\tFAM\tVIC\n”;
foreach (@files) {
my $currentfile = $_;
open IN, “<“,”$_”;
my @lines = ;
foreach(@lines ){
chomp;
if ($_ =~ /Amplitude/){next};
s/,/\t/g;
$currentfile = substr($currentfile,-17,17);
$currentfile = substr($currentfile,0,3);
print “$platenumber$currentfile\t$_”;
}
close IN;
}

select STDOUT;

# spawn R session and run script

print “\n\n\nProcessed raw files, performing R script…\n\n\n”;
if($test==1){system “R CMD BATCH dropletR_man_thresholds.R”};

print”Job DONE.\n\n\n”;

##########################################################################################
# End of SCRIPT
##########################################################################################

Comments are closed.