The function transform data using logicle transformation.
It makes use of flowCore's implementation of logicle transformation, and can
either automatically infer the transformation function based on your data,
or calculate it based on what you want by looking at the default or overriden linearisation.width, max.scale.val, full.transform.width, additional.negative.range
.
Description of some of the parameter is adapted from flowCore's vignette.
For more information on what logicle transformation does, please read the manuscript in the references section.
Usage
do.logicle(dat, use.cols, linearisation.width, max.scale.val,
full.transform.width, additional.negative.range)
do.logicle(dat, use.cols, auto.infer.function = TRUE,
linearisation.width = 1.2, max.scale.val = 262144, full.transform.width = 4.5,
additional.negative.range = 0)
Arguments
- dat
NO DEFAULT. data.table. Input data
- use.cols
NO DEFAULT. Vector of column names to transform
- auto.infer.function
Default = TRUE. Automatically infer the logical transformation function based on your data. If this is set to FALSE, default or overriden
linearisation.width, max.scale.val, full.transform.width, additional.negative.range
will be used instead to calculate the logical transformation function.- linearisation.width
Default = 1.2. Linearisation width in asymptotic decades. This must be > 0 and determines the slope of transformation at zero. We found 1.2 works well for flow data, and 0.5 works well for cytof data. It can be estimated using equation: \((m-log10(max.scale.val/|r|))/2\) where r is the most negative value to included in the display. See
max.scale.val
below.- max.scale.val
Default = 262144. Maximum scale data value. It can be 10,000 for common 4 decade data or 262144 (the default value) for 18 bit data range. This must be greater than 0
- full.transform.width
Default = 4.5. The full width of the transformed values in asymptotic decades This must be greater than 0
- additional.negative.range
Default = 0. Additional negative range to be included in the transformed value in asymptotic decades. Value greater than 0 will bring the prescribed additional range into the transformed values
References
Parks, David R., Mario Roederer, and Wayne A. Moore. "A new “Logicle” display method avoids deceptive effects of logarithmic scaling for low signals and compensated data." Cytometry Part A: The Journal of the International Society for Analytical Cytology 69.6 (2006): 541-551.
Examples
library(Spectre)
dat = Spectre::demo.clustered[, 2:9]
use.cols = names(dat)
do.logicle(dat, use.cols = use.cols)
#> Loading required package: flowCore
#> Loading required package: Biobase
#> Loading required package: BiocGenerics
#> Loading required package: generics
#>
#> Attaching package: ‘generics’
#> The following objects are masked from ‘package:base’:
#>
#> as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
#> setequal, union
#>
#> Attaching package: ‘BiocGenerics’
#> The following object is masked from ‘package:flowCore’:
#>
#> normalize
#> The following objects are masked from ‘package:stats’:
#>
#> IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#>
#> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#> as.data.frame, basename, cbind, colnames, dirname, do.call,
#> duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
#> mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
#> rank, rbind, rownames, sapply, saveRDS, table, tapply, unique,
#> unsplit, which.max, which.min
#> Welcome to Bioconductor
#>
#> Vignettes contain introductory material; view with
#> 'browseVignettes()'. To cite Bioconductor, see
#> 'citation("Biobase")', and for packages 'citation("pkgname")'.
#> Automatically estimating the logicle transformation function based on input data
#> Transforming data
#> Converting data back to data.table
#> NK11 CD3 CD45 Ly6G CD11b B220 CD8a
#> <num> <num> <num> <num> <num> <num> <num>
#> 1: 42.3719 40.098700 6885.08 -344.7830 14787.30 -40.2399 83.7175
#> 2: 42.9586 119.014000 1780.29 -429.6650 5665.73 86.6673 34.7219
#> 3: 59.2366 206.238000 10248.30 -1603.8400 19894.30 427.8310 285.8800
#> 4: 364.9480 -0.233878 3740.04 -815.9800 9509.43 182.4200 333.6050
#> 5: 440.2470 40.035200 9191.38 40.5055 5745.82 -211.6940 149.2200
#> ---
#> 169000: 910.8890 72.856100 31466.20 -316.5570 28467.80 -7.7972 -271.8040
#> 169001: -10.2642 64.188700 45188.00 -540.5140 22734.00 202.4110 -936.4920
#> 169002: -184.2910 -9.445650 11842.60 -97.9383 17237.00 123.4760 -219.9320
#> 169003: 248.3860 229.986000 32288.20 -681.1630 19255.80 -656.0540 -201.5880
#> 169004: 738.9810 95.470300 46185.10 -1004.6000 22957.80 -661.6280 72.3356
#> Ly6C NK11_logicle CD3_logicle CD45_logicle Ly6G_logicle
#> <num> <num> <num> <num> <num>
#> 1: 958.7000 1.2627599 1.283089 2.992934 0.9701060
#> 2: 448.2590 1.2640218 1.548692 2.405522 0.9517178
#> 3: 1008.8300 1.2989559 1.799549 3.165677 0.7053556
#> 4: 440.0710 1.8714522 1.140471 2.727902 0.8686807
#> 5: 87.4815 1.9776423 1.282866 3.118405 1.0538616
#> ---
#> 169000: 12023.7000 2.4113824 1.396508 3.652869 0.9762283
#> 169001: 4188.3300 1.1491585 1.366834 3.810048 0.9277679
#> 169002: 8923.4000 0.7853742 1.107778 3.228472 1.0237366
#> 169003: 10365.7000 1.6782635 1.858508 3.664068 0.8975110
#> 169004: 9704.4700 2.2872091 1.472432 3.819526 0.8286947
#> CD11b_logicle B220_logicle CD8a_logicle Ly6C_logicle
#> <num> <num> <num> <num>
#> 1: 3.085342 1.0562608 1.4136626 1.3349551
#> 2: 2.608476 1.2076286 1.3546434 1.0003851
#> 3: 3.224803 1.5880181 1.6510223 1.3600907
#> 4: 2.871745 1.3201315 1.7044840 0.9936275
#> 5: 2.615834 0.8547267 1.4919822 0.6637169
#> ---
#> 169000: 3.390039 1.0949967 0.9904270 2.5534904
#> 169001: 3.286692 1.3432289 0.3881125 2.0653896
#> 169002: 3.157749 1.2511790 1.0502296 2.4179607
#> 169003: 3.209600 0.4118100 1.0716537 2.4862494
#> 169004: 3.291217 0.4072407 1.3999754 2.4562570