# #——回声= FALSE,结果= "隐藏 "--------------------------------------- 库(knitr)库(RColorBrewer) opts_chunk美元集(消息= FALSE,错误= FALSE,警告= FALSE, fig.height = 5, fig.width = 7 ) ## ---- 呼应= FALSE,结果=“隐藏 "------------------------------------- 库(ggcyto)库(BioC2015OpenCyto) # (tbdata数据加载数据 ) ## ---- 回声= FALSE, eval = FALSE ------------------------------------------- # # 添加默认FlowJo转换自原不是复制,将采样。# flucence_channels <- as.vector(parameters(getCompensationMatrices(tbdata[[1]])))) # #在所有通道上创建默认的FlowJo转换。# transList <- transformList(fluorescence_channels, flowJoTrans())) # #将转换添加到数据集# flowWorkspace:::。addTrans (tbdata@pointer transList ) ## ------------------------------------------------------------------------ # 子集的数据可视化的一个演示。ptids < -独特(pData (tbdata)[[“PID”]])[1:2]tbdata < -子集(tbdata,“PID”% % ptids) Rm (CD4, tbdata ) ## ------------------------------------------------------------------------ # 提取CD3人口fs < getData (CD3 tbdata。 ") ## ------------------------------------------------------------------------ p < ggcyto (fs,aes (x = CD4)) p1 < - p + geom_histogram(垃圾箱= 60)p1 ## ------------------------------------------------------------------------ myPars < - ggcyto_par_set(限制=“仪器”)p1 + myPars # # = '标记——结果 '---------------------------------------------------- # 打印默认设置ggcyto_par_default () # #------------------------------------------------------------------------ p = p + geom_density () + geom_density(填补=“黑色”)+ myPars p = ' asis # #——结果 '------------------------------------------------------ kable (pData (fs )) ## ------------------------------------------------------------------------ # 改变方面(默认facet_wrap(~名字))p + facet_grid (known_response ~肽 ) ## ------------------------------------------------------------------------ # 2 d hexbin p < ggcyto (fs, aes (x = CD4,y = CD8) + geom_hex(垃圾箱= 60)+ ylim (c(-100年4 e3)) + xlim (c(-100年3 e3)) p ## ------------------------------------------------------------------------ p + scale_fill_gradientn(颜色= brewer.pal (n = 8, name = " PiYG "),反式= "√6 ") ## ------------------------------------------------------------------------ p + scale_fill_gradient (trans =“√”, low = "gray", high = "black") ## ------------------------------------------------------------------------ ggcyto(fs, aes(x = CD4, y = CD8))+ geom_hex(bins = 60)+geom_density2d(colour = "black")+ylim(c(-100,4e3)) + xlim(c(-100,3e3)) ## ------------------------------------------------------------------------ # add geom_gate layer p <- ggcyto(fs, aes(x = CD4, y = CD8)) + geom_hex(bins = 60) + ylim(c(-100,4e3)) + xlim(c(-100,3e3)) g <- getGate(tbdata, "CD4+") p <- p + geom_gate(g) p ## ------------------------------------------------------------------------ # add geom_stats p + geom_stats() ## ---- echo=FALSE--------------------------------------------------------- ### transform data (somehow it is not working) # #transform data back to raw scale # inverse.trans <- getTransformations(gs[[1]], inverse = T)[[" APC Cy7-A"]] ### There is an issue in transform method for ncdfFlowSet that ## new cdf file created at the same folder as original cdf which could be probmatic for gs folder # fs_raw <- transform(as(fs, "flowSet"), transformList(" # p1 <- ggcyto(fs_raw, fs_raw, ggcyto);aes (x = CD4)) + geom_area(统计=“密度”)# p1 + myPars # # #显示数据在对数尺度# p1 + scale_x_flowJo_biexp () ## ------------------------------------------------------------------------ # 使用自定义范围覆盖默认的数据限制myPars < - ggcyto_par_set(限制=列表(y = c(-100年4 e3), x = c(-100年3 e3))) p < ggcyto (tbdata,aes(x = CD4, y = CD8),子集= CD3) p < - p + geom_hex(箱= 64)+ myPars p ## ------------------------------------------------------------------------ # 只显示标记在轴p < - p + labs_cyto p(“标记”) ## ------------------------------------------------------------------------ # 添加门p + geom_gate (CD4 + CD8 -) # #------------------------------------------------------------------------ # 添加两个盖茨p < - p + geom_gate (c(“CD4 + CD8 -”,“CD4-CD8——”))p ## ------------------------------------------------------------------------ p + geom_stats () ## ------------------------------------------------------------------------ # p +添加数据只是为了一个特定的大门geom_stats CD4 + CD8(“ -") ## ------------------------------------------------------------------------ # 改变数据类型、背景颜色和位置p + geom_stats(“CD4 + CD8 - type =“计数”,大小= 6,颜色=“白色”,填补=“黑人”,调整= 0.3 ) ## ------------------------------------------------------------------------ #' 子集”查找p < ggcyto (tbdata, aes (x = CD4, y = CD8)) + geom_hex(箱= 64)+ myPars + geom_gate (c(“CD4 + CD8 -”,“CD4-CD8——”)p ## ------------------------------------------------------------------------ Rm(“CD8 +”,tbdata) Rm (CD4 +, tbdata) p < ggcyto (tbdata, aes (x = CD4, y = CD8),= CD3) + geom_hex子集(箱= 64)+ geom_gate () + geom_stats () + myPars p ## ------------------------------------------------------------------------ p + axis_x_inverse_trans () + axis_y_inverse_trans () ## ------------------------------------------------------------------------ 类(p)类(p $ data)