################################################### ### chunk number 1: data ################################################### library(Biobase) library(ALL) data(ALL) ALL ################################################### ### chunk number 2: filter-mol-biol ################################################### fusion <- ALL$mol.biol %in% c("BCR/ABL", "NEG") ################################################### ### chunk number 3: filter-BT ################################################### btLevels <- levels(ALL$BT) btLevels isB <- ALL$BT %in% btLevels[1:5] ################################################### ### chunk number 4: filter-subset ################################################### ALLsubset <- ALL[ , fusion & isB] ################################################### ### chunk number 5: filter-mol-biol-correct ################################################### levels(ALLsubset$mol.biol) ALLsubset$mol.biol ## recode the factor ALLsubset$mol.biol <- factor(ALLsubset$mol.biol) ################################################### ### chunk number 6: filter-top ################################################### library(limma) modelMatrix <- model.matrix(~ALLsubset$mol.biol) fit <- lmFit(ALLsubset, modelMatrix) eFit <- eBayes(fit) topGenes <- topTable(eFit, coef=2, 500) ################################################### ### chunk number 7: filter-reduce-to-top ################################################### ALLsubset <- ALLsubset[as.numeric(rownames(topGenes)),] ################################################### ### chunk number 8: MLInterfaces ################################################### library(MLInterfaces) ################################################### ### chunk number 9: knn ################################################### knnResult <- MLearn("mol.biol", ALLsubset, "knn", 1:50) knnResult ################################################### ### chunk number 10: knn-confusion ################################################### confuMat(knnResult) ################################################### ### chunk number 11: xval ################################################### knnXval <- xval(ALLsubset, "mol.biol", knnB, xvalMethod="LOO") ################################################### ### chunk number 12: xval-table ################################################### table(given=ALLsubset$mol.biol,predicted=knnXval)