GBM subclasses
source("https://bioconductor.org/biocLite.R")
## Bioconductor version 3.4 (BiocInstaller 1.24.0), ?biocLite for help
## A new version of Bioconductor is available after installing the most
## recent version of R; see http://bioconductor.org/install
biocLite('ConsensusClusterPlus')
## BioC_mirror: https://bioconductor.org
## Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.1 (2016-06-21).
## Installing package(s) 'ConsensusClusterPlus'
## package 'ConsensusClusterPlus' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\USER\AppData\Local\Temp\Rtmp0gBEmu\downloaded_packages
## installation path not writeable, unable to update packages: boot, cluster,
## codetools, foreign, lattice, MASS, Matrix, mgcv, nlme, rpart, survival
## Old packages: 'curl', 'data.table', 'dplyr', 'Rcpp'
d<-read.csv('GBM.csv')
rownames(d)<-d[,1]
d<-d[2:174]
m<-as.matrix(d)
View(m)
#install.packages('gplots')
library(gplots)
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
#h<-heatmap.2(m,trace='none',hclust=function(x) hclust(x,method='average'), distfun=function(x) as.dist((1-cor(t(x)))/2))
#h$colInd
#image(t(m))
library(ConsensusClusterPlus)
results<-ConsensusClusterPlus(m,maxK=5,pItem=0.8,clusterAlg = 'hc',distance='pearson')
## end fraction
## clustered

## clustered

## clustered

## clustered





#results[[2]][["consensusTree"]]
#results[[4]][["consensusClass"]]
cols=results[[4]][["consensusClass"]]
m=m[,order(cols)]
cols=cols[order(cols)]
cols[cols==1]='purple'
cols[cols==2]='cyan'
cols[cols==3]='blue'
cols[cols==4]='red'
#cols
#heatmap.2(m,trace='none',hclust=function(x) hclust(x,method='average'), distfun=function(x) as.dist((1-cor(t(x)))/2), ColSideColors=cols,Colv=F)
#col=rev(redgreen(512))
#heatmap.2(m,trace='none',hclust=function(x) hclust(x,method='average'), distfun=function(x) as.dist((1-cor(t(x)))/2), ColSideColors=cols,Colv=F,col=col,scale='row')
#add color contrast using sigmoid function
x<-seq(1,512,.5)
#plot(x,1/(1+exp(-(x-255.5)/50))*511)
col=rev(redgreen(512))
col=col[floor(1/(1+exp(-(x-255.5)/70))*511)]
heatmap.2(m,trace='none',hclust=function(x) hclust(x,method='average'), distfun=function(x) as.dist((1-cor(t(x)))/2), ColSideColors=cols,Colv=F,col=col,scale='row')
## Warning in heatmap.2(m, trace = "none", hclust = function(x) hclust(x,
## method = "average"), : Discrepancy: Colv is FALSE, while dendrogram is
## `both'. Omitting column dendogram.
