Issue creating transformed filter in flowCore
1
0
Entering edit mode
npb27 • 0
@npb27-21229
Last seen 5.4 years ago

Hi all,

Apologies if this is an easy fix, but I came across an error whilst trying to use flowcore to make a transformed filter on my flow cytometry data.

The aim to is to transform the data using the logicle transformation, and gate around a set of cells using an ellipse-shaped filter

Here is my code:


**# filter out dead cells: y <- read.FCS(emptyValue = F, "Tgalcalibration28-6-1924h1.fcs", transformation=FALSE,alter.names=TRUE) tFilter = transform("FSC.A"=logicleTransform, "SSC.A"=logicleTransform) ematrix <- matrix(c(1.1, 0.3, 0.5, 0.6), ncol=2, dimnames=list(c("FSC.A", "SSC.A"), c("FSC.A", "SSC.A"))) mean <- c("FSC.A"=4.4, "SSC.A"=4.01) egate <- ellipsoidGate(cov=ematrix, mean= mean) %on% tFilter no_dead <- Subset(y, egate) %on% tFilter


It runs fine until the final line, which throws the error:


Error in (function (cl, name, valueClass) : assignment of an object of class “numeric” is not valid for @‘transformationId’ in an object of class “transform”; is(value, "character") is not TRUE


Which I can't make head or tail of.

Is the issue related to the use of the logicle transform, which the transformed gate isn't designed for.

This is the output of sessionInfo():


> sessionInfo() R version 3.6.0 (2019-04-26) Platform: x8664-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) Matrix products: default locale: [1] LCCOLLATE=EnglishUnited States.1252 LCCTYPE=EnglishUnited States.1252 LCMONETARY=EnglishUnited States.1252 LCNUMERIC=C
[5] LCTIME=EnglishUnited States.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] flowStats3.40.1 ggcyto1.10.2 flowWorkspace3.30.2 ncdfFlow2.28.1 flowViz1.46.1 cluster2.1.0
[7] BH1.69.0-1 RcppArmadillo0.9.500.2.0 ggplot23.2.0 lattice0.20-38 flowCore1.51.7 usethis1.5.0
[13] devtools2.0.2
loaded via a namespace (and not attached): [1] mclust
5.4.4 Rcpp1.0.1 mvtnorm1.0-11 prettyunits1.0.2 ps1.3.0 assertthat0.2.1 rprojroot1.3-2 digest0.6.19
[9] plyr
1.8.4 R62.4.0 backports1.1.4 stats43.6.0 pcaPP1.9-73 pillar1.4.2 zlibbioc1.28.0 rlang0.4.0
[17] lazyeval
0.2.2 curl3.3 rstudioapi0.10 data.table1.12.2 callr3.2.0 Rgraphviz2.26.0 hexbin1.27.3 Matrix1.2-17
[25] splines
3.6.0 desc1.2.0 stringr1.4.0 munsell0.5.0 compiler3.6.0 pkgconfig2.0.2 BiocGenerics0.30.0 pkgbuild1.0.3
[33] IDPmisc
1.1.19 tidyselect0.2.5 gridExtra2.3 tibble2.1.3 matrixStats0.54.0 XML3.98-1.20 crayon1.3.4 rrcov1.4-7
[41] dplyr
0.8.2 withr2.1.2 MASS7.3-51.4 grid3.6.0 gtable0.3.0 magrittr1.5 scales1.0.0 graph1.60.0
[49] KernSmooth
2.23-15 stringi1.4.3 cli1.1.0 fs1.3.1 remotes2.1.0 latticeExtra0.6-28 robustbase0.93-5 RColorBrewer1.1-2 [57] tools3.6.0 Biobase2.44.0 glue1.3.1 DEoptimR1.0-8 purrr0.3.2 ks1.11.5 processx3.3.1 pkgload_1.0.2


Any help with this issue would be much appreciated

Nick

flowCore • 886 views
ADD COMMENT
0
Entering edit mode
Jake Wagner ▴ 310
@jake-wagner-19995
Last seen 4.0 years ago

You can do this using a transformList, which is discussed a bit in the package vignette. Additionally, logicleTransform() will give you default transformation parameters, but you should look at estimateLogicle() to estimate these for your data. Anyway, try this (adapted from your code):

#filter out dead cells: 
y <- read.FCS(emptyValue = F, 
              "Tgalcalibration28-6-1924h1.fcs", 
               transformation=FALSE,
               alter.names=TRUE)

# Consider estimateLogicle() as well (swap in first line below)
#tList <- estimateLogicle(y, c("FSC.A", "SSC.A"))
tList <- transformList(c("FSC.A", "SSC.A"), logicleTransform())

ematrix <- matrix(c(1.1, 0.3, 0.5, 0.6), ncol=2, 
                  dimnames=list(c("FSC.A", "SSC.A"), c("FSC.A", "SSC.A")))
mean <- c("FSC.A"=4.4, "SSC.A"=4.01)
egate <- ellipsoidGate(cov=ematrix, mean= mean) %on% tList
no_dead <- Subset(y, egate)

Further, you can consider using a GatingSet from the flowWorkspace package as an easier way to manage these subsetting operations.

ADD COMMENT

Login before adding your answer.

Traffic: 1093 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6