Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian "Tischi" Tischer committed Mar 11, 2016
1 parent 9cee540 commit 35c6e6f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 57 deletions.
37 changes: 8 additions & 29 deletions gui.R
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ guiHandler_JitterPlot <- function(h,...){
gp <- ggroup(horizontal = T, container=w)
glabel("Experiment selection: ", container=gp)
guiExpSubset <- gcombobox(c("None selected", experiments),
container = gp,
selected = htmGetListSetting(htm,"visualisation","jitterPlotExpSubset",gui=T),
container = gp,
handler = function(h,...){
htmSetListSetting(htm,"visualisation","jitterPlotExpSubset",svalue(h$obj),gui=T)
})
Expand All @@ -706,14 +706,7 @@ guiHandler_JitterPlot <- function(h,...){

gp <- ggroup(horizontal = T, container=w)
glabel("Sorting: ", container=gp)
guiSorting <- gcombobox(c("none","alphabetic","median value"),
container = gp,
selected = htmGetListSetting(htm,"visualisation","jitterPlot_sorting",gui=T),
handler = function(h,...){
htmSetListSetting(htm, "visualisation","jitterPlot_sorting",svalue(h$obj),gui=T)
}
)

guiSorting <- gcombobox(c("None selected","alphabetic","median value"), container=gp)

gp <- ggroup(horizontal = T, container=w)
glabel("Compute t-test against: ", container=gp)
Expand All @@ -728,10 +721,10 @@ guiHandler_JitterPlot <- function(h,...){
cx = svalue(cx),
cy = svalue(cy),
.ylab = svalue(cy),
datatype = htmGetListSetting(htm,"visualisation","jitterPlot_datatype",gui=T),
datatype = svalue(guiSelectedData),
experimentSubset = svalue(guiExpSubset),
treatmentSubset = htmGetVectorSettings("visualisation$treatmentSelectionForPlotting"),
sorting = htmGetListSetting(htm,"visualisation","jitterPlot_sorting",gui=T),
sorting = svalue(guiSorting),
colorizeTreatments = htmGetListSetting(htm,"visualisation","jitterPlot_colorizeTreatments_TF",gui=T),
showMedian = htmGetListSetting(htm,"visualisation","jitterPlot_showMedianAndMAD_TF",gui=T),
showMean = htmGetListSetting(htm,"visualisation","jitterPlot_showMeanAndSD_TF",gui=T),
Expand All @@ -745,9 +738,9 @@ guiHandler_JitterPlot <- function(h,...){
htm <- get("htm", envir = globalenv())
htmJitterplot(htm, svalue(cx), svalue(cy), .xlim=sort(loc$x),.ylim=sort(loc$y),.ylab=svalue(cy),
experimentSubset = svalue(guiExpSubset),
datatype = htmGetListSetting(htm,"visualisation","jitterPlot_datatype",gui=T),
datatype = svalue(guiSelectedData),
colorizeTreatments = htmGetListSetting(htm,"visualisation","jitterPlot_colorizeTreatments_TF",gui=T),
sorting = htmGetListSetting(htm,"visualisation","jitterPlot_sorting",gui=T),
sorting = svalue(guiSorting),
newdev = F,
treatmentSubset = htmGetVectorSettings("visualisation$treatmentSelectionForPlotting"),
showMedian = htmGetListSetting(htm,"visualisation","jitterPlot_showMedianAndMAD_TF",gui=T),
Expand All @@ -766,7 +759,7 @@ guiHandler_JitterPlot <- function(h,...){
svalue(cx),svalue(cy),.xlim=sort(loc$x),.ylim=sort(loc$y),
experimentSubset = svalue(guiExpSubset),
colorizeTreatments = htmGetListSetting(htm,"visualisation","jitterPlot_colorizeTreatments_TF",gui=T),
sorting = htmGetListSetting(htm,"visualisation","jitterPlot_sorting",gui=T),
sorting = svalue(guiSorting),
datatype = svalue(guiSelectedData),
newdev = F, action="click",
treatmentSubset = htmGetVectorSettings("visualisation$treatmentSelectionForPlotting")
Expand Down Expand Up @@ -836,16 +829,7 @@ guiHandler_JitterPlot_Options <- function(h,...) {
container = w,
handler = function(h,...){
htmSetListSetting(htm, "visualisation","jitterPlot_log2_TF",svalue(h$obj),gui=T)
})

glabel("x axis font size factor:", container=w)
gcombobox(c("0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0"),
container = w,
selected = htmGetListSetting(htm,"visualisation","jitterPlot_x_axis_font_size",gui=T),
handler = function(h,...){
htmSetListSetting(htm, "visualisation","jitterPlot_x_axis_font_size",svalue(h$obj),gui=T)
}
)
})

visible(w) <- T
}
Expand Down Expand Up @@ -1129,15 +1113,10 @@ guiHandler_SetColumns <- function(h, ...) {

gbutton(" Apply ", container = gg, handler = function(h,...) {
htm <- get("htm", envir = globalenv())
# auto-make batch_treat and treat_batch
cTreat = htmGetListSetting(htm,"columns","treatment",gui=T)
cBatch = htmGetListSetting(htm,"columns","experiment",gui=T)
htm@data$Metadata_batch_treatment = paste(htm@data[[cBatch]],htm@data[[cTreat]],sep="__")
print(paste("Generated new colum Metadata_batch_treatment, combining",cBatch,"and",cTreat))
htm@data$Metadata_treatment_batch = paste(htm@data[[cTreat]],htm@data[[cBatch]],sep="__")
print(paste("Generated new colum Metadata_treatment_batch, combining",cTreat,"and",cBatch))


assign("htm", htm, envir = globalenv())
dispose(w)
})
Expand Down
Binary file added india.pdf
Binary file not shown.
28 changes: 9 additions & 19 deletions plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ htmShowImagesFromRow <- function(htm,data,irs,appendCommand=""){
filenamePrefix = htm@settings@visualisation$image_filename_prefix
foldernamePrefix = htm@settings@visualisation$image_foldername_prefix
# convert to forward slashes immideately, otherwise gsub has problems later
rootFolderTable = gsub("\\\\" ,"/",htmGetListSetting(htm,"visualisation","image_root_foldername_in_table",gui=T))
rootFolderReal = gsub("\\\\" ,"/",htmGetListSetting(htm,"visualisation","image_root_foldername_on_this_computer",gui=T))
print(paste(" Pattern in table:",rootFolderTable))
print(paste(" Pattern for real:",rootFolderReal))

rootFolderTable = gsub("\\\\" ,"/",htm@settings@visualisation$image_root_foldername_in_table)
rootFolderReal = gsub("\\\\" ,"/",htm@settings@visualisation$image_root_foldername_on_this_computer)

if( .Platform$OS.type == "unix" ) {
#imageViewerCMD = "/Applications/Fiji.app/Contents/MacOS/fiji-macosx --no-splash"
imageViewerCMD = '/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx -debug '
Expand All @@ -90,13 +88,10 @@ htmShowImagesFromRow <- function(htm,data,irs,appendCommand=""){
imagename = strsplit(colname,filenamePrefix)[[1]][2]
filename = data[[colname]][ir]
cFolder = paste(foldernamePrefix,imagename,sep="")
foldername = data[[cFolder]][ir]
print(paste(" Folder in table:",foldername))
foldername = gsub("\\\\" ,"/", foldername)
#print(paste(" Folder after replacement of slashes:",foldername))
#print(cFolder)
foldername = gsub("\\\\" ,"/",data[[cFolder]][ir])
foldername = gsub(rootFolderTable, rootFolderReal, foldername)
print(paste(" Folder after subsitution of local mapping:",foldername))


if ( .Platform$OS.type == "unix" ) {
#foldername = gsub("\\\\" ,"/", foldername)
#pathname = paste('"',foldername,"/",filename,'"',sep="")
Expand Down Expand Up @@ -703,7 +698,7 @@ htmHeatmap_MarkSelectedTreatment <- function(htm, selectedExp, selectedTreatment

htmJitterplot <- function(htm=htm, cx, cy, .xlab="", .ylab="", treatmentSubset = "None selected",
.xlim=NA, .ylim=NA, datatype="images", colorizeTreatments=F,
sorting="none", experimentSubset="None selected", newdev = T,
sorting="None selected", experimentSubset="None selected", newdev = T,
action="plot", printMeanSD = T, showMean = T, showMedian = T, save2file = F,
scaleFromZero = F, reference="None selected") {

Expand Down Expand Up @@ -777,7 +772,7 @@ htmJitterplot <- function(htm=htm, cx, cy, .xlab="", .ylab="", treatmentSubset =
}

print(paste(" sorting:",sorting))
if(sorting=="none") {
if(sorting=="None selected") {
ids = 1:nrow(data)
}
if(sorting=="alphabetic") {
Expand Down Expand Up @@ -946,12 +941,7 @@ htmJitterplot <- function(htm=htm, cx, cy, .xlab="", .ylab="", treatmentSubset =
} else { # zooming
plot(jp.x, jp.y, xaxt = "n", xlab=.xlab, ylab=.ylab, xlim=.xlim, ylim=.ylim, pch=pchQC, cex=dotsize, col=.colors, cex.lab =1)
}
if(htmGetListSetting(htm,"visualisation","jitterPlot_x_axis_font_size",gui=T) != "None selected") {
x_axis_font_size = as.numeric(htmGetListSetting(htm,"visualisation","jitterPlot_x_axis_font_size",gui=T))
} else {
x_axis_font_size = 1
}
axis(1, at=1:length(lx), labels=lx, las=2, cex.axis = x_axis_font_size)
axis(1, at=1:length(lx), labels=lx, las=2, cex.axis = 1)

plotTitle = ""
if(experimentSubset[1] != "None selected") {
Expand Down
17 changes: 8 additions & 9 deletions run.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@

## specify libraries
libs = list("gWidgets","gWidgetstcltk","markdown","plyr")

## install libraries
if(F) {
install.packages("gWidgets", repos='http://cran.us.r-project.org')
install.packages("gWidgetstcltk", repos='http://cran.us.r-project.org')
install.packages("markdown", repos='http://cran.us.r-project.org')
install.packages("plyr", repos='http://cran.us.r-project.org')
}
# sapply(libs, biocLite)
# install.packages("gWidgets")
# install.packages("gWidgetstcltk")
# install.packages("markdown")
# install.packages("plyr")


## load libraries
print("Loading libraries...")
libs = list("gWidgets","gWidgetstcltk","markdown","plyr")
sapply(libs, function(x) do.call("library", list(x)))

options(warn = 2)

# path = "C:\\Users\\Christian Tischer\\Dropbox\\R\\HTM\\HTM_Explorer\\HTM_Explorer";setwd(path);source("run.R");
# path = "/Users/tischi/Dropbox/R/HTM/HTM_Explorer/HTM_Explorer";setwd(path);source("run.R");
# path = "\\\\almf\\almf\\software\\scripts\\R\\HTM_Explorer";setwd(path);source("run.R");
# path = "Y:\\R\\HTM_Explorer";setwd(path);source("run.R");

## source code
#setwd(path);source("install.R");
Expand Down

0 comments on commit 35c6e6f

Please sign in to comment.