Title: | Annotation and analysis of biological dynamical systems using flow cytometry |
---|---|
Description: | This package facilitates analysis of both timecourse and steady state flow cytometry experiments. This package was originially developed for quantifying the function of gene regulatory networks in yeast (strain W303) expressing fluorescent reporter proteins using BD Accuri C6 and SORP cytometers. However, the functions are for the most part general and may be adapted for analysis of other organisms using other flow cytometers. Functions in this package facilitate the annotation of flow cytometry data with experimental metadata, as often required for publication and general ease-of-reuse. Functions for creating, saving and loading gate sets are also included. In the past, we have typically generated summary statistics for each flowset for each timepoint and then annotated and analyzed these summary statistics. This method loses a great deal of the power that comes from the large amounts of individual cell data generated in flow cytometry, by essentially collapsing this data into a bulk measurement after subsetting. In addition to these summary functions, this package also contains functions to facilitate annotation and analysis of steady-state or time-lapse data utilizing all of the data collected from the thousands of individual cells in each sample. |
Authors: | R. Clay Wright [aut, cre], Nick Bolten [aut], Edith Pierre-Jerome [aut] |
Maintainer: | R. Clay Wright <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.31.0 |
Built: | 2024-12-18 03:25:13 UTC |
Source: | https://github.com/bioc/flowTime |
Makes a new column from column
with the background value of
a given baseline
control from a chosen identifier column
baseline_column
subtracted from the values of column
.
addbs(data, column, baseline_column, baseline = "noYFP")
addbs(data, column, baseline_column, baseline = "noYFP")
data |
the summary data frame of a flowSet (from
|
column |
the column containing the fluorescent (or other) measurement to be background subtracted |
baseline_column |
the column containing the identifier of the rows containing background values |
baseline |
|
A summary data frame with an additional column column_bs
containing the background subtracted values
dat<-read.flowSet(path=system.file("extdata", "tc_example", package = "flowTime"),alter.names = TRUE) annotation <- read.csv(system.file("extdata", "tc_example.csv", package = "flowTime")) annotation[which(annotation$treatment == 0), 'strain'] <- 'background' adat <- annotateFlowSet(dat, annotation) dat_sum <- summarizeFlow(adat, gated = TRUE, channel = 'FL1.A') dat_sum <- addbs(data = dat_sum, column = FL1.Amean, baseline_column = strain, baseline = "background")
dat<-read.flowSet(path=system.file("extdata", "tc_example", package = "flowTime"),alter.names = TRUE) annotation <- read.csv(system.file("extdata", "tc_example.csv", package = "flowTime")) annotation[which(annotation$treatment == 0), 'strain'] <- 'background' adat <- annotateFlowSet(dat, annotation) dat_sum <- summarizeFlow(adat, gated = TRUE, channel = 'FL1.A') dat_sum <- addbs(data = dat_sum, column = FL1.Amean, baseline_column = strain, baseline = "background")
Produces a normalized fluorescence column 'normed'. Expects the 'FL1.A_bs' column to exist or a column to be specified. Has three different methods, version 1 and version 2, described in the script
addnorm( frame, factor_in = c("strain", "treatment"), method = 1, column = "FL3.Amean_bs" )
addnorm( frame, factor_in = c("strain", "treatment"), method = 1, column = "FL3.Amean_bs" )
frame |
|
factor_in |
|
method |
which normalization method to use, 1, 2 or 3. |
column |
|
Method 1, the default normalization method, takes the highest point in each dataset grouped by 'factor_in' and normalizes all values in the group by this point. This method is default because it works regardless of whether the data is a time series. Method 2 finds the mean value of all time points with time values less than 0 for each group and normalizes each group by this respective value. Requires a time series with negative time values to work. Method 3 fits a linear model to the pre-zero time points for each groups, infers the y-intercept, and normalizes using this intercept. Method 3 also requires a time series with negative time values to work.
data frame
containing the additional normalized variable
dat <- read.flowSet(path=system.file("extdata", "tc_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "tc_example.csv", package = "flowTime")) adat <- annotateFlowSet(dat, annotation) loadGates(gatesFile = 'C6Gates') dat_sum <- summarizeFlow(adat, ploidy = "diploid", only = "singlets", channel = "FL1.A") dat_sum <- addnorm(dat_sum, c("strain", "treatment"), method = 1, column = "FL1.Amean")
dat <- read.flowSet(path=system.file("extdata", "tc_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "tc_example.csv", package = "flowTime")) adat <- annotateFlowSet(dat, annotation) loadGates(gatesFile = 'C6Gates') dat_sum <- summarizeFlow(adat, ploidy = "diploid", only = "singlets", channel = "FL1.A") dat_sum <- addnorm(dat_sum, c("strain", "treatment"), method = 1, column = "FL1.Amean")
Add annotations to a flowSets phenoData and plate numbers, strain names, and treatment also set T0
annotateFlowSet(yourFlowSet, annotation_df, mergeBy = "name")
annotateFlowSet(yourFlowSet, annotation_df, mergeBy = "name")
yourFlowSet |
a flowSet with sampleNames of the format 'plate#_Well', we typically use the following code chunk to read data from individual plates as exported from BD Accuri C6 software. |
annotation_df |
A data frame with columns 'well', 'strain', 'treatment', containing all of the wells in the flowset labeled with the strain and treatment in that well. |
mergeBy |
the unique identifier column |
An annotated flowSet
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "ss_example.csv", package = "flowTime")) annotateFlowSet(dat, annotation, mergeBy = "name")
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "ss_example.csv", package = "flowTime")) annotateFlowSet(dat, annotation, mergeBy = "name")
Creates a data frame with rows containing the sample names of your flow set that can then be filled in with experimental metadata.
createAnnotation(yourFlowSet)
createAnnotation(yourFlowSet)
yourFlowSet |
the flowSet to create an annotation data frame for |
annotation_df a data frame containing the sample names of your flow set
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) annotation <- createAnnotation(yourFlowSet = dat) head(annotation)
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) annotation <- createAnnotation(yourFlowSet = dat) head(annotation)
A gate for the set of all diploid doublets
data(dipdoubletGate)
data(dipdoubletGate)
formal class polygonGate
Typically set in FSC.A by FSC.H space Diploids are typically 5um x 6um ellipsoids while haploids are typically 4um x 4um spheroids. As a result, diploids are longer and you get a larger 'area/volume'.
data(dipsingletGate)
data(dipsingletGate)
formal class polygonGate
Get summary statistics for fluorescence or other data channels of a flowSet
flsummary(flowset, channel)
flsummary(flowset, channel)
flowset |
the |
channel |
option |
A data frame
containing summary statistics (mean, median,
SD) for the specified fluorescent channel and time moments of the flowSet.
plate1 <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) flsummary(flowset = plate1, channel = "FL1.A")
plate1 <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) flsummary(flowset = plate1, channel = "FL1.A")
Get the time at which at flowFrame began collection
getTime(flowframe)
getTime(flowframe)
flowframe |
The |
numeric
time value in minutes
plate1<-read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"),alter.names = TRUE) getTime(plate1$A01.fcs)
plate1<-read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"),alter.names = TRUE) getTime(plate1$A01.fcs)
A gate for the set of all haploid doublets
data(hapdoubletGate)
data(hapdoubletGate)
formal class polygonGate
A gate for the set of all haploid singlets
data(hapsingletGate)
data(hapsingletGate)
formal class polygonGate
Loads a set of yeast gates into active memory to be used in analysis functions
loadGates(gatesFile = NULL, path = NULL, envir = environment())
loadGates(gatesFile = NULL, path = NULL, envir = environment())
gatesFile |
the gates file to be loaded into memory, or path to the gates file |
path |
The path to the gates file. If 'NULL' this will look through lazy loaded data for the gatesFile |
envir |
The environment in which to load the gates |
gate objects created in the current environment
loadGates(system.file("extdata/SORPGates.RData", package = "flowTime"))
loadGates(system.file("extdata/SORPGates.RData", package = "flowTime"))
Summary statistic columns for a flow frame
meanMedianSD(frame)
meanMedianSD(frame)
frame |
a |
a matrix with a single row for the flow frame and mean, median, and sd columns for each column of the expression measurements
plate1<-read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) meanMedianSD(plate1@frames$A01.fcs) fsApply(plate1, meanMedianSD)
plate1<-read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) meanMedianSD(plate1@frames$A01.fcs) fsApply(plate1, meanMedianSD)
Use the FSC.A/FSC.H ratio. Diploids are typically 5um x 6um ellipsoids while haploids are typically 4um x 4um spheroids. As a result, diploids are longer and you get a larger 'area/volume' FSC.A. 'Width' might also be useful on certain cytometers.
ploidy(flowframe)
ploidy(flowframe)
flowframe |
the flowFrame you would like to identify the ploidy of |
"Diploid" or "Haploid" and the mean FSC.A/FSC.H quotient
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) ploidy(dat$A01.fcs)
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) ploidy(dat$A01.fcs)
Create a polygon gate
polyGate(x, y, filterID = "newGate", channels = c("FSC.A", "FSC.H"))
polyGate(x, y, filterID = "newGate", channels = c("FSC.A", "FSC.H"))
x |
a vector of x coordinates |
y |
a vector of y coordinates |
filterID |
name of the gate |
channels |
vector containing the channels matching the x and y coordinates above |
a polygon gate object
polyGate(x = c(1,1,10000,10000), y = c(1,10000, 10000, 1), )
polyGate(x = c(1,1,10000,10000), y = c(1,10000, 10000, 1), )
Check whether a flowSet (or a single flowFrame) contains empty values, in which case normalization may fail (divide by zero). This is particularly useful for removing wash wells from a flowSet.
qaGating(x, threshold = 100)
qaGating(x, threshold = 100)
x |
|
threshold |
|
A vector containing the flowFrames
with fewer events than
the threshold.
plate1<-read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) qaGating(plate1)
plate1<-read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) qaGating(plate1)
Reads all folders within the specified path containing the specified pattern in the folder names. Each folder contains a set a plate of FCS files. These folders typically make up a whole experiment. Plates are numbered according to the standard lexicographical ordering of your operating system.
read.plateSet(path = getwd(), pattern = "", ...)
read.plateSet(path = getwd(), pattern = "", ...)
path |
The path to search for folders containing FCS files |
pattern |
The regex pattern used to identify the folders of FCS files to be read |
... |
Additional arguments passed to read.flowSet. Note that 'alter.names' is forced to be TRUE in this implementation. |
A single flowSet containing all FCS files within the identified folders. The index of each folder in the list according to lexicographical ordering (1,2,...) is prepended to the sampleNames.
# Read in both of the example data sets as a single flowSet plate1<-read.plateSet(path = system.file("extdata", package = "flowTime"), pattern = "")
# Read in both of the example data sets as a single flowSet plate1<-read.plateSet(path = system.file("extdata", package = "flowTime"), pattern = "")
Save a yeast gate set
saveGates( yeastGate = NULL, dipsingletGate = NULL, dipdoubletGate = NULL, hapsingletGate = NULL, hapdoubletGate = NULL, path = getwd(), fileName = "defaultGates.RData" )
saveGates( yeastGate = NULL, dipsingletGate = NULL, dipdoubletGate = NULL, hapsingletGate = NULL, hapdoubletGate = NULL, path = getwd(), fileName = "defaultGates.RData" )
yeastGate |
a gate object defining the population of yeast cells |
dipsingletGate |
a gate object defining the population of diploid singlet cells |
dipdoubletGate |
a gate object defining the population of diploid doublet cells |
hapsingletGate |
a gate object defining the population of haploid singlet cells |
hapdoubletGate |
a gate object defining the population of haploid doublet cells |
path |
path to the folder in which you would like to save the gates |
fileName |
name of the .Rdata file you would like to save these gates within |
a .RData file in the "extdata" folder of the package containing the specified gates
loadGates(system.file("extdata/SORPGates.RData", package = "flowTime")) #not run: #saveGates()
loadGates(system.file("extdata/SORPGates.RData", package = "flowTime")) #not run: #saveGates()
Generates a data frame which can be used to visualize and analyze steady state flow cytometry data. Steady state in this case means that
steadyState(flowset, gated = FALSE, ploidy = NA, only = NA)
steadyState(flowset, gated = FALSE, ploidy = NA, only = NA)
flowset |
your flowSet to be analyzed |
gated |
|
ploidy |
|
only |
|
a data frame containing all of the selected subset of events from the original flowSet
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "ss_example.csv", package = "flowTime")) dat <- annotateFlowSet(dat, annotation, mergeBy = "name") loadGates(gatesFile = 'SORPGates') steadyState(dat, gated = FALSE, ploidy = "diploid", only = "singlets")
dat <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "ss_example.csv", package = "flowTime")) dat <- annotateFlowSet(dat, annotation, mergeBy = "name") loadGates(gatesFile = 'SORPGates') steadyState(dat, gated = FALSE, ploidy = "diploid", only = "singlets")
Gates a sample to all yeast, then singlet, then doublets. Also calculates singlet to doublet ratio. Returns a list of data frames, e.g. output$singlets, output$doublets, etc.
summarizeFlow( flowset, channel = NA, gated = FALSE, ploidy = FALSE, only = FALSE )
summarizeFlow( flowset, channel = NA, gated = FALSE, ploidy = FALSE, only = FALSE )
flowset |
the |
channel |
|
gated |
|
ploidy |
|
only |
|
data frame
containing the specified summary statistics of
the specified cell populations for each frame
plate1 <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) summarizeFlow(plate1, channel = "FL1.A", gated = TRUE, ploidy = "diploid", only = "yeast")
plate1 <- read.flowSet(path = system.file("extdata", "ss_example", package = "flowTime"), alter.names = TRUE) summarizeFlow(plate1, channel = "FL1.A", gated = TRUE, ploidy = "diploid", only = "yeast")
Generates a tibble containing all parameters and phenoData from a flowSet which can be used to visualize and analyze timecourse flow cytometry data.
tidyFlow(flowset, gated = TRUE, ploidy = NA, only = NA)
tidyFlow(flowset, gated = TRUE, ploidy = NA, only = NA)
flowset |
your flowSet to be analyzed |
gated |
|
ploidy |
|
only |
|
a data frame containing all of the selected subset of events from the original flowSet for all parameters including experiment time, etime, the time after the initial reading at which each event was collected.
plate1<-read.flowSet(path=system.file("extdata", "tc_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "tc_example.csv", package = "flowTime")) plate1 <- annotateFlowSet(plate1, annotation) tidy_dat <- tidyFlow(plate1, gated = TRUE) head(tidy_dat)
plate1<-read.flowSet(path=system.file("extdata", "tc_example", package = "flowTime"), alter.names = TRUE) annotation <- read.csv(system.file("extdata", "tc_example.csv", package = "flowTime")) plate1 <- annotateFlowSet(plate1, annotation) tidy_dat <- tidyFlow(plate1, gated = TRUE) head(tidy_dat)
Typically set in FSC.A by SSC.A space to exclued any debris
data(yeastGate)
data(yeastGate)
formal class polygonGate