Loading...
Use
Create
Develop
FAQ
Troubleshooting
History: Profile_r_heatmaps_test
View page
Source of version: 4
(current)
Below you should see a heatmap produced if everything (Tiki, R, PluginR, and the required R packages) are successfuly instaled and configured. You can [tiki-editpage.php?page=HeatMaps Test|edit this page] to tweak some parameters by hand if you wish or needed. {RR(loadandsave="1", echo="1", svg="1", pdf="1")} ################################################################## ### Chunk 1: Installation of easyHeatMap package and dependencies ################################################################## ##### NOTE: # * You need a few packages: install the ones you are missing in the central server location for R packages. # * In this example we install them with this params: lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/" # but adapt the server paths or urls to your specific case # * Remember you can install packages: # * from the terminal with some command like: # R CMD INSTALL /home/foo/myPackage.tar.gz --library="/usr/lib/R/site-library" # * or from an R session with something like: # install.packages(pkgs="/home/foo/myPackage.tar.gz", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") cat("Cheacking dependencies:\n") if (is.na(match("gplots", installed.packages()))) { install.packages("gplots", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } else { cat(" Package gplots is already installed. OK.\n") } if (is.na(match("gtools", installed.packages()))) { install.packages("gtools", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } else { cat(" Package gtools is already installed. OK.\n") } if (is.na(match("gdata", installed.packages()))) { install.packages("gdata", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } else { cat(" Package gdata is already installed. OK.\n") } if (is.na(match("caTools", installed.packages()))) { install.packages("caTools", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } else { cat(" Package caTools is already installed. OK.\n") } if (is.na(match("easyHeatMap", installed.packages()))) { ##### Install the package "easyHeatMap" ### for the time being you can fetch it from: ### https://ueb.ir.vhebron.net/files/easyHeatMap_1.18.tar.gz ### or ### http://dl.dropbox.com/u/24830595/easyHeatMap_1.18.tar.gz cat("Attempting to download easyHeatMaps from http://ueb.ir.vhebron.net/files/easyHeatMap_1.18.tar.gz \n") download.file("http://ueb.ir.vhebron.net/files/easyHeatMap_1.18.tar.gz", "./easyHeatMap_1.18.tar.gz") cat("Attempting to install package easyHeatMaps \n") install.packages(pkgs="easyHeatMap_1.18.tar.gz") if (is.na(match("easyHeatMap", installed.packages()))) { cat(" Something must have gone wrong, since the package didn't get successfully installed for some reason") } else { cat(" Package easyHeatMaps successfully installed. \n You can now proceed to create some <a href=\"tiki-index.php?page=HeatMaps&cookietab=2\">HeatMaps</a>") } } else { cat(" Package easyHeatMap is already installed. OK.\n") cat("\n You can now proceed to create some <a href=\"tiki-index.php?page=HeatMaps&cookietab=2\">HeatMaps</a>\n") } ####################################################################################### ### Chunk 2: R commands to generate the required files server-side from BioConductor ### "expres.filtered.ALL.txt", "expres.selected.ALL.txt" and "colorsForColumns.txt" ############################################################################################# ##### A few packages are required from Bioconductor to produce HeatMaps with real data # source("http://www.bioconductor.org/biocLite.R") # biocLite("ALL", lib="/usr/lib/R/site-library") # biocLite("genefilter", lib="/usr/lib/R/site-library") # biocLite("hgu95av2.db", lib="/usr/lib/R/site-library") # require(ALL) # require(genefilter) # require(hgu95av2.db) # The ALL package contains a sample "ExpressionSet" with expression values form # 128 samples and 12625 genes # ("features =probesets, remembering there may be more than one probeset per gene") # The dataset contains five different genotypes # ALL1/AF4 BCR/ABL E2A/PBX1 NEG NUP-98 p15/p16 # 10 37 5 74 1 1 # The two example datasets keep only samples from the first and second groups # To use a small number of genes two standard 'filtering approaches' are tested # 1) Non specific filtering # Only most variables are kept. Their expressions are stored in file "expres.filtered.ALL.txt" # 2) Specific filtering # We retain genes according to a test comparison between two groups. # Their expressions are stored in file "expres.selected.ALL.txt" # # # 1- Selecting genes by non-specific filtering # # require(ALL) # data(ALL) # require(genefilter) # filtered095 <- nsFilter (ALL, var.cutoff=0.95) # filtered099 <- nsFilter (ALL, var.cutoff=0.99) # esetSel095<-filtered095$eset # esetSel099<-filtered099$eset # esetSel <- esetSel099 # esetSel<- esetSel[,pData(esetSel)$mol.bio %in% c("ALL1/AF4", "BCR/ABL")] # colnames(exprs(esetSel))<- paste("X", colnames(exprs(esetSel)), sep="") # write.exprs(esetSel, file="expres.filtered.ALL.txt") # # 2- Selecting genes by specific filtering # require ("ALL") # data("ALL") # eset <- ALL[, ALL$mol.biol %in% c("BCR/ABL", "ALL1/AF4")] # library("limma") # f <- factor(as.character(eset$mol.biol)) # design <- model.matrix(~f) # fit <- eBayes(lmFit(eset,design)) # selected05 <- p.adjust(fit$p.value[, 2]) <0.05 # selected01 <- p.adjust(fit$p.value[, 2]) <0.01 # esetSel <- eset [selected05, ] # colnames(exprs(esetSel))<- paste("X", colnames(exprs(esetSel)), sep="") # write.exprs(esetSel, file="expres.selected.ALL.txt") # # # # I per crear l'arxiu amb un color diferent per cada grup (basat en la columna "mol.biol") # # # write.table(cbind(paste("X",rownames(pData(esetSel)),sep=""), # as.integer(pData(esetSel)$mol.biol)+1), sep="\t", # row.names=FALSE, col.names=c("Column", "Group"), quote=FALSE, # file="colorsForColumns.txt") # # # # # Això és un exemple del que voldríem haver capturat a través del formulari # # COMPTE perque, en aquesta versió, no considerem la possibilitat de treure # # - Ni, com paràmetre, la possibilitat d'enviar els gràfics a un arxiu PDF # # --> toPDF es deixa a FALSE # # - Ni un arxiu amb els gens de cada cluster # # --> numClusters es deixa a 0 # # - Ni un arxiu/gràfic amb els perfils de cada cluster # # --> plotProfiles es deixa a FALSE # # ####################################################################################### ### Chunk 3: Call to easyHeatMap functions ############################################################################################# require(easyHeatMap) download.file("http://ueb.ir.vhebron.net/dl220", "./expres.filtered.ALL.txt") download.file("http://ueb.ir.vhebron.net/dl221", "./colorsForColumns.txt") clustPar<-newClustPar(expres = NULL , # We'll give it a file attached to the tracker item expresFileName ="expres.filtered.ALL", # For a file "foo.txt", you have to indicate here "foo" (without extension) fileType = "txt", comparisonName = "ALL", Title = "My Plot: BCR/ABL vs ALL1/AF4", numClusters = 0, # Confirm that with zero nothing is done plotProfiles=FALSE, rowDistance = 'cor', colDistance = 'euclidean', RowVals = TRUE, ColVals = TRUE, escala = "row", colorsSet = redblue(64), #colors, colsForGroups = NULL, colsForGroupsFileName="colorsForColumns", densityInfo = "density", cexForColumns = 0.8, cexForRows = 0.8, outputDir=".", toPDF = FALSE, ) # HeatMap generation hm.ALL <- doHMAnalysis(clustPar) # Now it is easy to change paramters and re-draw the heatmap ## We can use a different colorset #clustPar$colorsSet <- heat.colors(64) #hm.ALL <- doHMAnalysis(clustPar) ## We can change the distance function for rows and/or columns #clustPar$rowDistance = 'cor' #clustPar$colDistance = 'minkowski' #hm.ALL <- doHMAnalysis(clustPar) ## We can use a different dataset #clustPar$expresFileName="expres.selected.ALL" #hm.ALL <- doHMAnalysis(clustPar) ############################################################# ### Optional change 1: PDF generation server side ############################################################# # # Imprimim a pdf # # COMPTE: els arxius s'anomenen per defecte # # el del heatmap: paste(paste("HM", comparisonName, sep=""),"pdf", sep=".") # # el dels perfils: paste(paste("plotProfiles", comparisonName, sep=""),"pdf", sep=".") # # el dels gens als clusters: paste(paste("genesInClusters", comparisonName, sep=""),"txt", sep=".") # # # Això es important de cara a descarregar-los des de l'aplicatiu web # # clustPar$toPDF<-TRUE # clustPar$plotProfiles <-TRUE # # hm.ALL <- doHMAnalysis(clustPar) ############################################################# ### Optional change 2: Changingthecolour palette ############################################################# # clustPar$toPDF<-FALSE # clustPar$plotProfiles <-FALSE # # # We can try with other colour palettes # colores1 <- heat.colors(64) # Veure a RColorBrewer altres formes # colores2 <- redblue(64) # Veure a RColorBrewer altres formes # colores3 <- greenred(16) # Veure a RColorBrewer altres formes # colores4 <- topo.colors(64) # Veure a RColorBrewer altres formes # colores5 <- terrain.colors (64) # colores6 <- colorpanel(36, "green", "white", "red") # colores7 <- rainbow(36) # # clustPar$toPDF<-FALSE # clustPar$plotProfiles <-FALSE # clustPar$colorsSet <-colores2 # hm.ALL <- doHMAnalysis(clustPar) {RR}
Menu
Featured profiles
Profiles in Wizard
Profiles Todos
Handlers
Profiles Tester
Admin
of this site
Current Profiles
Tiki version
21.x
24.x
26.x
27.x
28.x
Deprecated
25.x
state
Not fully functional yet
alpha
beta
release
type
Available in the Profiles Wizard (12+)
Featured profiles
Full profile (out of the box & ready to go)
Learning profile (to show off feature)
Long tail
Mini-profile (can be included in other)
Profile-snippet (optional but needs another "parent" profile)
Security
Tests
Latest Changes
Test_all_tracker_field_types_profile
Scheduler_Presets_20
Tracker_as_Calendar_09
Tracker_as_Calendar_10
Hide Fixed Top Nav Bar on Scroll 19
Easy_GeoBlog
test_profile_change
Profiles_in_Wizard
Random_header_images_14
Hide Fixed Top Nav Bar on Scroll 19
How to Create Profiles
Test_All_Plugins
JonnyBs_Luxury_Tiki_Setup
Collaborative_Multilingual_Terminology
Profile_Test_all_Modules_Test_all_Modules_page
...more
Like almost all *.tiki.org sites, you can log in with your login from
https://tiki.org
(register over there)
Search
Find
Most Popular Tags
admin
agenda
alias
antibot
antibot captcha
app
archive
articles
banning
batch
blogs
calculations
calendars
cart
categories
cluster
codemirror
comments
computation
contact us
datachannel
debug
debug console
dropdown with other
error messages
features
file galleries
forums
geo
geocms
geolocation
group homepages
group watches
header
i18n
images
item link
items list
jquery
languages
location
map
maps
maths
menu
menupage
multilingual
ol3
ol5
openlayers
paypal
plugin
plugin alias
plugin datachannel
plugin fade
plugin tabs
plugin trackerlist
pretty trackers
print
project management
r
r project
realnames
rss
static
static text
statistics
stats
structures
syntax highlighter
tablesorter
template
trackers
user watches
visualization
watches
webservice
wiki
wiki argument variables
wiki structures
Tiki Newsletter
Subscribe to the Tiki newsletter.
Don't miss major announcements and other news!