Commit 1bf5e36e authored by Amine  GHOZLANE's avatar Amine GHOZLANE
Browse files

Start the interface for raw data push

parent e59af4d0
......@@ -164,18 +164,4 @@ if(!require(PhyloTreeMetaR)){
# library(plotly)
# }
# Allow to upload 50M files only shaman server
if(Sys.info()["nodename"] == "ShinyPro"){
options(shiny.maxRequestSize=50*1024^2)
}else{
# No limit
options(shiny.maxRequestSize=500000000000000*1024^2)
}
source("Rfunctions/Data_Management.R")
source("Rfunctions/Stat_Model.R")
source("Rfunctions/DiagPlot.R")
source("Rfunctions/VisuPlot.R")
source("Rfunctions/CompPlot.R")
source("Rfunctions/DiffTable.R")
#' Choose a Folder Interactively (Mac OS X)
#'
#' Display a folder selection dialog under Mac OS X
#'
#' @param default which folder to show initially
#' @param caption the caption on the selection dialog
#'
#' @details
#' Uses an Apple Script to display a folder selection dialog. With \code{default = NA},
#' the initial folder selection is determined by default behavior of the
#' "choose folder" Apple Script command. Otherwise, paths are expanded with
#' \link{path.expand}.
#'
#' @return
#' A length one character vector, character NA if 'Cancel' was selected.
#'
if (Sys.info()['sysname'] == 'Darwin') {
choose.dir = function(default = NA, caption = NA) {
command = 'osascript'
args = '-e "POSIX path of (choose folder{{prompt}}{{default}})"'
if (!is.null(caption) && !is.na(caption) && nzchar(caption)) {
prompt = sprintf(' with prompt \\"%s\\"', caption)
} else {
prompt = ''
}
args = sub('{{prompt}}', prompt, args, fixed = T)
if (!is.null(default) && !is.na(default) && nzchar(default)) {
default = sprintf(' default location \\"%s\\"', path.expand(default))
} else {
default = ''
}
args = sub('{{default}}', default, args, fixed = T)
suppressWarnings({
path = system2(command, args = args, stderr = TRUE)
})
if (!is.null(attr(path, 'status')) && attr(path, 'status')) {
# user canceled
path = NA
}
return(path)
}
} else if (Sys.info()['sysname'] == 'Linux') {
choose.dir = function(default = NA, caption = NA) {
command = 'zenity'
args = '--file-selection --directory --title="Choose a folder"'
suppressWarnings({
path = system2(command, args = args, stderr = TRUE)
})
#Return NA if user hits cancel
if (!is.null(attr(path, 'status')) && attr(path, 'status')) {
# user canceled
return(default)
}
#Error: Gtk-Message: GtkDialog mapped without a transient parent
if(length(path) == 2){
path = path[2]
}
return(path)
}
}
#' Directory Selection Control
#'
#' Create a directory selection control to select a directory on the server
#'
#' @param inputId The \code{input} slot that will be used to access the value
#' @param label Display label for the control, or NULL for no label
#' @param value Initial value. Paths are exapnded via \code{\link{path.expand}}.
#'
#' @details
#' This widget relies on \link{\code{choose.dir}} to present an interactive
#' dialog to users for selecting a directory on the local filesystem. Therefore,
#' this widget is intended for shiny apps that are run locally - i.e. on the
#' same system that files/directories are to be accessed - and not from hosted
#' applications (e.g. from shinyapps.io).
#'
#' @return
#' A directory input control that can be added to a UI definition.
#'
#' @seealso
#' \link{updateDirectoryInput}, \link{readDirectoryInput}, \link[utils]{choose.dir}
directoryInput = function(inputId, label, value = NULL) {
if (!is.null(value) && !is.na(value)) {
value = path.expand(value)
}
tagList(
singleton(
tags$head(
tags$script(src = 'js/directory_input_binding.js')
)
),
div(
class = 'form-group directory-input-container',
shiny:::`%AND%`(label, tags$label(label)),
div(
span(
class = 'col-xs-9 col-md-11',
style = 'padding-left: 0; padding-right: 5px;',
div(
class = 'input-group shiny-input-container',
style = 'width:100%;',
div(class = 'input-group-addon', icon('folder-o')),
tags$input(
id = sprintf('%s__chosen_dir', inputId),
value = value,
type = 'text',
class = 'form-control directory-input-chosen-dir',
readonly = 'readonly'
)
)
),
span(
class = 'shiny-input-container',
tags$button(
id = inputId,
class = 'btn btn-default directory-input',
'...'
)
)
)
)
)
}
#' Change the value of a directoryInput on the client
#'
#' @param session The \code{session} object passed to function given to \code{shinyServer}.
#' @param inputId The id of the input object.
#' @param value A directory path to set
#' @param ... Additional arguments passed to \link{\code{choose.dir}}. Only used
#' if \code{value} is \code{NULL}.
#'
#' @details
#' Sends a message to the client, telling it to change the value of the input
#' object. For \code{directoryInput} objects, this changes the value displayed
#' in the text-field and triggers a client-side change event. A directory
#' selection dialog is not displayed.
#'
updateDirectoryInput = function(session, inputId, value = NULL, ...) {
if (is.null(value)) {
value = choose.dir(...)
}
session$sendInputMessage(inputId, list(chosen_dir = value))
}
#' Read the value of a directoryInput
#'
#' @param session The \code{session} object passed to function given to \code{shinyServer}.
#' @param inputId The id of the input object
#'
#' @details
#' Reads the value of the text field associated with a \code{directoryInput}
#' object that stores the user selected directory path.
#'
readDirectoryInput = function(session, inputId) {
session$input[[sprintf('%s__chosen_dir', inputId)]]
}
# Allow to upload 50M files only shaman server
if(Sys.info()["nodename"] == "ShinyPro"){
options(shiny.maxRequestSize=50*1024^2)
}else{
# No limit
options(shiny.maxRequestSize=500000000000000*1024^2)
}
source('LoadPackages.R')
source("css/owncss.R")
source("Rfunctions/Data_Management.R")
source("Rfunctions/Stat_Model.R")
source("Rfunctions/DiagPlot.R")
source("Rfunctions/VisuPlot.R")
source("Rfunctions/CompPlot.R")
source("Rfunctions/DiffTable.R")
source('Rfunctions/directoryInput.R')
source('LoadPackages.R')
shinyServer(function(input, output,session) {
hide(id = "loading-content", anim = TRUE, animType = "fade",time=1.5)
......@@ -10,6 +8,8 @@ shinyServer(function(input, output,session) {
##
#####################################################
## Create base for contrast
rand = floor(runif(1,0,1e9))
namesfile = tempfile(pattern = "BaseContrast", tmpdir = tempdir(), fileext = "")
......@@ -605,6 +605,25 @@ shinyServer(function(input, output,session) {
})
## Select a folder (for MASQUE)
observeEvent(
ignoreNULL = TRUE,
eventExpr = {
input$directory
},
handlerExpr = {
if (input$directory > 0) {
# condition prevents handler execution on initial app launch
# launch the directory selection dialog with initial path read from the widget
path = choose.dir(default = readDirectoryInput(session, 'directory'))
# update the widget value
updateDirectoryInput(session, 'directory', value = path)
}
}
)
observeEvent(input$deleteRows,{
if (!is.null(input$DataTarget_rows_selected)) {
......
options(shiny.sanitize.errors = FALSE)
source("css/owncss.R")
source("Rfunctions/Data_Management.R")
if (!require(devtools)) {
install.packages('devtools')
library(devtools)
}
if(!require(treeWeightD3)){
devtools::install_github('pierreLec/treeWeightD3')
library(treeWeightD3)
}
if (!require(scatterD3)) {
devtools::install_github('aghozlane/scatterD3')
library(scatterD3)
}
if(!require(shinydashboard)){
devtools::install_github('aghozlane/shinydashboard')
library(shinydashboard)
}
if(!require(shinythemes)){
install.packages("shinythemes")
library(shinythemes)
}
if(!require(shinyjs)){
install.packages("shinyjs")
library(shinyjs)
}
function(request) {
sidebar <- dashboardSidebar(
useShinyjs(),
......@@ -42,6 +13,7 @@ sidebar <- dashboardSidebar(
menuItem("Home", tabName = "Home", icon = icon("home")),
menuItem("Tutorial", tabName = "Tutorial", icon = icon("book")),
menuItem("Download/Install", tabName = "Download", icon = icon("download")),
menuItem("Raw data", tabName = "RawData", icon = icon("upload")),
menuItem("Upload your data", tabName = "Upload", icon = icon("upload")),
# bookmarkButton(),
menuItemOutput("dymMenu"),
......@@ -248,7 +220,52 @@ body <- dashboardBody(
)
)
),
tabItem(tabName = "RawData",
tags$style(type='text/css', ".well { max-width: 20em; }"),
fluidRow(
HTML('<center><h1>MASQUE : Metagenomic Analysis with a Quantitative pipeline</h1></center>'),
column(width=8,
div(style="background-color: white; padding-left:20px;",
HTML('
<h2>Introduction</h2>
<p>The aim of this part is to provide an easy cluster interface to perform <b>targeted metagenomic analysis</b>. This analysis will be done using the MASQUE pipeline which allows :</p>
<ul>
<li>to analyse 16S/18S/23S/28S/ITS data. It builds a count matrix, an annotation table and a phylogeny of the OTU.</li>
<li>to perform to use a set of parameters already tested on serveral projects for the numerous software used to perform the clustering and the annotation.</li>
<li>to perform an "uptodate" analysis considering the scientific litterature.</li>
</ul>
<hr></hr>
<h2>Process</h2>
<p>We follow the recommandation described by Robert C. Edgar in <a href="http://www.nature.com/nmeth/journal/v10/n10/full/nmeth.2604.html" target="_blank" >Uparse</a> supplementary paper.<br>
The clustering process in MASQUE is performed as the following :<br>
1. Read quality control<br>
2. Dereplication<br>
3. Chimera filtering<br>
4. Clustering<br>
5. Realignment/mapping<br>
6. Taxonomical annotation of the OTU<br>
7. Quality check of every step </p>
<p>You can find more information in the presentation <a href="/aghozlane/masque/blob/master/tp/Targeted_metagenomics.pdf">here</a>. We try to describe the idea behind each step and a complete TP to do it on your own.</p>'
)
#
#
# <\ui> to analyse 16S/18S/23S/28S/ITS data. It builds a count matrix, an annotation table and a phylogeny of the OTU.
# to perform to use a set of parameters already tested on serveral projects for the numerous software used to perform the clustering and the annotation.
# to perform an uptodate analysis considering the scientific litterature."
))),
fluidRow(directoryInput('directory', label = 'select a directory')),
br(),
fluidRow(
)
),
tabItem(tabName = "Upload",
tags$style(type='text/css', ".well { max-width: 20em; }"),
fluidRow(
......
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