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

Add separtor choice

parent 2ff96c4c
......@@ -67,6 +67,7 @@ TableDiff_print <- function(input,BaseContrast,resDiff, info = NULL)
complete.name <- merge(complete.name, mcols.add, by = "Id")
complete[[name]] <- complete.name
complete.name=complete.name[order(complete.name$padj),]
significant.name <- complete.name[which(complete.name$padj <= alpha & complete.name$betaConv), ]
up.name <- complete.name[which(complete.name$padj <= alpha & complete.name$betaConv & complete.name$log2FoldChange>=0.0), ]
## useless order
#up.name <- up.name[order(up.name$padj), ]
......@@ -78,5 +79,5 @@ TableDiff_print <- function(input,BaseContrast,resDiff, info = NULL)
# complete.complete[, paste(name, keep, sep = ".")] <- complete.name[, keep]
}
#return(list(complete=complete.name,up=up.name,down=down.name))
return(list(complete=complete.name[,keep],up=up.name[,keep],down=down.name[,keep]))
return(list(significant=significant.name[,keep],complete=complete.name[,keep],up=up.name[,keep],down=down.name[,keep]))
}
......@@ -576,8 +576,8 @@ shinyServer(function(input, output,session) {
## Export size factors
output$ExportSizeFactor <- downloadHandler(
filename = function() { 'SHAMAN_sizefactors.csv' },
content = function(file){write.table(SizeFactor_table(), file,quote=FALSE,row.names = FALSE,sep="\t")}
filename = function() { if (input$sepsizef == "\t") 'SHAMAN_sizefactors.tsv' else 'SHAMAN_sizefactors.csv' },
content = function(file){write.table(SizeFactor_table(), file,quote=FALSE,row.names = FALSE,sep=input$sepsizef)}
)
......@@ -1337,8 +1337,12 @@ shinyServer(function(input, output,session) {
return(res)
})
## Significant diff table
output$DataDiffsignificant <- renderDataTable(
datatable(dataDiff()$significant,rownames = FALSE),
options = list(lengthMenu = list(c(10, 50, -1), c('10', '50', 'All')),
pageLength = 10,scrollX=TRUE, processing=FALSE
))
## Complete diff table
output$DataDiffcomplete <- renderDataTable(
datatable(dataDiff()$complete,rownames = FALSE),
......@@ -1369,10 +1373,12 @@ shinyServer(function(input, output,session) {
if(!is.null(data))
{
tabBox(width = NULL, selected = "Complete",
tabBox(width = NULL, selected = "Significant",
tabPanel("Significant",dataTableOutput("DataDiffsignificant")),
tabPanel("Complete",dataTableOutput("DataDiffcomplete")),
tabPanel("Up",dataTableOutput("DataDiffup")),
tabPanel("Down",dataTableOutput("DataDiffdown"))
tabPanel("Down",dataTableOutput("DataDiffdown"))
)
}
......@@ -1387,12 +1393,18 @@ shinyServer(function(input, output,session) {
#### Export diff table
output$exportDiffTable <- downloadHandler(
filename = function() {paste(input$WhichExportTable,input$ContrastList_table,'SHAMAN.csv',sep="_")},
filename = function() {
extension='SHAMAN.csv'
if(input$sepexpdiff == "\t") extension='SHAMAN.tsv'
paste(input$WhichExportTable,input$ContrastList_table,extension,sep="_")
},
content = function(file){
switch(input$WhichExportTable,
"Complete" = write.csv(dataDiff()$complete, file,row.names = FALSE),
"Up" = write.csv(dataDiff()$up, file,row.names = FALSE),
"Down" = write.csv(dataDiff()$down, file,row.names = FALSE)
"Significant" = write.table(dataDiff()$significant, file,row.names = FALSE, sep=input$sepexpdiff),
"Complete" = write.table(dataDiff()$complete, file,row.names = FALSE, sep=input$sepexpdiff),
"Up" = write.table(dataDiff()$up, file,row.names = FALSE, sep=input$sepexpdiff),
"Down" = write.table(dataDiff()$down, file,row.names = FALSE, sep=input$sepexpdiff)
)
}
)
......@@ -1562,13 +1574,16 @@ shinyServer(function(input, output,session) {
## Export Diversitytable in .csv
output$ExportDiversitytable <- downloadHandler(
filename = function() { 'SHAMAN_Diversity.csv' },
filename = function() {
if(input$sepdiversity) 'SHAMAN_Diversity.tsv'
else 'SHAMAN_Diversity.csv'
},
content = function(file){
resDiff = ResDiffAnal()
tmp = Plot_Visu_Diversity(input,resDiff)$dataDiv
tmp$VarX=NULL; tmp$VarCol=NULL
datatable(tmp[,c(4,5,1,2,3)],rownames= FALSE)
write.csv(tmp, file,row.names = FALSE)
write.table(tmp, file,row.names = FALSE, sep=input$sepdiversity)
}
)
......
......@@ -231,16 +231,13 @@ body <- dashboardBody(
br(),
fluidRow(
box(title="Select your file format",width = 3,status = "success", solidHeader = TRUE,collapsible = FALSE,
selectInput("FileFormat","",c("Count table & taxonomy"="fileCounts","BIOM file"="fileBiom"),selected="fileCounts")
selectInput("FileFormat","",c("Count table & taxonomy (*.csv or *.tsv)"="fileCounts","BIOM file"="fileBiom"),selected="fileCounts")
),
conditionalPanel(condition="input.FileFormat=='fileCounts'",
box(title="Load the count table",width = 3,height = "260px", status = "primary", solidHeader = TRUE,collapsible = FALSE,
fluidRow(
column(width=6,radioButtons("TypeTable",h6(strong("Type:")),c("OTU/Gene table"="OTU","MGS table"="MGS"))),
column(width=6,selectInput("sepcount", h6(strong("Separator:")),
c("\\t" = "\t",
"," = ",",
";" = ";")))
column(width=6,selectInput("sepcount", h6(strong("Separator:")),c("Tab" = "\t", "Comma" = ",","Semi-colon" = ";")))
),
fileInput('fileCounts', h6(strong('Select your file')),width="100%")
),
......@@ -253,7 +250,7 @@ body <- dashboardBody(
),
column(width=6,
conditionalPanel(condition="input.TypeTaxo=='Table'",selectInput("septaxo", h6(strong("Separator:")),
c("\\t" = "\t", "," = ",", ";" = ";")))
c("Tab" = "\t", "Comma" = ",", "Semicolon" = ";")))
)
),
fileInput('fileTaxo', h6(strong('Select your file')),width="100%")
......@@ -288,8 +285,8 @@ body <- dashboardBody(
box(title="Experimental design",width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed = FALSE,
fluidRow(
column(width=5,fileInput('fileTarget', h6(strong('Select your target file')),width="100%")),
column(width=2,selectInput("septarget", h6(strong("Separator:")), c("\\t" = "\t", "," = ",", ";" = ";"))),
column(width=5,uiOutput("SelectTaxo"))
column(width=3,selectInput("septarget", h6(strong("Separator:")), c("Tab" = "\t", "Comma" = ",", "Semicolon" = ";"))),
column(width=4,uiOutput("SelectTaxo"))
),
fluidRow(
column(width=6,uiOutput("SelectInterestVar")),
......@@ -341,7 +338,7 @@ body <- dashboardBody(
column(width=3,
fileInput('fileSizeFactors', h6(strong('Define your own size factors')),width="100%")
),
column(width=3, selectInput("sepsize", h6(strong("Separator:")), c("\\t" = "\t", "," = ",", ";" = ";"))),
column(width=3, selectInput("sepsize", h6(strong("Separator:")), c("Tab" = "\t", "," = "Comma", "Semicolon" = ";"))),
column(width=3,br(),htmlOutput("InfoSizeFactor"))
)
),
......@@ -369,7 +366,11 @@ body <- dashboardBody(
conditionalPanel(condition="input.DiagPlot=='SfactorsVStot'",
box(title = "Size factors", width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
dataTableOutput("SizeFactTable"),
downloadButton('ExportSizeFactor', 'Export table')
fluidRow(
column(width=3,downloadButton('ExportSizeFactor', 'Export table')),
column(width=3,selectInput("sepsizef", h6(strong("Separator:")), c("Tab" = "\t", "Comma" = ",", "Semicolon" = ";")))
),
tags$style(type='text/css', "#ExportSizeFactor { margin-top: 37px;}")
)
),
......@@ -481,7 +482,10 @@ body <- dashboardBody(
htmlOutput("ContrastOverviewTable")
),
box(title = "Export", width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
fluidRow(column(width=12,selectInput("WhichExportTable", "Select the table to export",c("Complete"="Complete","Up"="Up","Down"="Down")))),
fluidRow(
column(width=8,selectInput("WhichExportTable", "Select the table to export",c("Significant"="Significant","Complete"="Complete","Up"="Up","Down"="Down"))),
column(width=4,selectInput("sepexpdiff", "Separator:", c("Tab" = "\t", "Comma" = ",", "Semicolon" = ";")))
),
uiOutput("ExportTableButton")
)
)
......@@ -527,9 +531,12 @@ body <- dashboardBody(
conditionalPanel(condition="input.PlotVisuSelect=='Diversity'",
br(),
box(title = "Diversity values", width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
dataTableOutput("Diversitytable"),
downloadButton('ExportDiversitytable', 'Export table')
dataTableOutput("Diversitytable"),
fluidRow(
column(width=3,downloadButton('ExportDiversitytable', 'Export table')),
column(width=3,selectInput("sepdiversity", "Separator:", c("Tab" = "\t", "Comma" = ",", "Semicolon" = ";")))
),
tags$style(type='text/css', "#ExportDiversitytable { margin-top: 37px;}")
)
)
......
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