Title: | Variance stabilization in flow cytometry (and microarrays) |
---|---|
Description: | Per-channel variance stabilization from a collection of flow cytometry samples by Bertlett test for homogeneity of variances. The approach is applicable to microarrays data as well. |
Authors: | Ariful Azad |
Maintainer: | Ariful Azad <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.39.0 |
Built: | 2024-11-29 07:58:55 UTC |
Source: | https://github.com/bioc/flowVS |
Please see the vignette.
Ariful Azad <[email protected]>
Ariful Azad, Bartek Rajwa, and Alex Pothen (2015), "flowVS: Channel-Specific Variance Stabilization in Flow Cytometry", BMC Bioinformatics, vol 17, pp 1-14, 2016.
This function estimates the variance stabilizing cofactors, one for each channel for the entire dataset. When a fluorescence channel z
is transformed by asinh transformation with the optimum cofactor for z
, the within-population variances of populations from all samples in the channel z
are approximately stabilized.
estParamFlowVS(fs, channels)
estParamFlowVS(fs, channels)
fs |
A flowSet containing a collection of flow cyometry samples. |
channels |
A character vector identifying the channels/dimensions to be transformed. If any entry in this vector is not present in the flowSet, the function returns with an error. |
Let z
be a fluorescence channel (column of a flowFrame).
We consider transforming z
by asinh transformation such that after transformation we obtain the tranformed channel asinh(z/c
), where c
is a normalizing cofactor.
The estParamFlowVS
function estimates cofactors, one for each channel for the entire dataset such that the within-population variance is stabilized in each fluorescence channel. When a fluorescence channel z
is transformed by asinh transformation with the optimum cofactor for z
, the within-population variances of populations from all samples in the channel z
are approximately stabilized.
estParamFlowVS
returns a numeric vector representing the optimum cofactors for the requested channels. The optimum cofactor for the input channels[i]
is stored in the i
th entry of the returned vector.
Ariful Azad
Ariful Azad, Bartek Rajwa, and Alex Pothen (2015), "flowVS: Channel-Specific Variance Stabilization in Flow Cytometry", BMC Bioinformatics, vol 17, pp 1-14, 2016.
data(HD) ## identify optimum cofactor for CD3 and CD4 channels (from five samples) cofactors = estParamFlowVS(HD[1:5],channels=c('CD3','CD4')) # See detail examples in the documentation of the transFlowVS function.
data(HD) ## identify optimum cofactor for CD3 and CD4 channels (from five samples) cofactors = estParamFlowVS(HD[1:5],channels=c('CD3','CD4')) # See detail examples in the documentation of the transFlowVS function.
A flowSet
cotaining 12 flow cytometry samples from three healthy individuals "A", "C", and "D".
From each individual, the samples were drawn on two different days and two technical replicates were created from each sample (i.e., 3 x 2 x 2 = 12 samples).
Each HD sample was stained using labeled antibodies against CD45, CD3, CD4, CD8, and CD19 protein markers.
Here, an HD sample "C_4_2" means that it is collected on day 4 from individual "C" and it is the second replicate on that day.
We have identified lymphocytes in each sample of the HD dataset and apply the subsequent analysis on lymphocytes.
data(HD)
data(HD)
A flowSet
containing 12
flowFrames
. There are 3
subject groups with 4 samples each (2 days and 2 technical replicates per day).
Ariful Azad, Arif Khan, Bartek Rajwa, Saumyadipta Pyne, and Alex Pothen, "Classifying immunophenotypes with templates from flow cytometry", In Proceedings of the International Conference on Bioinformatics, Computational Biology and Biomedical Informatics (ACM BCB), 2013.
Identify and retain lymphocytes from a flow cytometry sample based on the forward and side scatters.
lymphs(ff, lymph.boundary, fsc, ssc, plot=FALSE)
lymphs(ff, lymph.boundary, fsc, ssc, plot=FALSE)
ff |
A flowFrame containing a flow cyometry sample. |
lymph.boundary |
A list denoting an approximate rectangular boundary for lymphocytes. The first element of the list represents the lower and upper limit of forward scatter (FSC), and the 2nd element represents the lower and upper limit of side scatter (SSC). Example: list("FSC"=c(180000, 500000),"SSC"=c(0, 180000)). |
fsc |
name (or numeric index) of the forward scatter channel. |
ssc |
name (or numeric index) of the side scatter channel. |
plot |
true/false. If true then plots the rectangular and elliptical gates for the lymphocytes. |
At first a rectangular gate is created based on the lymph.boundary
.
Then the norm2Filter
function is used to identify lymphocytes.
lymphs
returns a new flowFrame containing the lymphocytes.
Ariful Azad
Ariful Azad, Bartek Rajwa, and Alex Pothen (2015), "flowVS: Channel-Specific Variance Stabilization in Flow Cytometry", BMC Bioinformatics, vol 17, pp 1-14, 2016.
library(flowStats) data(ITN) # identify lymphocytes ITN.lymphs = lymphs(ITN[[1]], list("FS"=c(200, 600),"SS"=c(0, 400)), "FSC", "SSC",TRUE)
library(flowStats) data(ITN) # identify lymphocytes ITN.lymphs = lymphs(ITN[[1]], list("FS"=c(200, 600),"SS"=c(0, 400)), "FSC", "SSC",TRUE)
Variance-stabilizing inverse hyperbolic sine (asinh
) transformation for microarray data.
microVS(data, cfLow=0, cfHigh=10, frac=1)
microVS(data, cfLow=0, cfHigh=10, frac=1)
data |
The microarray data in a Matrix. |
cfLow |
lowest possible value of cofactor (log scale). |
cfHigh |
highest possible value of cofactor (log scale). |
frac |
fraction of differentially expressed genes used in variance stabilization (0< frac <=1). |
This function transforms a microarray data matrix z
by asinh(z/c)
transformation where c
is a normalizing cofactor.
The cofactor is searched in the range [cfLow, cfHigh]
and an optimum cofactor is obtained for which the transformed data is variance stabilized.
The optimum cofactor is obtained by minimizing Bartlett's test statistics for homogeneity of variance.
If the parameter frac
is less then one, a fraction of differentially expressed genes are used in estimating the cofactor.
microVS
returns a matrix of the variance-stabilizing microarray data.
Ariful Azad
Ariful Azad, Bartek Rajwa, and Alex Pothen (2015), "flowVS: Channel-Specific Variance Stabilization in Flow Cytometry", BMC Bioinformatics, vol 17, pp 1-14, 2016.
# stabilize variance of the Kidney microarray data from the vsn package library(vsn) data(kidney) kidney.t = microVS(exprs(kidney)) plotMeanSd(kidney.t)
# stabilize variance of the Kidney microarray data from the vsn package library(vsn) data(kidney) kidney.t = microVS(exprs(kidney)) plotMeanSd(kidney.t)
Plot row standard deviations versus row means of a data matrix.
plotMeanSd(x, ranks = TRUE, xlab = ifelse(ranks, "Rank of means (ascending order)", "mean"), ylab = "Standard deviation", pch = ".", plot = TRUE, ...)
plotMeanSd(x, ranks = TRUE, xlab = ifelse(ranks, "Rank of means (ascending order)", "mean"), ylab = "Standard deviation", pch = ".", plot = TRUE, ...)
x |
An object of class
|
ranks |
Logical, indicating whether the x-axis (means) should be plotted
on the original scale ( |
xlab |
Character, label for the x-axis. |
ylab |
Character, label for the y-axis. |
pch |
Plot symbol. |
plot |
Logical. If |
... |
Further arguments that get passed to plot.default. |
Standard deviation and mean are calculated row-wise from the
expression matrix (in) x
. The scatterplot of these versus each other
allows to visually verify whether there is a dependence of the standard
deviation (or variance) on the mean.
The red dots depict the running median estimator (window-width 10%).
If there is no variance-mean dependence, then the line formed by the
red dots should be approximately horizontal.
A named list with four components: its elements px
and
py
are the x- and y-coordinates of the individual data points
in the plot; its first and second element are the x-coordinates and values of
the running median estimator (the red dots in the plot).
Depending on the value of plot
, the method can also have a side effect, which is to create a plot on the
active graphics device.
library(vsn) data(kidney) kidney.t = microVS(exprs(kidney)) plotMeanSd(kidney.t)
library(vsn) data(kidney) kidney.t = microVS(exprs(kidney)) plotMeanSd(kidney.t)
This function transforms a flowSet by asinh transformation with the cofactors passed on to the function. The optimum cofactors that stabilize within-population variances in different fluorescence channels are estimated beforehand and passed to this function for data transformation.
transFlowVS(fs, channels, cofactors)
transFlowVS(fs, channels, cofactors)
fs |
A flowSet containing a collection of flow cyometry samples. |
channels |
A character vector identifying the channels/dimensions to be transformed. If any entry in this vector is not present in the flowSet, the function returns with an error. |
cofactors |
A numeric vector. |
This function transforms a flowSet by asinh transformation with selected cofactors.
The column with name channels[i]
of every flowFrame of the input flowSet is transformed by asinh transformation with cofactors[i]
.
For example, let z_ij
be the i
th column of j
th flowFrame in the input flowSet fs
.
Then after transformation z_ij
would be converted to asinh(z_ij/cofactors[i]
).
For variance stabiilzation, the optimum cofactors that stabilize within-population variances in different fluorescence channels are estimated beforehand and passed to this function for data transformation.
Variance stabilizing cofactors can be estimatd by the estParamFlowVS
function.
transFlowVS
returns a new flowSet with the transformed channels.
Ariful Azad
Ariful Azad, Bartek Rajwa, and Alex Pothen (2015), "flowVS: Channel-Specific Variance Stabilization in Flow Cytometry", BMC Bioinformatics, vol 17, pp 1-14, 2016.
## ------------------------------------------------ ## Example 1: Healthy data from flowVS package ## ------------------------------------------------ data(HD) ## identify optimum cofactor for CD3 and CD4 channels (from five samples) cofactors = estParamFlowVS(HD[1:5],channels=c('CD3','CD4')) ## transform CD3 and CD4 channels in all samples HD.VS = transFlowVS(HD, c('CD3','CD4'), cofactors) densityplot(~CD3+CD4, HD.VS, main="Transfromed CD3 and CD4 channels in HD data") ## ------------------------------------------------ ## Example 2: ITN data from flowStats package ## ------------------------------------------------ library(flowStats) data(ITN) # identify lymphocytes ITN.lymphs = fsApply(ITN,lymphs, list("FS"=c(200, 600),"SS"=c(0, 400)), "FSC", "SSC",FALSE) ## identify optimum cofactor for CD3 and CD4 channels (from five samples) cofactors = estParamFlowVS(ITN.lymphs[1:5],channels=c('CD3', 'CD4')) ## transform CD3 and CD4 channels in all samples ITN.VS = transFlowVS(ITN.lymphs, c('CD3','CD4'), cofactors) densityplot(~CD3+CD4, ITN.VS, main="Transfromed CD3 and CD4 channels in ITN data")
## ------------------------------------------------ ## Example 1: Healthy data from flowVS package ## ------------------------------------------------ data(HD) ## identify optimum cofactor for CD3 and CD4 channels (from five samples) cofactors = estParamFlowVS(HD[1:5],channels=c('CD3','CD4')) ## transform CD3 and CD4 channels in all samples HD.VS = transFlowVS(HD, c('CD3','CD4'), cofactors) densityplot(~CD3+CD4, HD.VS, main="Transfromed CD3 and CD4 channels in HD data") ## ------------------------------------------------ ## Example 2: ITN data from flowStats package ## ------------------------------------------------ library(flowStats) data(ITN) # identify lymphocytes ITN.lymphs = fsApply(ITN,lymphs, list("FS"=c(200, 600),"SS"=c(0, 400)), "FSC", "SSC",FALSE) ## identify optimum cofactor for CD3 and CD4 channels (from five samples) cofactors = estParamFlowVS(ITN.lymphs[1:5],channels=c('CD3', 'CD4')) ## transform CD3 and CD4 channels in all samples ITN.VS = transFlowVS(ITN.lymphs, c('CD3','CD4'), cofactors) densityplot(~CD3+CD4, ITN.VS, main="Transfromed CD3 and CD4 channels in ITN data")