# # # R代码从装饰图案的gettingPbcmcData来源。Rnw的utf - 8编码:# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块1号:gettingData # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(limma);图书馆(pbcmc);#数据集包含在BioConductor库库名< - c(“美因茨”,“nki”,“transbig”,“螺母”、“扶贫”,“vdx”);#加载它们吧!pbcmcData < -拉普(库名、功能(actLibName){打印(actLibName);# pbcmc包提供了一种简单的方法来下载和分类actLib <——loadBCDataset(类= PAM50库名= actLibName verbose = FALSE);actLibFilt < -滤液(actLib verbose = FALSE);actLibFilt < -分类(actLibFilt std =“没有”,verbose = FALSE);actSubtypes < -分类(actLibFilt)美元亚型; # get the expression matrix and the annotation actExprs <- exprs(actLib); actAnnot <- annotation(actLib); # we recommend working allways with Entrez IDs, let's match them with # expression matrix rownames (and modify them) if (all(actAnnot$probe == rownames(actExprs))) { actExprs <- actExprs[!is.na(actAnnot$EntrezGene.ID),]; actAnnot <- actAnnot[!is.na(actAnnot$EntrezGene.ID),]; rownames(actExprs) <- as.character(actAnnot$EntrezGene.ID); } else { matchedEntrez <- match(rownames(actExprs), actAnnot$probe); # all(rownames(actExprs) %in% actAnnot$probe == !is.na(matchedEntrez)); stopifnot(all( actAnnot$probe[!is.na(matchedEntrez)] == rownames(actExprs)[!is.na(matchedEntrez)])); actExprs <- actExprs[!is.na(matchedEntrez),]; actAnnot <- actAnnot[!is.na(matchedEntrez),]; stopifnot(all(actAnnot$probe == rownames(actExprs))); actExprs <- actExprs[!is.na(actAnnot$EntrezGene.ID),]; actAnnot <- actAnnot[!is.na(actAnnot$EntrezGene.ID),]; rownames(actExprs) <- as.character(actAnnot$EntrezGene.ID); } # average repeated genes expression actExprs <- avereps(actExprs); stopifnot(all(colnames(actExprs) == names(actSubtypes))); # filtrate only these two conditions actExprs <- actExprs[, actSubtypes %in% c("Basal", "LumA")]; actSubtypes <- as.character( actSubtypes[actSubtypes %in% c("Basal", "LumA")]); return(list(geneExpr=actExprs, subtypes=actSubtypes)); }) names(pbcmcData) <- libNames; ################################################### ### code chunk number 2: validateData ################################################### # save the just created pbcmcData to newPbcmcData newPbcmcData <- pbcmcData; library(MIGSAdata); # and load the MIGSAdata one. data(pbcmcData); all.equal(newPbcmcData, pbcmcData); ################################################### ### code chunk number 3: Session Info ################################################### sessionInfo()