Re-naming $PnS parameters
1
0
Entering edit mode
jasonemo • 0
@a255634a
Last seen 3.7 years ago

Since the latest FlowCore update, when I try to rename the $PnS parameters those marker names are not saved to my file when writing FCS files. However, when I rename $PnN parameters the marker names do get saved to file. In an older version of flowcore, I could rename $PnN and $PnS parameters without any problems. Could this be fixed in the next update?

```

flowCore • 1.4k views
ADD COMMENT
0
Entering edit mode
SamGG ▴ 350
@samgg-6428
Last seen 19 hours ago
France/Marseille/Inserm

I am not part of RGLab, so this is not an official answer.

Keeping keywords and descriptions is not a simple task. The current approach uses the desc column when writing a flow frame to disk. The keyword $PnS is therefore ignored. Maybe setting $PnS should be forbidden or synchronized with desc. Whatever, here is a code that is currently working. It's not perfect, but it is working.

For the next, try to be more precise than "older version of flowCore".

Best.

library(flowCore)
R.version.string
#> [1] "R version 4.0.3 (2020-10-10)"
packageVersion("flowCore")
#> [1] '2.2.0'
# a sample file
fcsFile <- system.file("extdata", "0877408774.B08", package="flowCore")
## read file and linearize values
samp <-  read.FCS(fcsFile, transformation="linearize")
# overview
samp
#> flowFrame object '0877408774.B08'
#> with 10000 cells and 8 observables:
#>            name              desc     range  minRange  maxRange
#> $P1       FSC-H             FSC-H      1024   0.00000      1023
#> $P2       SSC-H             SSC-H      1024   0.00000      1023
#> $P3       FL1-H                NA      1024   1.00904     10000
#> $P4       FL2-H                NA      1024   1.00904     10000
#> $P5       FL3-H                NA      1024   1.00904     10000
#> $P6       FL1-A                NA      1024   0.00000      1023
#> $P7       FL4-H                NA      1024   1.00904     10000
#> $P8        Time Time (51.20 sec.)      1024   0.00000      1023
#> 164 keywords are stored in the 'description' slot
keyword(samp, "$P1S")
#> $`$P1S`
#> [1] "FSC-H"
# change keyword
keyword(samp) = list("$P1S" = "FCS_H_kwd")
keyword(samp)
#> $`$P1S`
#> [1] "FCS_H_kwd"
# change desc field
pData(parameters(samp))$desc[1] = "FSC_H_desc"
samp
#> flowFrame object 'anonymous'
#> with 10000 cells and 8 observables:
#>            name              desc     range  minRange  maxRange
#> $P1       FSC-H        FSC_H_desc      1024   0.00000      1023
#> $P2       SSC-H             SSC-H      1024   0.00000      1023
#> $P3       FL1-H                NA      1024   1.00904     10000
#> $P4       FL2-H                NA      1024   1.00904     10000
#> $P5       FL3-H                NA      1024   1.00904     10000
#> $P6       FL1-A                NA      1024   0.00000      1023
#> $P7       FL4-H                NA      1024   1.00904     10000
#> $P8        Time Time (51.20 sec.)      1024   0.00000      1023
#> 1 keywords are stored in the 'description' slot
# overview
read.FCS(write.FCS(samp, "test.fcs"))
#> flowFrame object 'test.fcs'
#> with 10000 cells and 8 observables:
#>            name              desc     range  minRange  maxRange
#> $P1       FSC-H        FSC_H_desc      1024         0      1023
#> $P2       SSC-H             SSC-H      1024         0      1023
#> $P3       FL1-H                NA      3653         0      3652
#> $P4       FL2-H                NA      9912         0      9911
#> $P5       FL3-H                NA      3280         0      3279
#> $P6       FL1-A                NA      1024         0      1023
#> $P7       FL4-H                NA      9823         0      9822
#> $P8        Time Time (51.20 sec.)       627         0       626
#> 67 keywords are stored in the 'description' slot
# the winning is desc!

Created on 2021-03-16 by the [reprex package](https://reprex.tidyverse.org) (v1.0.0)

ADD COMMENT

Login before adding your answer.

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