Title: | Combining multitube flow cytometry data by binning |
---|---|
Description: | Software to combine flow cytometry data that has been multiplexed into multiple tubes with common markers between them, by establishing common bins across tubes in terms of the common markers, then determining expression within each tube for each bin in terms of the tube-specific markers. |
Authors: | Kieran O'Neill |
Maintainer: | Kieran O'Neill <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.43.0 |
Built: | 2024-11-29 06:10:42 UTC |
Source: | https://github.com/bioc/flowBin |
Multitube AML sample as example data for flowBin
a flowSample
containing 7 tubes with 3 common parameters and 4 measure parameters per tube.
FlowRepository.org accession FR-FCM-ZZYA
FlowSample
, but with binning information for each tubeclust.labels
:list
of
cluster label vectors, one for each tube
Note: all slots
can be get and set using accessor methods, for example
bin.pars(myFlowSet) <- c(1,2,5)
Function to check the quantile normalisation of a FlowSample using flowFP
object and normed.object are compared using flowFP
binning, to assess the deviation in bin counts between
the two.
list
containing two matrices of standard
deviations across bins (rows) vs tubes (columns) for
before (sd.before
) and after (sd.after
).
data(amlsample) normed.sample <- quantileNormalise(aml.sample) qnorm.check <- checkQNorm(aml.sample, normed.sample, do.plot=FALSE) show(qnorm.check)
data(amlsample) normed.sample <- quantileNormalise(aml.sample) qnorm.check <- checkQNorm(aml.sample, normed.sample, do.plot=FALSE) show(qnorm.check)
Takes a list of flowFrames representing tubes from a single flow cytometry sample, and combines them using binning of events in terms of common markers across tubes.
flowBin(tube.list, bin.pars, control.tubes = vector(), measure.pars = NULL, sample.name = "Unnamed Flow Expr Set", bin.method = "kmeans", expr.method = "medianFI", sparse.bin.thresh = 0.001, dequantize = T, snow.cluster = NULL, n.bins = 128, scale.expr = F, do.qnorm = T, return.bins = F)
flowBin(tube.list, bin.pars, control.tubes = vector(), measure.pars = NULL, sample.name = "Unnamed Flow Expr Set", bin.method = "kmeans", expr.method = "medianFI", sparse.bin.thresh = 0.001, dequantize = T, snow.cluster = NULL, n.bins = 128, scale.expr = F, do.qnorm = T, return.bins = F)
tube.list |
a list of flowFrames, one for each tube to combine |
bin.pars |
a numerical vector indicating which flow parameters in the each flowFrame to use for combining tubes. These should be the same markers assayed across every tube. |
control.tubes |
a vector indicating which tubes in tube.list to use for negative controls. May be empty. |
measure.pars |
a list of which parameters to measure
expression for, with one vector for each tube. If left
NULL, this defaults to all parameters other than those
specified as |
sample.name |
name of this flowSample, for convenience (defaults to 'Unnamed Flow Expr Set') |
bin.method |
The method to use for creating bins. The two options are "kmeans" for k-means clustering and nearest-neighbour mapping of bins. or "flowFP" for flowFP binning and direct mapping of bin boundaries across tubes. |
expr.method |
The method to use to compute bin expression across tubes. This defaults to MFI of the cells belonging to that bin in each tube. Other options are |
sparse.bin.thresh |
Bins which contain fewer than this proportion of total events in any tube will be excluded as outliers. Defaults to 0.001 |
dequantize |
If TRUE, adds a small (region of 1e-8) value to flow data to help break ties when binning. |
snow.cluster |
A cluster created using the
|
n.bins |
Number of bins to use. Note that this must be a power of 2 if flowFP is selected as binning method. |
scale.expr |
If TRUE, the resulting expression
values will be scaled to (0,1) using the ranges specified
in the flowFrames in |
do.qnorm |
If TRUE, the binning markers will be quantile normalized prior to binning. |
return.bins |
If TRUE, return a
|
A matrix containing expression values for each bin in
terms of each marker across all tubes. If
return.bins
is set TRUE, then a list containing a
BinnedFlowExprSet
followed by the expression
matrix is returned.
data(amlsample) tube.combined <- flowBin([email protected], [email protected], bin.method='flowFP', [email protected], expr.method='medianFIDist', scale.expr=TRUE) heatmap(tube.combined, scale='none')
data(amlsample) tube.combined <- flowBin(aml.sample@tube.set, bin.pars=aml.sample@bin.pars, bin.method='flowFP', control.tubes=aml.sample@control.tubes, expr.method='medianFIDist', scale.expr=TRUE) heatmap(tube.combined, scale='none')
Bin sample using flowFP binning
object |
flowSample to bin |
n.bins=128 |
number of bins to use. This should be a power of 2, and will be rounded down to the nearest power of 2 if not. |
snow.cluster=NULL |
Optional snow cluster to use for parallel execution. |
dequantize=T |
If TRUE, adds a small (region of 1e-8) value to flow data to help break ties when binning. |
a BinnedFlowSample
data(amlsample) normed.sample <- quantileNormalise(aml.sample) res <- flowFPBin(normed.sample)
data(amlsample) normed.sample <- quantileNormalise(aml.sample) res <- flowFPBin(normed.sample)
name
:character
string -
name of the object
tube.set
:list
of flowFrame
s containing raw flow data.
control.tubes
:Integer vector
indicating which tubes in the list (if any) to use as
negative controls. May be empty.
bin.pars
:Integer vector
indicating
which parameters to use for binning. These must be in the
same position in all tubes.
measure.pars
:list
of integer
vector
s indicating which parameters to use for
measurement. These must be specified per tube.
Note: all
slots can be get and set using accessor methods, for
example bin.pars(myFlowSet) <- c(1,2,5)
getBinExpr main function definition
method |
Method to use to compute expression, passed
as a string. Defaults to |
include.bin.medians |
logical, specifies whether to
compute the medians of each bin in terms of the binning
markers and include them in the result or not. Defaults
to |
scale |
logical specifying whether to scale the
results to the interval (0,1). If |
A numeric matrix containing expression values, with bins as rows and markers as columns
data(amlsample) normed.sample <- quantileNormalise(aml.sample) binned.sample <- flowFPBin(normed.sample) binned.sample <- removeSparseBins(binned.sample, 0.001) bin.expr <- getBinExpr(binned.sample) heatmap(bin.expr, scale='none')
data(amlsample) normed.sample <- quantileNormalise(aml.sample) binned.sample <- flowFPBin(normed.sample) binned.sample <- removeSparseBins(binned.sample, 0.001) bin.expr <- getBinExpr(binned.sample) heatmap(bin.expr, scale='none')
Bin sample using K-means binning
object |
flowSample to bin |
n.bins=128 |
number of bins to use. This should be a power of 2, and will be rounded down to the nearest power of 2 if not. |
n.neighbours=1 |
number of neighbours to use for KNN mapping of bins from clustered tube |
snow.cluster=NULL |
Optional snow cluster to use for parallel execution. |
random.seed=101 |
Random seed to set to make K-means clustering deterministic. |
dequantize=T |
If TRUE, adds a small (region of 1e-8) value to flow data to help break ties when binning. |
Runs K-means clustering on the binning markers in the first tube of the data set. These clusters are then mapped to the other tubes using K-nearest neighbours.
a BinnedFlowSample
data(amlsample) normed.sample <- quantileNormalise(aml.sample) res <- kMeansBin(normed.sample)
data(amlsample) normed.sample <- quantileNormalise(aml.sample) res <- kMeansBin(normed.sample)
Internal function to map bins by KNN
object |
flowSample to map the bins of |
tube.1.labels |
integer vector of bin labels for the events in tube 1 |
n.neighbours=1 |
number of neighbours to use for KNN mapping of bins from clustered tube |
snow.cluster=NULL |
Optional snow cluster to use for parallel execution. |
dequant=T |
If TRUE, adds a small (region of 1e-8) value to flow data to help break ties when binning. |
Takes a FlowSample and labels for the events in tube 1, and maps these to all other tubes.
a BinnedFlowSample
data(amlsample) tube1.expr <- exprs(tube.set(aml.sample)[[1]]) kmeans.res <- kmeans(tube1.expr, 100) kmeans.labels <- kmeans.res$cluster #Now create a binnedFlowExprSet using the cluster labels for tube 1 clustered.sample <- mapBinsKNN(aml.sample, kmeans.labels) sort(table(bin.labels(clustered.sample)[[3]]))
data(amlsample) tube1.expr <- exprs(tube.set(aml.sample)[[1]]) kmeans.res <- kmeans(tube1.expr, 100) kmeans.labels <- kmeans.res$cluster #Now create a binnedFlowExprSet using the cluster labels for tube 1 clustered.sample <- mapBinsKNN(aml.sample, kmeans.labels) sort(table(bin.labels(clustered.sample)[[3]]))
Since the binning parameters are the same across tubes, and samples each tube is an aliquot from the same sample, these should have the same underlying distribution. Hence, quantile normalisation can be used to force this to be so, removing technical variation.
data(amlsample) normed.sample <- quantileNormalise(aml.sample) qnorm.check <- checkQNorm(aml.sample, normed.sample, do.plot=FALSE) show(qnorm.check)
data(amlsample) normed.sample <- quantileNormalise(aml.sample) qnorm.check <- checkQNorm(aml.sample, normed.sample, do.plot=FALSE) show(qnorm.check)
Remove bins from a BinnedFlowSample with few events in them
object |
the BinnedFlowSample to act on |
cutoff.prop=NULL |
the minimum proportion that a bin must contain to be kept. If NULL, only bins with no events in at least one tube will be removed. |
This is important to do prior to calculating bin expression, as bins containing 2 or less events, for, example, cannot have their median computed.
a BinnedFlowSample with sparse bins removed
Methods for function show
in Package flowBin
signature(object = "BinnedFlowExprSet")
Show number of bins and samples for a BinnedFlowExprSet.
signature(object = "CVResult")
Show various statistics stored in a CVResult object.