Possible to set alternative colnames on read.flowSet (flowCore)
1
0
Entering edit mode
Aric Gregson ▴ 270
@aric-gregson-3058
Last seen 10.2 years ago
Hello, I would like to be able to set the colnames of a flowSet to the user defined labels at the time of reading in the flowSet with read.flowSet. I'm not sure how to go about doing this. From the output of keyword(fs [[1]]) the colnames are taken from the $PXN keyword, but I would like to specify it use $PXS keyword instead. $`$P16N` --------------> used by read.flowSet as colnames [1] "Indo-1 (Violet)-A" $`$P16S` --------------> would like to use instead [1] "BlueUV-Live" Is there a way to specify this with read.flowSet? Thanks for any pointers. Aric -- Aric Gregson <a.gregson at="" ucla.edu="">
GO GO • 2.3k views
ADD COMMENT
0
Entering edit mode
Florian Hahne ▴ 540
@florian-hahne-2471
Last seen 10.2 years ago
Yes there is. From the documentation of read.flowSet: name.keyword: An optional character vector that specifies which FCS keyword to use as the sample names. If this is not set, the GUID of the FCS file is used for sampleNames, and if that is not present (or not unique), then the file names are used. Florian Aric Gregson wrote: > Hello, > > I would like to be able to set the colnames of a flowSet to the user > defined labels at the time of reading in the flowSet with read.flowSet. > I'm not sure how to go about doing this. From the output of keyword(fs > [[1]]) the colnames are taken from the $PXN keyword, but I would like > to specify it use $PXS keyword instead. > > $`$P16N` --------------> used by read.flowSet as colnames > [1] "Indo-1 (Violet)-A" > > $`$P16S` --------------> would like to use instead > [1] "BlueUV-Live" > > Is there a way to specify this with read.flowSet? Thanks for any > pointers. > > Aric > -- Florian Hahne, PhD Computational Biology Program Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-3148 fhahne at fhcrc.org
ADD COMMENT
0
Entering edit mode
Florian, On Fri, 06 Mar 2009 13:40:23 -0800 Florian Hahne <fhahne at="" fhcrc.org=""> wrote: > Yes there is. > From the documentation of read.flowSet: > name.keyword: An optional character vector that specifies which FCS > keyword to use as the sample names. If this is not set, the > GUID of the FCS file is used for sampleNames, and if that is > not present (or not unique), then the file names are used. Sorry, I'm not following you. In the examples, name.keyword is used for the file names and appears to take a keyword from the FCS file as its target, such as "SAMPLE ID". Maybe colname.keyword? Even then, I don't understand how I could tell read.flowSet to read the keyword just after the one it normally does to take the colnames. Maybe a grep operation? The FCS keyword changes with each channel, the channel number in the below example is augmented by one as you go along. $`$P13N` [1] "AmCyan-A" $`$P13S` "AmCyan-CD3" . . . $`$P16N` --------------> used by read.flowSet as colnames [1] "Indo-1 (Violet)-A" $`$P16S` --------------> would like to use instead [1] "BlueUV-Live" Thanks, Aric -- Aric Gregson <a.gregson at="" ucla.edu="">
ADD REPLY
0
Entering edit mode
Hi Aric, sorry, I thought you wanted to change the sample names based on a keyword. Wasn't reading carefully enough... There is no switch to do this during data import, but you can always use the colnames<- replace method to alter the colnames of a flowSet (and also of all the flowFrames in the set). One way of getting the keywords out is this (assuming that foo is your flowSet): keyword(foo[[1]], function(x) keyword(x, grep("\\$P[0-9]*S", names(description(x)), value=TRUE))) Or, even simpler colnames(foo) <- pData(parameters(foo[[1]]))$desc If you think that this is an important enough use case I can add an option to read.FCS that allows to chose a PnS to be used as colnames, however this might introduce more trouble than it is worth since only PnN is guaranteed to be unique for each channel, and is has to be in order to work as a colname. Florian Aric Gregson wrote: > Florian, > > On Fri, 06 Mar 2009 13:40:23 -0800 > Florian Hahne <fhahne at="" fhcrc.org=""> wrote: > > >> Yes there is. >> From the documentation of read.flowSet: >> name.keyword: An optional character vector that specifies which FCS >> keyword to use as the sample names. If this is not set, the >> GUID of the FCS file is used for sampleNames, and if that is >> not present (or not unique), then the file names are used. >> > > Sorry, I'm not following you. In the examples, name.keyword is used for > the file names and appears to take a keyword from the FCS file as its > target, such as "SAMPLE ID". Maybe colname.keyword? Even then, I don't > understand how I could tell read.flowSet to read the keyword just > after the one it normally does to take the colnames. Maybe a grep > operation? The FCS keyword changes with each channel, the channel > number in the below example is augmented by one as you go along. > > $`$P13N` > [1] "AmCyan-A" > > $`$P13S` > "AmCyan-CD3" > . > . > . > $`$P16N` --------------> used by read.flowSet as colnames > [1] "Indo-1 (Violet)-A" > > $`$P16S` --------------> would like to use instead > [1] "BlueUV-Live" > > Thanks, > > Aric > -- Florian Hahne, PhD Computational Biology Program Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-3148 fhahne at fhcrc.org
ADD REPLY
0
Entering edit mode
Florian, On Fri, 06 Mar 2009 16:50:49 -0800 Florian Hahne <fhahne at="" fhcrc.org=""> wrote: > One way of getting the keywords out is this (assuming that foo is > your flowSet): > keyword(foo[[1]], function(x) keyword(x, grep("\\$P[0-9]*S", > names(description(x)), value=TRUE))) > > Or, even simpler > colnames(foo) <- pData(parameters(foo[[1]]))$desc > > If you think that this is an important enough use case I can add an > option to read.FCS that allows to chose a PnS to be used as > colnames, however this might introduce more trouble than it is worth > since only PnN is guaranteed to be unique for each channel, and is > has to be in order to work as a colname. I think that you are correct in that it will lead to more problems than it is worth. I'm sorry, but I had no idea the parameter of interest was called $desc! That takes care of the problem right away! BTW, using Data(wf[["view"]]) in plots works exactly as expected. It is just the wf[["view"]] alone that is odd. Now that I realize that Data() is necessary, it is just great. This is not really documented in the newer flowCore section discussing use of wf views for plotting. Thanks! Aric -- Aric Gregson <a.gregson at="" ucla.edu="">
ADD REPLY

Login before adding your answer.

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