# #——回声= 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("
“,enverse.trans),cdffile =)#p1 < - ggcyto(fs_raw,aes(x = cd4))+ geom_area(stat =”密度“)#p1 + mypars ###日志刻度中的显示数据#p1 + scale_x_flowjo_biexp()## --------------------------------------------------------------------------------- #use customized range to overwrite the default data limits myPars <- ggcyto_par_set(limits = list(y = c(-100,4e3), x = c(-100,3e3))) p <- ggcyto(tbdata, aes(x = CD4, y = CD8), subset = "CD3") p <- p + geom_hex(bins = 64) + myPars p ## ------------------------------------------------------------------------ #only display marker on axis p <- p + labs_cyto("marker") p ## ------------------------------------------------------------------------ # add gate p + geom_gate("CD4+CD8-") ## ------------------------------------------------------------------------ # add two gates p <- p + geom_gate(c("CD4+CD8-","CD4-CD8-")) p ## ------------------------------------------------------------------------ p + geom_stats() ## ------------------------------------------------------------------------ # add stats just for one specific gate p + geom_stats("CD4+CD8-") ## ------------------------------------------------------------------------ # change stats type, background color and position p + geom_stats("CD4+CD8-", type = "count", size = 6, color = "white", fill = "black", adjust = 0.3) ## ------------------------------------------------------------------------ #'subset' is ommitted p <- ggcyto(tbdata, aes(x = CD4, y = CD8)) + geom_hex(bins = 64) + myPars + geom_gate(c("CD4+CD8-", "CD4-CD8-")) p ## ------------------------------------------------------------------------ Rm("CD8+",tbdata) Rm("CD4+",tbdata) p <- ggcyto(tbdata, aes(x = CD4, y = CD8), subset = "CD3") + geom_hex(bins = 64) + geom_gate() + geom_stats() + myPars p ## ------------------------------------------------------------------------ p + axis_x_inverse_trans() + axis_y_inverse_trans() ## ------------------------------------------------------------------------ class(p) class(p$data)