##################################################
### Load gene expression data for the training set
data(trainingData)
### Show group variable for the TRAINING set
table(trainingGroup)
##################################################
### Train a classifier using default filtering function based on the Wilcoxon test
classifier <- SWAP.KTSP.Train(matTraining, trainingGroup,
FilterFunc = NULL, krange=8)
### Show the TSP in the classifier
classifier$TSPs
##################################################
### Compute the TSP votes and combine them using various methods
### Here we will use the count of the signed TSP votes
ktspStatDefault <- SWAP.KTSP.Statistics(inputMat = matTraining,
classifier = classifier)
### Here we will use the sum of the TSP votes
ktspStatSum <- SWAP.KTSP.Statistics(inputMat = matTraining,
classifier = classifier, CombineFunc=sum)
### Here, for instance, we will apply a hard treshold equal to 2
ktspStatThreshold <- SWAP.KTSP.Statistics(inputMat = matTraining,
classifier = classifier, CombineFunc = function(x) sum(x) > 2 )
### Show components
names(ktspStatDefault)
### Show some of the votes
head(ktspStatDefault$comparisons[ , 1:2])
### Show default statistics
head(ktspStatDefault$statistics)
### Show statistics obtained using the sum
head(ktspStatSum$statistics)
### Show statistics obtained using the hard threshold
head(ktspStatThreshold)
### Make a heatmap showing the individual TSPs votes
colorForRows <- as.character(1+as.numeric(trainingGroup))
heatmap(1*ktspStatDefault$comparisons, scale="none",
margins = c(10, 5), cexCol=0.5, cexRow=0.5,
labRow=trainingGroup, RowSideColors=colorForRows)
Run the code above in your browser using DataLab