Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plotTreeShiny/.Rproj.user/ED8AE702/sdb/prop/INDEX
1 change: 1 addition & 0 deletions plotTreeShiny/.Rhistory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setwd("G:/01_Research/Scripts/plotTree/plotTreeShiny")
4 changes: 4 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/build_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
auto_roxygenize_for_build_and_reload="0"
auto_roxygenize_for_build_package="1"
auto_roxygenize_for_check="1"
makefile_args=""
9 changes: 9 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/pcs/files-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"path" : "G:/01_Research/Scripts/plotTree/plotTreeShiny",
"sortOrder" : [
{
"ascending" : true,
"columnIndex" : 2
}
]
}
3 changes: 3 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/pcs/source-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"activeTab" : 0
}
14 changes: 14 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/pcs/windowlayoutstate.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"left" : {
"panelheight" : 998,
"splitterpos" : 420,
"topwindowstate" : "NORMAL",
"windowheight" : 1036
},
"right" : {
"panelheight" : 998,
"splitterpos" : 631,
"topwindowstate" : "NORMAL",
"windowheight" : 1036
}
}
4 changes: 4 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/pcs/workbench-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"TabSet1" : 0,
"TabSet2" : 0
}
1 change: 1 addition & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/saved_source_markers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"active_set":"","sets":[]}
17 changes: 17 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/sdb/per/t/3C7EE37E

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/sdb/prop/BB3849AE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
2 changes: 2 additions & 0 deletions plotTreeShiny/.Rproj.user/ED8AE702/sdb/prop/FA5A19B6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
391 changes: 391 additions & 0 deletions plotTreeShiny/app.R

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions plotTreeShiny/checkHash.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
checkHash <- function(s) {
# This function is designed to fix the problem of wrong colour paramters from the widget jscolorInput.
# colorRampPalette() of plotTree() uses col2rgb(), which takes strings like "#FFFFFF" but not "FFFFFF" as the input.
# therefore a '#' must be added to the beginnging of every initial input$*_col which does not contain the hash sign.
# However, the value picked up from the pop-up palette returns value starting from '#'.
# This disconsistancy between return values from the input box and the pop-up palette could be a bug of jscolorInput.
# FYI, errors of col2rgb:
# col2rgb("FFFFFF"): invalid color name 'FFFFFF'
# col2rgb("##FFFFFF"): invalid RGB specification
if (substring(s, 1, 1) != '#') { # for values from the input box of jscolorInput
return(paste('#', s, sep = ''))
} else {
return(s) # for values picked up from the pop-up palette
}
}
21 changes: 3 additions & 18 deletions plotTreeShiny/plotTree.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,16 @@ return(list(m=as.matrix(m),w=w,h=h))
}


plotTree<-function(tree,ladderise=NULL,heatmapData=NULL,barData=NULL,infoFile=NULL,blockFile=NULL,snpFile=NULL,gapChar="?",genome_size=5E6,blwd=5,block_colour="black",snp_colour="red",genome_offset=0,colourNodesBy=NULL,infoCols=NULL,outputPDF=NULL,outputPNG=NULL,w,h,heatmap.colours=rev(gray(seq(0,1,0.1))),tip.labels=F,tipLabelSize=1,offset=0,tip.colour.cex=0.5,legend=T,legend.pos="bottomleft",ancestral.reconstruction=F,cluster=NULL,tipColours=NULL,lwd=1.5,axis=F,axisPos=3,edge.color="black",infoCex=0.8,colLabelCex=0.8,treeWidth=10,infoWidth=10,dataWidth=30,edgeWidth=1,labelHeight=10,mainHeight=100,barDataWidth=10,blockPlotWidth=10,barDataCol=2,heatmapBreaks=NULL,heatmapDecimalPlaces=1,vlines.heatmap=NULL,vlines.heatmap.col=2,heatmap.blocks=NULL,pie.cex=0.5) {
plotTree<-function(tree,heatmapData=NULL,barData=NULL,infoFile=NULL,blockFile=NULL,snpFile=NULL,gapChar="?",genome_size=5E6,blwd=5,block_colour="black",snp_colour="red",genome_offset=0,colourNodesBy=NULL,infoCols=NULL,outputPDF=NULL,outputPNG=NULL,w,h,heatmap.colours=rev(gray(seq(0,1,0.1))),tip.labels=F,tipLabelSize=1,offset=0,tip.colour.cex=0.5,legend=T,legend.pos="bottomleft",ancestral.reconstruction=F,cluster=NULL,tipColours=NULL,lwd=1.5,axis=F,axisPos=3,edge.color="black",infoCex=0.8,colLabelCex=0.8,treeWidth=10,infoWidth=10,dataWidth=30,edgeWidth=1,labelHeight=10,mainHeight=100,barDataWidth=10,blockPlotWidth=10,barDataCol=2,heatmapBreaks=NULL,heatmapDecimalPlaces=1,vlines.heatmap=NULL,vlines.heatmap.col=2,heatmap.blocks=NULL,pie.cex=0.5) {

require(ape)

# PREPARE TREE, CHOOSE LADDERISATION OR NOT, AND GET TIP ORDER
# PREPARE TREE AND GET TIP ORDER
if (is.character(tree)){
t<-read.tree(tree)
}
else t<-tree
if (is.null(ladderise))
{
tl<-t
}
else if (ladderise=="descending")
{
tl<-ladderize(t, T)
}
else if (ladderise=="ascending")
{
tl<-ladderize(t, F)
}
else if (!is.null(ladderise))
{
print("Ladderise option should be exactly 'ascending' or 'descending'. Any other command will raise this error. Leave option empty to order branches as per input tree.")
}
tl<-ladderize(t)
tips<-tl$edge[,2]
tip.order<-tips[tips<=length(tl$tip.label)]
tip.label.order<-tl$tip.label[tip.order] # for ordering data. note that for tiplabel(), the order is the same as in t$tip (= tl$tip)
Expand Down
13 changes: 13 additions & 0 deletions plotTreeShiny/plotTreeShiny.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Yes
SaveWorkspace: No
AlwaysSaveHistory: No

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
192 changes: 0 additions & 192 deletions plotTreeShiny/server.R

This file was deleted.

Loading