フローサイトメトリー(FCM)ã¨ããå®é¨ããããããã¯ãç´°è表é¢ã«æåãããã®ãæä½åå¿ã§æ¨èãã¦ãæ¨èãããç´°èã«å
ãå½ã¦ã¦æä½åå¿ãèµ·ãã¦ããããã¤ã¾ããã®æåãåå¨ããããèå¥ããå®é¨ã§ããã
å®é¨æ©å¨ã許ãéããæåæ¨èã¯å¯è½ã§ãããã¦ã2ã3ã®æä½ãå¤ãã¦ä½åã§ããã¨ãã§ããªãã¨ãã
æ£å¸¸ãªç´°èã§ãç½è¡ç
ãªã©ã®ç°å¸¸ãªç´°èã§ãããã種ã®æåãã¿ã¼ã³ããã£ã¦ããããã®çµã¿åããã§çè«çã«ã¯ç´°èãåé¢ã§ããã
flowCoreããã±ã¼ã¸ã§FCMãã¼ã¿ãæ±ã£ã¦ã¿ãã
# Required once per R installation source("http://bioconductor.org/biocLite.R") biocLite("flowCore")
library(flowCore) file.name <- system.file("extdata","0877408774.B08", package="flowCore") x <- read.FCS(file.name, transformation=FALSE) # å®éãã¼ã¿ã®é¨åã ãå¥ã«åã£ã¦ãããæç³»åãæãã¦ããã dd <- x@exprs[, grep("-", colnames(x@exprs))] time0 <- x@exprs[, "Time"]
ãµã³ãã«ãã¡ã¤ã«ãèªã¿è¾¼ãã§ã¿ãã¨ã7ã¤ã®æä½ã§æ¨èããã50 sec ã»ã©ã®ãã¼ã¿ã§ãããã¨ãåããã
x
flowFrame object '0877408774.B08' with 10000 cells and 8 observables: name desc range minRange maxRange $P1 FSC-H FSC-H 1024 0 1023 $P2 SSC-H SSC-H 1024 0 1023 $P3 FL1-H 1024 0 1023 $P4 FL2-H 1024 0 1023 $P5 FL3-H 1024 0 1023 $P6 FL1-A <NA> 1024 0 1023 $P7 FL4-H 1024 0 1023 $P8 Time Time (51.20 sec.) 1024 0 1023 147 keywords are stored in the 'description' slot
å®é¨ãã¼ã¿ã¯1ç´°èå½ããã7ã¤ã®æä½ããããã®å éã®å®æ°ãã¼ã¿ãæã¤ã
head(x@exprs)
FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A FL4-H Time [1,] 382 77 618 0 225 55 286 1 [2,] 628 280 245 431 259 0 371 1 [3,] 1023 735 699 448 215 143 638 1 [4,] 373 128 202 354 94 0 149 1 [5,] 1023 1023 618 742 408 61 866 1 [6,] 489 292 179 374 154 0 363 1
ã¨ããããかっこよく散布図ãæãããªãã¨ãªãã¯ã©ã¹ã¿ã¼ã£ã½ãã®ãããã
library(GGally) colnames(dd) <- gsub("-", "_", colnames(dd)) # - ãå ¥ã£ã¦ããã¨ãªããã¨ã©ã¼ ggpairs(dd, upper = list(continuous = "density", combo = "box"), lower = list(continuous = "points", combo = "dot"), params=c(cex=0.3, col=memb), )
ããæåãããããªããã¯ãgating ã¨ããé¾å¤ã決ãã¦ãã®å¤ãè¶
ãããã®ã¯ããã«æ¬¡ã®gatingãæºãããã®ã¯ä»¥ä¸ç¥ã¨ããããã«ãã¦çµã£ã¦ããã
ããã§multiple experienceãèªã¿è¾¼ãã§gatingãã¦ã¿ãã
# loading 5 experiment together into an object fs fs <- read.flowSet(path=system.file("extdata", "compdata", "data", package="flowCore"), name.keyword="SAMPLE ID", phenoData = list(name="SAMPLE ID", Filename="$FIL")) pData(phenoData(fs)) # meta data for 5 samples summary(fs) x1 <- fs[[1]] # same structure as x above
Gatingãè¡ãã
plot(x1@exprs[, c("FL1-H", "FL2-H")], cex=0.5) # ã©ãã«åç´ã»æ°´å¹³ã®ï¼ç´ç·ãå¼ãããï¼ How do you draw vertical and holizontal lines? abline(v=c(0, 12), h=c(0, 12), lty=2, col=2, lwd=3) # æ å ã«å ¥ã£ãå²åã¯? Fractio within the gated rectangle? rectGate <- rectangleGate(filterId="Fluorescence Region", "FL1-H"=c(0, 12), "FL2-H"=c(0, 12)) result <- filter(x1, rectGate) summary(result)
Fluorescence Region+: 9811 of 10000 events (98.11%)
98%ãå³ä¸ã«gatingããã¦ããããã®åºåãæ¹ã§æ¬å½ã«ãããã¨æã£ããããããã¯ã©ã¹ã¿ãªã³ã°ãã¦ã¿ãã4ã¤ãããã«åãããããªã¨æã£ãã
dist.1.2 <- dist(x1@exprs[, c("FL1-H", "FL2-H")]) cl <- hclust(dist.1.2) plot(cl) memb <- cutree(cl, k = 4) # ã¯ã©ã¹ã¿ãªã³ã°ã®æèåã plot(x1@exprs[, c("FL1-H", "FL2-H")], col=memb, pch=16, cex=1)
ãã®æ¡ä»¶ã§gatingããã¨ãé½æ§ã®98%ã®ç´°èã¯ã©ã¹ã¿ã¼ã¨é°æ§ã®2%ã®ç´°èã¯ã©ã¹ã¿ã¼ãæ½åºãããã
# extracting a subset with the gate fs2 <- Subset(fs, rectGate)
fs[[1]]
flowFrame object 'NA' with 10000 cells and 7 observables: name desc range minRange maxRange $P1 FSC-H FSC-Height 1024 0 1023 $P2 SSC-H SSC-Height 1024 0 1023 $P3 FL1-H <NA> 1024 1 10000 $P4 FL2-H <NA> 1024 1 10000 $P5 FL3-H <NA> 1024 1 10000 $P6 FL1-A <NA> 1024 0 1023 $P7 FL4-H <NA> 1024 1 10000 141 keywords are stored in the 'description' slot
fs2[[1]]
flowFrame object 'NA' with 9811 cells and 7 observables: name desc range minRange maxRange $P1 FSC-H FSC-Height 1024 0 1023 $P2 SSC-H SSC-Height 1024 0 1023 $P3 FL1-H <NA> 1024 1 10000 $P4 FL2-H <NA> 1024 1 10000 $P5 FL3-H <NA> 1024 1 10000 $P6 FL1-A <NA> 1024 0 1023 $P7 FL4-H <NA> 1024 1 10000 141 keywords are stored in the 'description' slot
x1split <- split(x1, rectGate) show(x1split) # split into two subsets with the gate
$`Fluorescence Region+` flowFrame object 'NA (Fluorescence Region+)' with 9811 cells and 7 observables: name desc range minRange maxRange $P1 FSC-H FSC-Height 1024 0 1023 $P2 SSC-H SSC-Height 1024 0 1023 $P3 FL1-H <NA> 1024 1 10000 $P4 FL2-H <NA> 1024 1 10000 $P5 FL3-H <NA> 1024 1 10000 $P6 FL1-A <NA> 1024 0 1023 $P7 FL4-H <NA> 1024 1 10000 141 keywords are stored in the 'description' slot $`Fluorescence Region-` flowFrame object 'NA (Fluorescence Region-)' with 189 cells and 7 observables: name desc range minRange maxRange $P1 FSC-H FSC-Height 1024 0 1023 $P2 SSC-H SSC-Height 1024 0 1023 $P3 FL1-H <NA> 1024 1 10000 $P4 FL2-H <NA> 1024 1 10000 $P5 FL3-H <NA> 1024 1 10000 $P6 FL1-A <NA> 1024 0 1023 $P7 FL4-H <NA> 1024 1 10000 141 keywords are stored in the 'description' slot
kmeansæ³ã§ã¯ã©ã¹ã¿ã¼ããã®ãããããã
k0 <- kmeans(x1@exprs, 4) memb <- k0$cluster # ggpairs ã®è²ä»ãããã¾ããããªã plot(as.data.frame(x1@exprs), col=memb, cex=0.5)
ã
外れ値解析ãæ··ãã¦ããããããããªãã
library(Rlof) lof0 <- lof(dd, 20) # 95% tile ããå¤ãå¤ã¹ã³ã¢ã大ããç´°èã¯å¤ãå¤ã¨èããã plot(as.data.frame(dd), col=(lof0 > quantile(lof0, 0.95))+1, cex=0.2)