# # # R代码从装饰图案的flowType来源。Rnw“# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块1号:loadlib # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(flowType)数据(DLBCLExample) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块2号:PropMarkers # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # PropMarkers < - 3:5 MFIMarkers < - PropMarkers MarkerNames < - c (‘f’,‘学生’,‘CD3’,‘CD5’,‘CD19’) Res <——flowType (DLBCLExample、PropMarkers MFIMarkers, kmeans, MarkerNames);# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块3号:SingleDPartitions # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #地块(Res, DLBCLExample);# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块数量4:PlotPop # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #地块(Res,“CD3 + CD5-CD19 +帧= DLBCLExample);# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块5号:BarPlot # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #小额信贷机构= Res@MFIs;比例= Res@CellFreqs;比例< -比例/ max(比例)的名字(比例)<——unlist(拉普兰人(Res@PhenoCodes,函数(x){返回(decodePhenotype (x, Res@MarkerNames PropMarkers, Res@PartitionsPerMarker))})) rownames(小额信贷机构)=(比例)指数=名字顺序(比例,减少= TRUE) [1:20] bp = barplot(比例(指数),轴= FALSE, names.arg = FALSE)文本(bp + 0.2,票面价值(“usr”) [3] + 0.02, srt = 90, adj = 0,标签=名字(比例(指数)),xpd = TRUE cex = 0.8)轴(2);轴(1 = bp,标签= FALSE);标题(xlab =表型的名字,ylab =细胞比例)# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块6号:calcNumPops # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # calcNumPops(代表(34),10)# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块7号:calcNumPopsFig # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #情节(log10(酸式焦磷酸钠(1:10,函数(x) {calcNumPops(代表(34),x)})), ylab =“细胞(log10)”, xlab =“截止”)# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块8号:loadmetadata # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(flowType)数据(HIVMetaData) HIVMetaData <——HIVMetaData[这(HIVMetaData(, '管']= = 2),);# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块9号:readlabels # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #标签= (HIVMetaData [2] = = +) + 1; ################################################### ### code chunk number 10: loadrawdata ################################################### library(sfsmisc); library(flowCore); data(HIVData) PropMarkers <- 5:10 MFIMarkers <- PropMarkers MarkerNames <- c('Time', 'FSC-A','FSC-H','SSC-A','IgG','CD38','CD19','CD3', 'CD27','CD20', 'NA', 'NA') ResList <- fsApply(HIVData, 'flowType', PropMarkers, MFIMarkers, 'kmeans', MarkerNames); ################################################### ### code chunk number 11: CalcProps ################################################### All.Proportions <- matrix(0,3^length(PropMarkers),length(HIVMetaData[,1])) rownames(All.Proportions) <- unlist(lapply(ResList[[1]]@PhenoCodes, function(x){return(decodePhenotype( x,ResList[[1]]@MarkerNames[PropMarkers], ResList[[1]]@PartitionsPerMarker))})) for (i in 1:length(ResList)){ All.Proportions[,i] = ResList[[i]]@CellFreqs / ResList[[i]]@CellFreqs[ which(rownames(All.Proportions)=='')] } ################################################### ### code chunk number 12: All.Proportions ################################################### Pvals <- vector(); EffectSize <- vector(); for (i in 1:dim(All.Proportions)[1]){ if (length(which(All.Proportions[i,]!=1))==0){ Pvals[i]=1; EffectSize[i]=0; next; } temp=t.test(All.Proportions[i, Labels==1], All.Proportions[i, Labels==2]) Pvals[i] <- temp$p.value EffectSize[i] <- abs(temp$statistic) } Selected <- which(Pvals<0.05); print(length(Selected)) ################################################### ### code chunk number 13: xtabout ################################################### Selected <- which(p.adjust(Pvals)<0.05); library(xtable) MyTable=cbind(rownames(All.Proportions)[Selected], format(Pvals[Selected], digits=2), format(p.adjust(Pvals)[Selected],digits=3), format(rowMeans(All.Proportions[Selected,]), digits=3)) colnames(MyTable)=c('Phenotype', 'p-value', 'adjusted p-value', 'cell frequency') print(xtable(MyTable, caption='The selected phenotypes, their p-values, adjusted p-values, and cell frequencies'), include.rownames=TRUE, caption.placement = "top");