Search
Question: How to transform cytometry data from CSV and not FCS file?
0
gravatar for Julia
2.2 years ago by
Julia0
Helsinki, Finland
Julia0 wrote:

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

ADD COMMENTlink modified 2.2 years ago by Jiang, Mike1.1k • written 2.2 years ago by Julia0
2
gravatar for Jiang, Mike
2.2 years ago by
Jiang, Mike1.1k
(Private Address)
Jiang, Mike1.1k wrote:

'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 COMMENTlink written 2.2 years ago by Jiang, Mike1.1k

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 REPLYlink written 2.2 years ago by Julia0
1

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

ADD REPLYlink written 2.2 years ago by Jiang, Mike1.1k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 119 users visited in the last hour