R: Optimizing transformations for flow cytometry data.
flowTrans
R Documentation
Optimizing transformations for flow cytometry data.
Description
This is the principal function in the package. The function takes data,
a transformation function name, dimension names, and optional
preselection parameter as input, and runs the maximum likelihood
optimization on the data, performs the transformation, and returns the
transformed data together with a list of transformation paramters for
each dimension. The optimization is set to maximize the likelihood of
the parameters given the data, such that the transformed data is
normally distributed. An optional parameter n2f=[T,F] allows an
automated preselection of an approximately bivariate normal population
via the norm2Filter function. The transformation parameters are
then optimized for this preselected region, and finally applied globally
to the entire range of data. The optional argument
parameters.only=[T,F] specifies whether to return the parameters
or the transformed data.
Usage
flowTrans(dat, fun, dims, n2f,parameters.only)
Arguments
dat
The data to be transformed, should be a flowFrame object.
fun
A character string naming the transformation function to be
applied. Can be one of: mclMultivBiexp,
mclMultivBoxCox,mclMultivArcSinh, and mclMultivLinLog.
The Multiv series of functions estimate common transformation
parameters for all dimensions.
dims
A character vector identifying the dimensions to be transformed.
n2f
An optional TRUE, FALSE value identifying whether the data
should be prefiltered with norm2Filter to select a region of
the data for which to optimize the transformation. Default is
FALSE.
parameters.only
A logical specifying whether to return only the parameters, and
not the transformed data.
mclMultivArcSinh a, b, c; c=0
mclMultivBiexp a, b, c, d, f, w; f=0
mclMultivBoxCox theta
mclMultivLinLog theta
Details
The transformation functions are multivariate, common parameter
transformations. The implementation utilizes a look up table to call
optimization routines for the different transformations as well as
optional flowCore and flowClust transformation
implementations to optimize parameters and transform data from a
single interface. Parameters are optimized such that the transformed
data is multivariate-normal.
Value
if parameters.only = FALSE then:
flowTransResult
A flowTransResult object
If parameters.only=TRUE the returned value will be a vector of
common transformation parameters:
if mclMultivArcSinh is called, the returned vector will
contain a, b, and c=0;
if mclMultivBiexp is called, the returned vector will
contain a, b, c, d, w;
if mclMultivBoxCox is called, the returned vector will
contain theta;
if mclMultivLinLog is called, the returned vector will
contain theta.
Finak G, Perez J M, Weng A, Gottardo R. Optimizing
Transformations for Flow Cytometry. (Submitted)
Examples
data(GvHD)
result <- flowTrans(GvHD[[1]], "mclMultivArcSinh",
colnames(GvHD[[1]])[1:2], n2f=FALSE, parameters.only=FALSE)
par(mfrow=c(1,2))
contour(GvHD[[1]][,1:2], main="Untransformed FSC vs SSC")
contour(result$result[,1:2], main="Transformed FSC vs SSC")
summary(result)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(flowTrans)
Loading required package: flowCore
Loading required package: flowViz
Loading required package: lattice
Loading required package: flowClust
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:flowCore':
normalize, sort
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: graph
Loading required package: RBGL
Loading required package: ellipse
Loading required package: mnormt
Loading required package: corpcor
Loading required package: clue
Attaching package: 'flowClust'
The following object is masked from 'package:graphics':
box
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/flowTrans/flowTrans.Rd_%03d_medium.png", width=480, height=480)
> ### Name: flowTrans
> ### Title: Optimizing transformations for flow cytometry data.
> ### Aliases: flowTrans
> ### Keywords: models optimize
>
> ### ** Examples
>
> data(GvHD)
> result <- flowTrans(GvHD[[1]], "mclMultivArcSinh",
+ colnames(GvHD[[1]])[1:2], n2f=FALSE, parameters.only=FALSE)
> par(mfrow=c(1,2))
> contour(GvHD[[1]][,1:2], main="Untransformed FSC vs SSC")
> contour(result$result[,1:2], main="Transformed FSC vs SSC")
> summary(result)
Transformation:
[1] "mclMultivArcSinh"
Transformed Results:
flowFrame object 's5a01'
with 3420 cells and 8 observables:
name desc range minRange maxRange
$P1N FSC-H FSC-Height 7.624613 4.787555 7.624613
$P2N SSC-H SSC-Height 7.624613 2.644115 7.624613
$P3N FL1-H CD15 FITC 10000.000000 1.000000 10000.000000
$P4N FL2-H CD45 PE 9221.665909 1.000000 9221.665909
$P5N FL3-H CD14 PerCP 1131.783715 1.000000 1131.783715
$P6N FL2-A <NA> 1023.000000 0.000000 1023.000000
$P7N FL4-H CD33 APC 1162.769539 1.000000 1162.769539
$P8N Time Time (51.20 sec.) 755.000000 1.000000 755.000000
153 keywords are stored in the 'description' slot
Transformation parameters:
a b c
0.9999977 0.9999939 0.0000000
>
>
>
>
>
> dev.off()
null device
1
>