########
# Load libraries and training data
########
# Load an expressionSet:
library(leukemiasEset)
data(leukemiasEset)
# Select the train samples:
trainSamples<- c(1:10, 13:22, 25:34, 37:46, 49:58)
# summary(leukemiasEset$LeukemiaType[trainSamples])
########
# Training
########
# NOTE: Training the classifier takes a while...
# Choose ONE of the followings, or modify to suit your needs:
## Not run:
#
# # "Basic" execution: All default parameters
# leukemiasClassifier <- geNetClassifier(eset=leukemiasEset[,trainSamples],
# sampleLabels="LeukemiaType", plotsName="leukemiasClassifier")
#
# # All default parameters also estimatings the classiffier's Generalization Error:
# # ( by default: buildClassifier=TRUE, calculateNetwork=TRUE)
# # Takes longer time than the basic execution
# leukemiasClassifier <- geNetClassifier(eset=leukemiasEset[,trainSamples],
# sampleLabels="LeukemiaType", plotsName="leukemiasClassifier",
# estimateGError=TRUE)
#
# # Faster execution (few minutes - depending on the computer):
# # By skipping the calculation of the interactions (MI) betwen the genes,
# # and reducing the number of genes to explore when training the classifier
# # (100 by default), the execution time can be sightly reduced
# leukemiasClassifier <- geNetClassifier(eset=leukemiasEset[,trainSamples],
# sampleLabels="LeukemiaType", plotsName="leukemiasClassifier",
# skipInteractions= TRUE, maxGenesTrain=20)
#
# # To any of these examples, you can add/remove the argument geneLabels,
# # in order to show/remove the gene name in the rankings and plots:
# # The argument labelsOrder allows showing the classes in a specific order
# # i.e.: labelsOrder=c("ALL","CLL","AML",CML","NoL")
#
# save(leukemiasClassifier, file="leukemiasClassifier.RData") # Save execution result
# # For loading the saved object in the future...
# # (If it doesn't find it, use getwd() to make sure you are in the right directory)
# #load("leukemiasClassifier.RData")
#
#
# # To avoid having to train a classifier to continue learning to use the package,
# # you can load the package's pre-executed example:
# data(leukemiasClassifier)
# #This example classifier was trained with the following code:
# #leukemiasClassifier <- geNetClassifier(leukemiasEset[,trainSamples],
# # "LeukemiaType", plotsName="leukemiasClassifier", buildClassifier=TRUE,
# # estimateGError=TRUE, calculateNetwork=TRUE, geneLabels=geneSymbols)
#
# ########
# # Explore the returned object:
# ########
# names(leukemiasClassifier)
# # More details on the class' help file:
# ?GeNetClassifierReturn
#
# # Further options:
# # The trained classifier can be used to find the class of new samples:
# ?queryGeNetClassifier
#
# # The default plots can be modified and presonalized to fit the user needs:
# ?calculateGenesRanking
# ?plotNetwork
# ?plotDiscriminantPower
# ?plotExpressionProfiles
# ## End(Not run)
Run the code above in your browser using DataLab