How to transform cytometry data from CSV and not FCS file?
1
2
Entering edit mode
Julia ▴ 20
@julia-10029
Last seen 4.0 years ago
Helsinki, Finland

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

flowcore transform data.frame • 3.6k views
ADD COMMENT
3
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 3.1 years ago
(Private Address)

'Transform' method in flowCore is defined for 'flowFrame` or `flowSet`. So you want to convert your 'data.frame' into `flow object` first.

Here are convenient wrappers (currently not exported) you can use to load csv into `flowFrame` or `flowSet`

openCyto:::.read.FCS.csv

openCyto:::.read.flowSet.csv
ADD COMMENT
0
Entering edit mode

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?

ADD REPLY
1
Entering edit mode

Yeah, you can set the to what ever value you preferred. Type '?read.FCS' and see the description for `min.limit` argument.

ADD REPLY

Login before adding your answer.

Traffic: 507 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