Commit 168fa0ca authored by Amine  GHOZLANE's avatar Amine GHOZLANE
Browse files

First integration of phylogenetic tree visualisation

parent e61bebce
......@@ -154,6 +154,11 @@ if(!require(philentropy)){
library(philentropy)
}
if(!require(PhyloTreeMetaR)){
devtools::install_github("https://github.com/pierreLec/PhyloTreeMetaR.git")
library(PhyloTreeMetaR)
}
# if(!require(plotly)){
# install.packages("plotly")
......
......@@ -83,7 +83,7 @@ CheckTaxoTable <- function(taxo,counts, MGSTable=FALSE, taxoCreated=FALSE)
if(taxoCreated){Warning = "No taxonomy table has been uploaded, the analysis can only be done at the OTU/gene level"}
if(ncol(taxo)<1 && is.null(Error)){Error = "The number of columns of the taxonomy table must be at least 1" }
else if(nrow(taxo)<=1 && is.null(Error)){Error = "The number of rows if the taxonomy table must be at least 2" }
if(is.numeric(taxo) && is.null(Error) ){Error = "The taxonomy table must contain only character" }
if(TRUE%in%is.numeric(taxo) && is.null(Error) ){Error = "The taxonomy table must contain only character" }
if(is.null(Error))
{
......
......@@ -105,7 +105,8 @@ shinyServer(function(input, output,session) {
try(read.tree(inFile$datapath)->data,silent=T)
CheckTree = CheckTreeFile(data)
data = CheckTree$tree
return(list(data=data,Error = CheckTree$Error,Warning = CheckTree$Warning))
try(readLines(inFile$datapath)->treeseq,silent=T)
return(list(data=data,Error = CheckTree$Error,Warning = CheckTree$Warning, treeseq=treeseq))
})
......@@ -130,13 +131,8 @@ shinyServer(function(input, output,session) {
}
}
return(res)
})
## Input data
dataInput <-reactive({
......@@ -190,9 +186,6 @@ shinyServer(function(input, output,session) {
})
## Size factor file (optional)
dataSizeFactors <-reactive({
......@@ -467,10 +460,19 @@ shinyServer(function(input, output,session) {
## Tab box for data visualisation
output$TabBoxData <- renderUI({
tree = dataInputTree()$data
data=dataInput()$data
if(!is.null(data$counts) && !is.null(data$taxo) && nrow(data$counts)>0 && nrow(data$taxo)>0)
if(!is.null(data$counts) && !is.null(data$taxo) && nrow(data$counts)>0 && nrow(data$taxo)>0 && !is.null(tree))
{
tabBox(width = NULL, selected = "Count table",
tabPanel("Count table",DT::dataTableOutput("DataCounts")),
tabPanel("Taxonomy",DT::dataTableOutput("DataTaxo")),
tabPanel("Summary",h5(strong("Percentage of annotation")),htmlOutput("SummaryView"),
br(),h5(strong("Number of features by level:")),plotOutput("SummaryViewBarplot",width = 1200,height=500)),
tabPanel("Phylogeny", PhyloTreeMetaROutput('PhyloTreeMetaR'))
)
}
else if(!is.null(data$counts) && !is.null(data$taxo) && nrow(data$counts)>0 && nrow(data$taxo)>0)
{
tabBox(width = NULL, selected = "Count table",
tabPanel("Count table",DT::dataTableOutput("DataCounts")),
......@@ -482,6 +484,10 @@ shinyServer(function(input, output,session) {
})
output$PhyloTreeMetaR <- renderPhyloTreeMetaR({
PhyloTreeMetaR(dataInputTree()$treeseq,NULL)
})
output$SummaryView <- renderGvis({
data = dataInput()$data
taxo = data$taxo
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment