I have FACS data in a CSV format, when I attempt to transform it with flowCore::transform it returns exactly the same data.frame/matrix with no warnings nor errors.
This is the example in the help page of arcsinhTransform:
samp <- read.FCS(system.file("extdata", "0877408774.B08", package="flowCore")) asinhTrans <- arcsinhTransform(transformationId="ln-transformation", a=1, b=1, c=1) translist <- transformList('FSC-H', asinhTrans) dataTransform <- transform(samp, translist)
We can see it works, at least the column FSC-H changes:
head(samp,2) # FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A FL4-H Time #[1,] 382 77 259.455272 1.00000 7.566695 55 13.09747 1 #[2,] 628 280 9.057978 48.26071 10.273508 0 28.13318 1
head(dataTransform,2) # FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A FL4-H Time #[1,] 7.641184 77 259.455272 1.00000 7.566695 55 13.09747 1 #[2,] 8.137279 280 9.057978 48.26071 10.273508 0 28.13318 1
However when I extract the table from the flowFrame the transformation makes no effect. I tried also logicleTransform and I'm looking for a solution that would work for any tranform function.
samp.df <- exprs(samp) dataTransform.df <- transform(samp.df, translist)
head(samp.df,2) # FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A FL4-H Time #[1,] 382 77 259.455272 1.00000 7.566695 55 13.09747 1 #[2,] 628 280 9.057978 48.26071 10.273508 0 28.13318 1 head(dataTransform.df,2) # FSC.H SSC.H FL1.H FL2.H FL3.H FL1.A FL4.H Time #1 382 77 259.455272 1.00000 7.566695 55 13.09747 1 #2 628 280 9.057978 48.26071 10.273508 0 28.13318 1
If my data looks like samp.df
, what is the best/fastest way to transform it?
I tried also translist <- transformList('FSC.H', asinhTrans)
because of the column names conversion in data.frames
Thanks Mike! That works :)
Follow-up question: In the code at https://github.com/RGLab/openCyto/blob/trunk/R/functions.R there is the comment "update minRange with -111 for proper display of the data". Is that -111 somehow case specific and I should find my own minRange or what is it?
Yeah, you can set the to what ever value you preferred. Type '?read.FCS' and see the description for `min.limit` argument.