Commit 87292543 authored by Amine  GHOZLANE's avatar Amine GHOZLANE
Browse files

Debug 1 modality case in barplot and heatmap, rename the statistical methods

parent 72311614
Pipeline #15340 passed with stage
in 8 minutes and 4 seconds
...@@ -17,7 +17,6 @@ Plot_Visu_Barplot <- function(input,resDiff) ...@@ -17,7 +17,6 @@ Plot_Visu_Barplot <- function(input,resDiff)
counts_tmp_combined = tmp_combined$counts counts_tmp_combined = tmp_combined$counts
nbKept = length(ind_taxo) nbKept = length(ind_taxo)
SamplesNames = tmp_combined$namesCounts SamplesNames = tmp_combined$namesCounts
if(nbKept>1) namesTax = colnames(counts_tmp_combined) if(nbKept>1) namesTax = colnames(counts_tmp_combined)
else if(nbKept==1) namesTax = ind_taxo else if(nbKept==1) namesTax = ind_taxo
...@@ -106,6 +105,8 @@ Plot_Visu_Heatmap <- function(input,resDiff,export=FALSE){ ...@@ -106,6 +105,8 @@ Plot_Visu_Heatmap <- function(input,resDiff,export=FALSE){
VarInt = input$VisuVarInt VarInt = input$VisuVarInt
ind_taxo = input$selectTaxoPlot ind_taxo = input$selectTaxoPlot
sortrow = input$SortHeatRow
sortcol = input$SortHeatColumn
counts_tmp_combined = GetDataToPlot(input,resDiff,VarInt,ind_taxo)$counts counts_tmp_combined = GetDataToPlot(input,resDiff,VarInt,ind_taxo)$counts
...@@ -122,19 +123,22 @@ Plot_Visu_Heatmap <- function(input,resDiff,export=FALSE){ ...@@ -122,19 +123,22 @@ Plot_Visu_Heatmap <- function(input,resDiff,export=FALSE){
## Transpose matrix if Horizontal ## Transpose matrix if Horizontal
if(input$SensPlotVisu=="Horizontal") counts_tmp_combined = t(as.matrix(counts_tmp_combined)) if(input$SensPlotVisu=="Horizontal") counts_tmp_combined = t(as.matrix(counts_tmp_combined))
if(nrow(counts_tmp_combined) == 1) sortrow = "No"
if(!export) {plot = d3heatmap(counts_tmp_combined, dendrogram = "none", Rowv = (input$SortHeatRow == "Yes"), if(ncol(counts_tmp_combined) == 1) sortcol = "No"
Colv = (input$SortHeatColumn == "Yes"), na.rm = TRUE, width=ifelse(input$modifwidthVisu,input$widthVisu, "100%"), if(!export) {
height = input$heightVisu, show_grid = FALSE, colors = col, scale = input$scaleHeatmap, cexRow = as.numeric(input$LabelSizeHeatmap), margins=c(12,30), plot = d3heatmap(counts_tmp_combined, dendrogram = "none", Rowv = (sortrow == "Yes"),
cexCol=as.numeric(input$LabelSizeHeatmap), offsetCol=input$LabelColOffsetHeatmap, offsetRow=input$LabelRowOffsetHeatmap) Colv = (sortcol == "Yes"), na.rm = TRUE, width=ifelse(input$modifwidthVisu,input$widthVisu, "100%"),
height = input$heightVisu, show_grid = FALSE, colors = col, scale = input$scaleHeatmap, cexRow = as.numeric(input$LabelSizeHeatmap),
margins=c(12,30), cexCol=as.numeric(input$LabelSizeHeatmap), offsetCol=input$LabelColOffsetHeatmap, offsetRow=input$LabelRowOffsetHeatmap)
} }
if(export){ if(export){
dendrogram="none" dendrogram="none"
if(input$SortHeatColumn == "Yes" && input$SortHeatRow == "Yes" ) dendrogram ="both" if(input$SortHeatColumn == "Yes" && input$SortHeatRow == "Yes" ) dendrogram ="both"
else if(input$SortHeatColumn == "Yes") dendrogram ="column" else if(input$SortHeatColumn == "Yes") dendrogram ="column"
else if(input$SortHeatRow == "Yes") dendrogram ="row" else if(input$SortHeatRow == "Yes") dendrogram ="row"
plot = heatmap.2(counts_tmp_combined, dendrogram = dendrogram, Rowv = (input$SortHeatRow == "Yes"), plot = heatmap.2(counts_tmp_combined, dendrogram = dendrogram, Rowv = (sortrow == "Yes"),
Colv = (input$SortHeatColumn == "Yes"), na.rm = TRUE, density.info="none", margins=c(as.numeric(input$lowerMargin),as.numeric(input$rightMargin)),trace="none", Colv = (sortcol == "Yes"), na.rm = TRUE, density.info="none", margins=c(as.numeric(input$lowerMargin),as.numeric(input$rightMargin)),trace="none",
srtCol=45, col = col, scale = input$scaleHeatmap, cexRow = input$LabelSizeHeatmap,cexCol =input$LabelSizeHeatmap, srtCol=45, col = col, scale = input$scaleHeatmap, cexRow = input$LabelSizeHeatmap,cexCol =input$LabelSizeHeatmap,
offsetCol=input$LabelColOffsetHeatmap,offsetRow=input$LabelRowOffsetHeatmap,symm=FALSE,symkey=FALSE,symbreaks=FALSE) offsetCol=input$LabelColOffsetHeatmap,offsetRow=input$LabelRowOffsetHeatmap,symm=FALSE,symkey=FALSE,symbreaks=FALSE)
} }
...@@ -249,8 +253,6 @@ Plot_Visu_Krona <- function(input,resDiff,CT_OTU,taxo_table){ ...@@ -249,8 +253,6 @@ Plot_Visu_Krona <- function(input,resDiff,CT_OTU,taxo_table){
# Remove zero counts # Remove zero counts
# Required for Krona # Required for Krona
res = merge_dat[merge_dat[,1]>0,] res = merge_dat[merge_dat[,1]>0,]
#print(input$TaxoSelect)
#print(res)
} }
} }
return(res) return(res)
...@@ -315,12 +317,9 @@ Plot_Visu_Scatterplot<- function(input,resDiff,export=FALSE,lmEst = FALSE,CorEst ...@@ -315,12 +317,9 @@ Plot_Visu_Scatterplot<- function(input,resDiff,export=FALSE,lmEst = FALSE,CorEst
{counts = as.data.frame(round(counts(dds, normalized = FALSE)))} {counts = as.data.frame(round(counts(dds, normalized = FALSE)))}
target = as.data.frame(resDiff$target) target = as.data.frame(resDiff$target)
#print("target")
#print(target)
## Get the diversity values ## Get the diversity values
tmp_div = Plot_Visu_Diversity(input,resDiff,ForScatter=TRUE)$dataDiv tmp_div = Plot_Visu_Diversity(input,resDiff,ForScatter=TRUE)$dataDiv
#print("tmp_div")
#print(tmp_div)
if(!is.null(tmp_div)){ if(!is.null(tmp_div)){
div = cbind(round(tmp_div$value[tmp_div$diversity =="Alpha"],3), div = cbind(round(tmp_div$value[tmp_div$diversity =="Alpha"],3),
...@@ -697,7 +696,7 @@ GetDataToPlot <- function(input,resDiff,VarInt,ind_taxo,sec_variable = NULL, agg ...@@ -697,7 +696,7 @@ GetDataToPlot <- function(input,resDiff,VarInt,ind_taxo,sec_variable = NULL, agg
namesCounts = counts_tmp_combined$Group.1 namesCounts = counts_tmp_combined$Group.1
counts_tmp_combined = as.matrix(counts_tmp_combined[,-1]) counts_tmp_combined = as.matrix(counts_tmp_combined[,-1])
} }
if(!aggregate && nrow(counts_tmp)>0 && nrow(targetInt)>0) else if(!aggregate && nrow(counts_tmp)>0 && nrow(targetInt)>0)
{ {
## Proportion verified ## Proportion verified
counts_tmp_combined = t(counts_tmp) counts_tmp_combined = t(counts_tmp)
...@@ -712,9 +711,14 @@ GetDataToPlot <- function(input,resDiff,VarInt,ind_taxo,sec_variable = NULL, agg ...@@ -712,9 +711,14 @@ GetDataToPlot <- function(input,resDiff,VarInt,ind_taxo,sec_variable = NULL, agg
{ {
MeanCounts = apply(counts_tmp_combined,2,mean) MeanCounts = apply(counts_tmp_combined,2,mean)
ord = order(MeanCounts,decreasing=TRUE) ord = order(MeanCounts,decreasing=TRUE)
counts_tmp_combined = as.matrix(counts_tmp_combined[,ord]) if(nrow(counts_tmp_combined)==1) counts_tmp_combined[ord]
if(!aggregate) prop_tmp_combined = as.matrix(prop_tmp_combined[,ord]) else counts_tmp_combined = counts_tmp_combined[,ord]
prop_all = as.matrix(prop_all[,ord]) if(!aggregate){
if(nrow(prop_tmp_combined)==1) prop_tmp_combined[ord]
else prop_tmp_combined = prop_tmp_combined[,ord]
}
if(nrow(prop_all)==1) prop_all[ord]
else prop_all = prop_all[,ord]
} }
} }
} }
......
...@@ -890,6 +890,7 @@ function(request) { ...@@ -890,6 +890,7 @@ function(request) {
uiOutput("TabBoxDataDiff"), uiOutput("TabBoxDataDiff"),
tabBox(id = "tabBoxPlotTables", tabBox(id = "tabBoxPlotTables",
width = NULL, width = NULL,
height = 430,
selected = "Bar chart", selected = "Bar chart",
#selected = "Volcano plot", #selected = "Volcano plot",
tabPanel("Bar chart", uiOutput("BarChartContainer")), tabPanel("Bar chart", uiOutput("BarChartContainer")),
...@@ -1049,7 +1050,7 @@ function(request) { ...@@ -1049,7 +1050,7 @@ function(request) {
# conditionalPanel(condition="input.PlotVisuSelect=='Tree'", # conditionalPanel(condition="input.PlotVisuSelect=='Tree'",
# uiOutput("VarIntVisuTree")), # uiOutput("VarIntVisuTree")),
conditionalPanel(condition="input.PlotVisuSelect!='Network' && input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot' && input.PlotVisuSelect!='Krona'", conditionalPanel(condition="input.PlotVisuSelect!='Network' && input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot' && input.PlotVisuSelect!='Krona'",
radioButtons("SelectSpecifTaxo","Select the features",c("Most abundant"="Most","All"="All", "Differential features" = "Diff", "Non differential features" = "NoDiff")) radioButtons("SelectSpecifTaxo","Select the features",c("Most abundant"="Most","All"="All", "Differential features" = "Diff", "Non differential features" = "NoDiff", "Custom selection" = "Custom"))
), ),
conditionalPanel(condition="input.PlotVisuSelect!='Network' && input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot' && (input.SelectSpecifTaxo=='Diff' || input.SelectSpecifTaxo=='NoDiff') && input.PlotVisuSelect!='Krona' ", conditionalPanel(condition="input.PlotVisuSelect!='Network' && input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot' && (input.SelectSpecifTaxo=='Diff' || input.SelectSpecifTaxo=='NoDiff') && input.PlotVisuSelect!='Krona' ",
selectizeInput("ContrastList_table_Visu","",choices = "", multiple = TRUE), selectizeInput("ContrastList_table_Visu","",choices = "", multiple = TRUE),
......
Markdown is supported
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