Help with flowCore Package: Working through the HowTo
1
0
Entering edit mode
M. Jankowski ▴ 160
@m-jankowski-2199
Last seen 7.9 years ago
• 1.5k views
0
Entering edit mode
Byron Ellis ▴ 100
@byron-ellis-2138
Last seen 7.9 years ago
On 6/18/07, M. Jankowski <mjankowski at="" gmail.com=""> wrote: > Hi all, > > > As you can see, I have some pretty far outliers in all the data sets. > What procedure would I follow to gate the data to less than 800 for > "FSC.H" and "SSC.H"? Further, how would I plot the result of the gated > data? In the context of the HowTo I would call my question "2.1.4: > Gating and Plotting a flowFrame" Section 4 of the How To is entirely about filtering/gating with 4.3 being the section relevant to your question. In your case you probably want a rectangleGate of some sort. For example, Subset(x,rectangleGate("FSC.H"=c(0,800),"SSC.H"=c(0,800))) would cut your frame down to size. As for plotting, this is somewhat more difficult. The flowViz package has some facilities for plotting a gate onto a plot of the data, but you'd have to ask Deepayan about that---I've never actually used it. > > The flowSet discussion in the HowTo does cover filtering and gating. > When I attempt to read my file in as a flowset I get errors. > > Section 2.2.1 give the instruction: > > frames <- lapply(dir(system.file("extdata", "compdata", "data", > + package = "flowCore"), full.names = TRUE), read.FCS) > > as(frames, "flowSet") When reading from files it is almost always best to use read.flowSet, which automates much of this process. > > I'm not certain how to put my "/home/mdj/Rdata/" directory into the > context of the system.file function. Here is my best attempt: > > frames <= lapply("/home/mdj/data/Rdata/", readFCS) Your example differs from the example in the How To in two ways. First, the lapply() is actually performed on the directory listing. For example, lapply(dir("/home/mdj/data/Rdata",patt="\\.fcs$"),readFCS) is more likely to do what you want. The inclusion of a pattern ensures that only things with the "fcs" extension will be used. However, it mostly serves as an example by way of construction so you shouldn't need to use it unless you need to do something that read.flowSet cannot (like grab the FCS files from URLS or something). Also, you have <= instead of <-. <= is an inequality. Personally, I hate <- with a passion (b[b<-1] = 0. Whoops.) and thus tend to use just =, unless it is impossible for some reason (very rarely). > Error: object "frames" not found > > When I attempt "read.flowSet": > > > read.flowSet("/home/mdj/Rdata/") This is because the first parameter of read.flowSet is actually a pattern not a path (I know, the opposite of dir... but this is the way things go). This is because you're usually in the same directory as your FCS files. You actually want: read.flowSet(path="/home/mdj/Rdata/") or something similar. > These errors have me stumped. I think the organization of this library > is quite keen. I like the flowFrame object in what I think of as a > flowSet vector (with nice header). Would someone show me how to: > > 1) gate my data for the 'flowFrame' object and then plot the gated data? > 2) work my way through creating a flowSet object? I think my main > problem is that I am clumsy with the system.file syntax. > > My apologies if these questions are answered elsewhere. If this is the > case please point me in the right direction. > > Any and all help is appreciated. Thanks! > Hope that helps. > Matt > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Byron Ellis (byron.ellis at gmail.com) "Oook" -- The Librarian ADD COMMENT 0 Entering edit mode On 6/18/07, Byron Ellis <byron.ellis at="" gmail.com=""> wrote: > On 6/18/07, M. Jankowski <mjankowski at="" gmail.com=""> wrote: > > Hi all, > > > > > > As you can see, I have some pretty far outliers in all the data sets. > > What procedure would I follow to gate the data to less than 800 for > > "FSC.H" and "SSC.H"? Further, how would I plot the result of the gated > > data? In the context of the HowTo I would call my question "2.1.4: > > Gating and Plotting a flowFrame" > > Section 4 of the How To is entirely about filtering/gating with 4.3 > being the section relevant to your question. In your case you probably > want a rectangleGate of some sort. For example, > > Subset(x,rectangleGate("FSC.H"=c(0,800),"SSC.H"=c(0,800))) > > would cut your frame down to size. As for plotting, this is somewhat > more difficult. The flowViz package has some facilities for plotting a > gate onto a plot of the data, but you'd have to ask Deepayan about > that---I've never actually used it. Yes, flowViz does have some utilities for gates, but they didn't make it to BioC 2.0. You can get the development version from http://bioconductor.org/packages/2.1/bioc/html/flowViz.html (which also has a vignette), and it should work with 2.0 if you are lucky. It may not work with the current devel version of flowCore though. -Deepayan ADD REPLY 0 Entering edit mode Actually it probably works in devel as well, I haven't committed the big changeset yet---sidetracked by paper deadlines and WWDC. On 6/18/07, Deepayan Sarkar <deepayan.sarkar at="" gmail.com=""> wrote: > On 6/18/07, Byron Ellis <byron.ellis at="" gmail.com=""> wrote: > > On 6/18/07, M. Jankowski <mjankowski at="" gmail.com=""> wrote: > > > Hi all, > > > > > > > > > As you can see, I have some pretty far outliers in all the data sets. > > > What procedure would I follow to gate the data to less than 800 for > > > "FSC.H" and "SSC.H"? Further, how would I plot the result of the gated > > > data? In the context of the HowTo I would call my question "2.1.4: > > > Gating and Plotting a flowFrame" > > > > Section 4 of the How To is entirely about filtering/gating with 4.3 > > being the section relevant to your question. In your case you probably > > want a rectangleGate of some sort. For example, > > > > Subset(x,rectangleGate("FSC.H"=c(0,800),"SSC.H"=c(0,800))) > > > > would cut your frame down to size. As for plotting, this is somewhat > > more difficult. The flowViz package has some facilities for plotting a > > gate onto a plot of the data, but you'd have to ask Deepayan about > > that---I've never actually used it. > > Yes, flowViz does have some utilities for gates, but they didn't make > it to BioC 2.0. You can get the development version from > > http://bioconductor.org/packages/2.1/bioc/html/flowViz.html > > (which also has a vignette), and it should work with 2.0 if you are > lucky. It may not work with the current devel version of flowCore > though. > > > -Deepayan > -- Byron Ellis (byron.ellis at gmail.com) "Oook" -- The Librarian ADD REPLY 0 Entering edit mode Byron, This got me back on track! Thank you! Matt On 6/18/07, Byron Ellis <byron.ellis at="" gmail.com=""> wrote: > On 6/18/07, M. Jankowski <mjankowski at="" gmail.com=""> wrote: > > Hi all, > > > > > > As you can see, I have some pretty far outliers in all the data sets. > > What procedure would I follow to gate the data to less than 800 for > > "FSC.H" and "SSC.H"? Further, how would I plot the result of the gated > > data? In the context of the HowTo I would call my question "2.1.4: > > Gating and Plotting a flowFrame" > > Section 4 of the How To is entirely about filtering/gating with 4.3 > being the section relevant to your question. In your case you probably > want a rectangleGate of some sort. For example, > > Subset(x,rectangleGate("FSC.H"=c(0,800),"SSC.H"=c(0,800))) > > would cut your frame down to size. As for plotting, this is somewhat > more difficult. The flowViz package has some facilities for plotting a > gate onto a plot of the data, but you'd have to ask Deepayan about > that---I've never actually used it. > > > > > The flowSet discussion in the HowTo does cover filtering and gating. > > When I attempt to read my file in as a flowset I get errors. > > > > Section 2.2.1 give the instruction: > > > frames <- lapply(dir(system.file("extdata", "compdata", "data", > > + package = "flowCore"), full.names = TRUE), read.FCS) > > > as(frames, "flowSet") > > When reading from files it is almost always best to use read.flowSet, > which automates much of this process. > > > > > I'm not certain how to put my "/home/mdj/Rdata/" directory into the > > context of the system.file function. Here is my best attempt: > > > frames <= lapply("/home/mdj/data/Rdata/", readFCS) > > Your example differs from the example in the How To in two ways. > First, the lapply() is actually performed on the directory listing. > For example, > > lapply(dir("/home/mdj/data/Rdata",patt="\\.fcs$"),readFCS) > > is more likely to do what you want. The inclusion of a pattern ensures > that only things with the "fcs" extension will be used. However, it > mostly serves as an example by way of construction so you shouldn't > need to use it unless you need to do something that read.flowSet > cannot (like grab the FCS files from URLS or something). > > Also, you have <= instead of <-. <= is an inequality. Personally, I > hate <- with a passion (b[b<-1] = 0. Whoops.) and thus tend to use > just =, unless it is impossible for some reason (very rarely). > > > Error: object "frames" not found > > > > When I attempt "read.flowSet": > > > > > read.flowSet("/home/mdj/Rdata/") > > This is because the first parameter of read.flowSet is actually a > pattern not a path (I know, the opposite of dir... but this is the way > things go). This is because you're usually in the same directory as > your FCS files. You actually want: > > read.flowSet(path="/home/mdj/Rdata/") > > or something similar. > > > These errors have me stumped. I think the organization of this library > > is quite keen. I like the flowFrame object in what I think of as a > > flowSet vector (with nice header). Would someone show me how to: > > > > 1) gate my data for the 'flowFrame' object and then plot the gated data? > > > 2) work my way through creating a flowSet object? I think my main > > problem is that I am clumsy with the system.file syntax. > > > > My apologies if these questions are answered elsewhere. If this is the > > case please point me in the right direction. > > > > Any and all help is appreciated. Thanks! > > > > Hope that helps. > > > Matt > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor at stat.math.ethz.ch > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > > -- > Byron Ellis (byron.ellis at gmail.com) > "Oook" -- The Librarian >