http://bioinformatics.ca//files/public/Flow_2013_Module2.mp4
It goes through some of the key concepts to analyse flow cytometry data in R.
These include:
- vectors
- binding two vectors into a matrix
- lists
- mylist <- list(“first” = x, “second” = y)
- x and y are vectors that were defined earlier.
- Thus the list here contains vectors.
- INTERESTING AND IMPORTANT
- defining within a list uses double square brackets:
- mylist[[1]]
- can call a part of a list by it’s name!
- mylist[[“first”]]
- access by name rather than by index number can be very useful if multiple names are the same or if index numbers change.
- length(mylist)
- subsetting by index or name.
- Fundamental to R
- variables
- functions
- syntax of commands
- round brackets for functions; square brackets for subsetting
- data structures
- nest functions within functions - innermost brackets first.
- Google the error messages!
- warning messages rather than errors
Comment: I did this with Jo a little bit and made some notes but I don’t know where they are.
functions that are useful for subsetting for flow cytometry data:
- which - returns the index which adhere to the key concepts.
- intersect
- union
Visualising flow cytometry data
- plot(density(a))
Key package - flowCore - it's a Bioconductor Package
Installing flowCore:
> source("http://bioconductor.org/biocLite.R")
> source("http://bioconductor.org/biocLite.R")
> biocLite("flowCore")
When we import an FCS file into R using read.FCS, it creates a special kind of object called a flowFrame. This seems to act like a kind of data frame with lots of metadata and the like.
The data from this flowFrame can be converted into a matrix which can be useful.
Another key package - flowViz
Installing flowViz:
> biocLite("flowViz")
this allows plotting of data but is quite slow!
Using "@" symbol to explore an object.
I am having some problems with flowVis. It's giving an "Error: subset out of bounds" message.
If I extract the data then I can plot the data nicely:
E <- exprs(data)
plot(E[,1], E[,2],
pch = ".",
ylim=c(0,1000000),
xlab="FSC-A",
ylab="SSC-A",
main="Forward Scatter vs Side Scatter") # this works
This gives a graph like this:
IT'S SLOW BUT IT IS PROGRESS...
No comments:
Post a Comment