render.default <- function(tree, input.tree, active_trace, plot=1 ) {
selection <- get_selected(input.tree, format = "names")[[1]]
sel <- c(attr(selection, "ancestry"), selection)
stim <- getStimName(tree, selection)
#if (is.null(cursor[[stim]]))
# cursor[[stim]] <<- c(0, 0.1)
#if (level(selection) > 1) {
# s <- getSeries(tree, sel[1], sel[2], sel[3], trace=active_trace)
#}
if (level(selection) == 1) {
if(file.exists("render_exp.R")){
source("render_exp.R", local=T)
}
#s <- getSeries(tree, sel[1], sel[2], sel[3], trace=active_trace)
if(exists("render_exp")){
render_exp(tree, selection)
}
}
if (level(selection) == 2) {
s <- getSeries(tree, sel[1], sel[2], sel[3], trace=active_trace)
if(file.exists("render_ser.R")){
source("render_ser.R", local=T)
}
if(plot==1){
if(exists("render_ser")){
render_ser(s)
}else{
#print("s.plot")
s$plot()
}
}else{
if(!is.null(CURSORS[[stim]]$plot2.fun)){
#print("plot2.fun")
CURSORS[[stim]]$plot2.fun(tree,input.tree)
}
}
}
if (level(selection) == 3) {
s <- getSeries(tree, sel[1], sel[2], sel[3], trace=active_trace)
selected_sweep <- getSelectedSweeps(tree, selection)
s$plot(sweeps = selected_sweep, main = selected_sweep)
}
if (level(selection) == 4) {
selx = attr(selection, "ancestry")[4]
attr(selx, "ancestry") <- attr(selection, "ancestry")[1:3]
selected_sweep <- getSelectedSweeps(tree, selx)
selected_trace = getSelectedTrace(tree, selection)
s <- getSeries(tree, sel[1], sel[2], sel[3], trace = selected_trace) #not nice, we get it twice
s$plot(sweeps = selected_sweep, main = selected_trace) #not works
}
if (exists("res"))
res else ""
}
# test t=tree2[[c(1,1,2,1,2)]] p=attr(t,'path') sel=structure(p[5], 'ancestry'=p[1:4]) sel
# render(tree2,sel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.