# #——需求,回声= FALSE -------------------------------------------- 如果(!需要(flowWorkspaceData)){停止(“不能没有“flowWorkspaceData构建小插曲 '") } ## ---- 设置,包括= FALSE ------------------------------------------------ 库(knitr) opts_chunk美元集(out.extra = '风格= "显示:块;保证金:汽车“fig.align =“中心”,消息= FALSE,警告= FALSE) # #——load-flowWorkspace回声= F ------------------------------------------ 库(flowWorkspace) # #——加载xml, eval = TRUE ------------------------------------------------- flowDataPath < -系统。file("extdata", package = "flowWorkspaceData") wsfile <- list. file("extdata", package = "flowWorkspaceData")文件(flowDataPath模式=“manual.xml”,全= TRUE) wsfile # #——openWorkspace eval = F ----------------------------------------------- # ws < - openWorkspace (wsfile) # #——parseWorkspace eval = F ---------------------------------------------- # gs < - parseWorkspace (ws name =“t细胞”,子集= 1,isNcdf = TRUE) # #——load_gs_manual,回声= FALSE ---------------------------------------- gs < - load_gs (file.path (gs_manual flowDataPath。 ")) ## ---- plot-manual-GatingHierarchy ----------------------------------------- gh < - gs[[1]]阴谋(gh) # #——plot-manual-gates fig.width = 9 ------------------------------------ plotGate (gh) # #——gatingTemplate eval = T -------------------------------------------- 库(openCyto)库(data.table) gtFile < -执行(“extdata / gating_template / tcell.csv”,包= " openCyto”)dtTemplate < -从文件中读(gtFile,自动启动= 1升)dtTemplate # #——gatingTemplate-nonDebris eval = T ---------------------------------- dtTemplate [1 ,] ## ---- gatingTemplate-singlets eval = T ----------------------------------- dtTemplate [2 ,] ## ---- gatingTemplate-lympth eval = T ------------------------------------- dtTemplate [3 ,] ## ---- gatingTemplate-cd3 eval = T ---------------------------------------- dtTemplate [4 ,] ## ---- gatingTemplate-cd4cd8,eval = T ------------------------------------- dtTemplate [5 ,] ## ---- gatingTemplate-expand,回声= F,结果= F ------------------------ 扩大< - openCyto::: .preprocess_csv (dtTemplate) rownames(扩大)<——零# #——gatingTemplate-expand1回声= F ------------------------------------ 扩大[5:6 ,] ## ---- gatingTemplate-expand2回声= F ------------------------------------ 扩大[7:10 ,] ## ---- load-gt,eval = T --------------------------------------------------- gt_tcell < - gatingTemplate (gtFile,自动启动= 1升)gt_tcell # #——plot-gt eval = T --------------------------------------------------- 情节(gt_tcell) # #——load-fcs ------------------------------------------------------------ fcsFiles < -列表。文件(模式= " CytoTrol ", flowDataPath全= TRUE) ncfs < - read.ncdfFlowSet (fcsFiles) fr < - ncfs [[1]] gs < - GatingSet (ncfs) gs # #——补偿 ---------------------------------------------------------- compMat < - getCompensationMatrices (gh) gs < -补偿(gs、compMat) # #——compensate_plot呼应= F, fig.width = 4, fig.height = 4 ------------ 库(ggcyto) sub_chnl < - c(“V545-A”、“V450-A”)fr < - fr (sub_chnl] fr_comp < - getData (gs [[1]]) [, sub_chnl] fs <——(列表(fr = fr,fr_comp = fr_comp), "flowSet") #变换数据以更好地可视化补偿效果fs <- transform(fs, estimateLogicle(fr,sub_chnl)) autoplot(fs, "V545", "V450") ## ----变换,eval = T-------------------------------------------- chnls <- parameters(compMat) trans <- estimateLogicle(gs[[1]], channels = chnls) gs <- transform(gs, trans) ## ----transformation_plot, echo = F, fig.width = 5,fig.height = 5——fr_trans < - getData (gs [[1]]) [, sub_chnl [1]] fr_comp < - fr_comp [, sub_chnl [1]] fs <——(列表(fr = fr_comp fr_trans = fr_trans),“flowSet”)p1 < -。ggplot(autoplot(fs[1], "V545")) p2 <- as。ggplot(autoplot(fs[2], "V545")) plot(gridExtra::arrangeGrob(p1,p2)) ## ----gating, eval = TRUE------------------------------------------------- gating(gt_tcell, gs) ## ----gating_par, eval = FALSE-------------------------------------------- # gating(gt_tcell, gs, mc.cores=2, parallel_type = "multicore") ## ----plot_afterGating---------------------------------------------------- plot(gs[[1]]) ## ----hideGate, results = "hide"------------------------------------------ dodesToHide <- c("cd8+", "cd4+" , "cd4-cd8-", "cd4+cd8+" , "cd4+cd8-/HLA+", "cd4+cd8-/CD38+" , "cd4-cd8+/HLA+", "cd4-cd8+/CD38+" , "CD45_neg/CCR7_gate", "cd4+cd8-/CD45_neg" , "cd4-cd8+/CCR7+", "cd4-cd8+/CD45RA+" ) lapply(dodesToHide, function(thisNode)setNode(gs, thisNode, FALSE)) ## ----rename, results = "hide"-------------------------------------------- setNode(gs, "cd4+cd8-", "cd4") setNode(gs, "cd4-cd8+", "cd8") ## ----plot_afterHiding---------------------------------------------------- plot(gs[[1]]) ## ----plotGate_autoGate, fig.width = 9------------------------------------ plotGate(gs[[1]])