Commit 84d7c6c7 authored by Amine  GHOZLANE's avatar Amine GHOZLANE
Browse files

Solved bug for saved datasets

parent 0541f42f
......@@ -524,6 +524,7 @@ GetDataFromBIOM <-function(dataBIOM)
OTUnames = rownames(taxo)
## Modif taxo table (remove p__,... and change the colnames)
taxo_biom = taxo
saveRDS(taxo, file="taxo.RDS")
taxo = as.data.frame(sapply(taxo,gsub,pattern="^.*__",replacement=""))
colnames(taxo) = c("Kingdom", "Phylum","Class","Order","Family","Genus","Species")
rownames(taxo) = OTUnames
......@@ -540,10 +541,8 @@ GetDataFromBIOM <-function(dataBIOM)
# Convert from list to dataframe
target = as.data.frame(target)
target$SampleID = rownames(target)
print(c(dim(target)[2], seq(1, dim(target)[2]-1)))
target = subset(target, select=c(dim(target)[2], seq(1, dim(target)[2]-1)))
}
print(target)
if(is.null(obs) && !is.null(counts)) {taxo = data.frame(rownames(counts),row.names = rownames(counts));names(taxo)=NA; taxoCreated = TRUE}
CheckTaxo = CheckTaxoTable(taxo,counts,taxoCreated)
......@@ -575,6 +574,9 @@ GetDataFromCT <-function(dataC,dataT, MGSTable)
taxo_temp = as.matrix(taxo)
if(dim(taxo_temp)[2] < 7){
taxo_temp = cbind(taxo_temp, matrix(NA, dim(taxo_temp)[1], 7 - dim(taxo_temp)[2]))
}else if (dim(taxo_temp)[2] > 7){
taxo_temp = taxo_temp[,1:7]
# send sweet alert
}
# All OTU must be referenced
if(dim(taxo_temp)[1] != dim(counts)[1]){
......@@ -583,7 +585,8 @@ GetDataFromCT <-function(dataC,dataT, MGSTable)
rownames(mat_missing) = missing_elements
taxo_temp = rbind(taxo_temp, mat_missing)
}
taxo_biom = t(sapply(as.data.frame(t(taxo_temp)), FUN=function(x){paste(l,na.omit(x),sep="")}))
#case with more than 7 levels
taxo_biom = t(sapply(as.data.frame(t(taxo_temp)), FUN=function(x){paste(l,na.exclude(x),sep="")}))
## Pourcentage of annotation
......
......@@ -900,7 +900,7 @@ Plot_network <- function(input,resDiff,availableTaxo, ind_taxo, qualiVariable, e
plot <- visIgraphLayout(plot, layout = "layout_nicely", physics = FALSE, smooth = FALSE)
plot <- visNodes(plot, size = 20)
plot <- visEdges(plot, width = 1)
plot <- visOptions(plot, width = if(isolate(input$modifwidthVisu)){isolate(input$widthVisu)}, height = isolate(input$heightVisu), autoResize = FALSE)
plot <- visOptions(plot, width = if(isolate(input$modifwidthVisu)){isolate(input$widthVisu)}, height = isolate(input$heightVisu), autoResize = FALSE, highlightNearest = list(enabled = TRUE, degree = 1, hover = FALSE))
#plot <- visLegend(plot, addEdges = data.frame(color = c("red", "blue"), label = c("Positive correlation","Negative correlation")))
#plot <- visExport(plot, type = "pdf", name = "network_SHAMAN.pdf", float="bottom")
......
......@@ -1399,14 +1399,32 @@ shinyServer(function(input, output,session) {
# Run demo
observeEvent(input$DemoDataset, {
if(input$DemoDataset != "..."){
values$masque_key = input$DemoDataset
DemoDataset = strsplit(input$DemoDataset,"|", fixed=T)
values$masque_key = DemoDataset[[1]][1]
updateSelectInput(session, "FileFormat","",selected = "fileBiom")
reset("fileBiom")
reset("fileTree")
updateSelectInput(session, "DemoDataset","",selected = "...")
#PS = Project_status(values$masque_key,values$curdir)
values$biom_masque = paste(values$curdir,"www","masque","done",paste("file",values$masque_key,sep=""),paste("shaman_silva.biom",sep=""),sep= .Platform$file.sep)
values$tree_masque = paste(values$curdir,"www","masque","done",paste("file",values$masque_key,sep=""),paste("shaman_silva_tree.nhx",sep=""),sep= .Platform$file.sep)
sendSweetAlert(messageId="DemoDataset", title = "Success", text = "Data of XXX were successfully loaded. You can go to statistical analysis section.", type = "success", html=TRUE)
sendSweetAlert(messageId="DemoDataset", title = "Success", text = paste("Data of", DemoDataset[[1]][2], "were successfully loaded. You can go to statistical analysis section."), type = "success", html=TRUE)
removeCssClass(class = 'pwdRED', selector = '#password_home')
addCssClass(class = 'pwdGREEN', selector = '#password_home')
hideElement("masque-form",anim=TRUE)
hideElement("masque-infobox",anim=TRUE)
hideElement("boxsum",anim=TRUE)
showElement("reload-project",anim=TRUE)
hideElement("project_over",anim=TRUE)
hideElement("pass",anim=TRUE)
#showElement("MasqueToShaman",anim=TRUE)
}
else{
values$tree_masque = NULL
values$biom_masque = NULL
values$masque_key = NULL
PS =NULL
reset("fileBiom")
reset("fileTree")
}
})
......@@ -1883,8 +1901,10 @@ shinyServer(function(input, output,session) {
output$Project_box_home <- renderUI({
res = NULL
demodata = input$DemoDataset
FileFormat = input$FileFormat
PS = Project_status(values$masque_key,values$curdir)
if(PS$passOK){
if(PS$status=="done")
......@@ -1906,7 +1926,7 @@ shinyServer(function(input, output,session) {
diff = tmp-start
}
if(file.exists(annot_process))
if(file.exists(annot_process) && demodata=="...")
{
ap = read.csv(annot_process,sep="\t")
......@@ -1928,6 +1948,15 @@ shinyServer(function(input, output,session) {
)
)
}
else if(file.exists(annot_process) && demodata !="..." && FileFormat == "fileBiom" )
{
res[[1]] = fluidRow(
box(title="Download .zip file",width = 3, status = "success",
downloadButton('Download_masque_zip_home', 'Download the results'),
tags$style(type='text/css', "#Download_masque_zip_home { width:100%;}")
)
)
}
}
}
......@@ -2115,7 +2144,6 @@ shinyServer(function(input, output,session) {
output$ExportBiom <- downloadHandler(
filename = function() { 'SHAMAN_data.biom' },
#write_biom doesn't handle properly the sample metadata
content = function(file){
write_biom(make_biom(dataMergeCounts()$CT_noNorm, sample_metadata=values$TargetWorking[,-1],
observation_metadata=dataInput()$data$taxo_biom), file)}
......
......@@ -88,7 +88,7 @@ function(request) {
box(
title = "What's new in SHAMAN", width = NULL, status = "primary",
div(style = 'overflow-y: scroll; height: 550px',
addNews("August 14th 2019","Major update","We performed a global improvement of SHAMAN. The application is now migrated to R 3.6.1. We implemented several visualization for differential analysis and network of abundance. We hope you will enjoy this main update."),
addNews("August 14th 2019","Major update","We performed a global improvement of SHAMAN. The application is now migrated to R 3.6.1. We implemented several visualization for differential analysis and network of abundance. We hope you will enjoy this new version."),
addNews("April 11th 2019","Debugging","We fixed few bugs in export system and scatterplot visualisation system."),
addNews("March 28th 2019","Packaging","SHAMAN is now available as packrat package. Take a look at download section."),
addNews("April 17th 2018","Bioinformatics","The bioinformatic treatment offers a larger access to parameters. We also worked a lot on the documentation."),
......@@ -228,15 +228,17 @@ function(request) {
mainPanel(div(style = 'max-width: 900px',"docker pull aghozlane/shaman"),width=4,class="mainwell")
),
tabPanel("R install with Packrat",
p("SHAMAN is available for R=3.6.1. Packrat framework installation allow an easy installation of all the dependencies. Of note, raw data submission is not possible with this version. First, install R 3.1.2 as local install as follow:",style = "font-family: 'times'; font-si16pt"),
p("SHAMAN is available for R=3.6.1. Packrat framework allow an easy installation of all the dependencies. First, install R 3.1.2 as local install as follow:",style = "font-family: 'times'; font-si16pt"),
mainPanel(div(style = 'max-width: 900px; word-wrap: break-word;',"# Install R 3.6.1", br(),
#"wget https://pbil.univ-lyon1.fr/CRAN/src/base/R-3/R-3.1.2.tar.gz && tar -zxf R-3.1.2.tar.gz",br(),"mkdir /some/location/r_bin",br(),
#"cd R-3.1.2/",br(), "./configure --prefix=/some/location/r_bin/", br(), "make && make install", br(), "/some/location/r_bin/bin/R", br(),
#"install.packages(c('devtools', 'codetools', 'lattice', 'MASS', 'survival', 'packrat'))", br(),
#"library(devtools)",br(),"devtools::install_github(c('aghozlane/nlme'))", br(),
"# Download SHAMAN package",br(),"wget ftp://shiny01.hosting.pasteur.fr/pub/shaman_20190809.tar.gz"),width=9,class="mainwell"),
p("This installation will not interact with other R installation. Then, you can install SHAMAN with packrat:"),
mainPanel(div(style = 'max-width: 900px; word-wrap: break-word;',"# Install SHAMAN dependencies",br(),
p("Of note, raw data submission is not possible with this version. Then, you can install SHAMAN with packrat:"),
mainPanel(div(style = 'max-width: 900px; word-wrap: break-word;',
"# Download SHAMAN package",br(),"wget ftp://shiny01.hosting.pasteur.fr/pub/shaman_20190809.tar.gz", br(),
"# Install SHAMAN dependencies",br(),
"mkdir /some/location/shaman", br(), "/some/location/r_bin/bin/R",br(),
"install.packages(\"packrat\")",br(),"packrat::unbundle(\"shaman_20190809.tar.gz\", \"/packrat/location/shaman\")"), width=9,class="mainwell"),
p("Now you can run SHAMAN:"),
......@@ -521,7 +523,7 @@ function(request) {
selectInput("FileFormat","",c("Count table & taxonomy (*.csv or *.tsv)"="fileCounts","BIOM file"="fileBiom","Project number"="projnum"),selected="fileCounts"),
conditionalPanel(condition="input.FileFormat=='fileCounts'",
checkboxInput("NoTaxoFile","No taxonomy table",value=FALSE),
selectInput("DemoDataset",h6(strong('Or select a dataset')),c("..."="...","ZymoBIOMICS mock 16S"="30a47fca2dc3"),selected="..."),
selectInput("DemoDataset",h6(strong('Or select a dataset')),c("..."="...","ZymoBIOMICS mock 16S"=c("30a47fca2dc3|Volant et al. 2019 in review")),selected="..."),
receiveSweetAlert(messageId = "DemoDataset")
),
conditionalPanel(condition="input.FileFormat=='projnum'",
......@@ -562,19 +564,19 @@ function(request) {
)
)
),
conditionalPanel(condition="input.FileFormat=='fileBiom'",
#&&is.null(input.password_home)
conditionalPanel(condition="input.FileFormat=='fileBiom'&&input.DemoDataset=='...'",
box(title="Load the BIOM file",width = 3, status = "primary", solidHeader = TRUE,collapsible = FALSE,
fileInput('fileBiom', h5(strong('Select your file')),width="100%",accept = c(".biom")),
tags$script('$( "#fileBiom" ).on( "click", function() { this.value = null; });')
)
),
conditionalPanel(condition="input.FileFormat=='projnum'",
conditionalPanel(condition="input.FileFormat=='projnum'||input.DemoDataset!='...'",
uiOutput("Project_box_home")
),
conditionalPanel(condition="input.FileFormat!='projnum'",
#&&is.null(input.password_home)
conditionalPanel(condition="input.FileFormat!='projnum'&&input.DemoDataset=='...'||input.FileFormat=='fileCounts'",
box(title="Load phylogenetic tree (optional)",width = 3, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed = TRUE,
fileInput('fileTree', h6(strong('Select your file (tree)')),width="100%"),
tags$script('$( "#fileTree" ).on( "click", function() { this.value = null; });')
......
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