inst/app/code/ui/upload.omics.table.R

fluidPage(
    titlePanel("Omics File"),
    
    # Sidebar layout with input and output definitions ----
    sidebarLayout(
        
        # Sidebar panel for inputs ----
        sidebarPanel(
            # textOutput("loadedMappingPairs"),
            checkboxInput("ShowDemoOmics", "Download Demo Omics Data" ),
            conditionalPanel(
                # condition = "input.ShowDemoOmics == 'useDemo'",
                condition = "input.ShowDemoOmics"
                ,conditionalPanel(
                    # condition = "input.preData == 'IFNg'"
                    condition = "input.usePathways == 'UsePrePathways' || input.usePathways == 'enrichAnalysis'"
                    ,p(
                        HTML("<p style='color:DodgerBlue;'>IFNg KO mice dataset:</p>")
                        ,"
                        This table includes the gene expression fold change data of an RNA-Seq experiment comparing two groups:
                        ",br(),"
                        IFNg KO mice and wild type mice.
                        ",br(),
                        HTML("<ol>",
                            "<li style='color:DodgerBlue;'>
                                Species: mouse (KEGG code: 'mmu')
                            </li >
                             ",
                            "<li style='color:DodgerBlue;'>
                                Molecule ID type: ENSEMBL GENE
                            </li>",
                        "</ol>"
                        ),
                        "
                        The experiment and data processing was described in this work: Greer, Renee L., Xiaoxi Dong, et al.
                        'Akkermansia muciniphila mediates negative effects of IFNG on glucose metabolism.'
                        Nature communications 7 (2016): 13329. " 
                        ) 
                ),
                conditionalPanel( 
                    # condition = "input.preData == 'cancer'"
                    condition = "input.usePathways == 'userSBGN'"
                    ,p( 
                        HTML("<p style='color:DodgerBlue;'>Breast cancer dataset:</p>")
                        ,"
                        This is a fold change table from a breast cancer study (Emery et al, 2009)
                        downloaded from Gene Expression Omnibus (GEO).
                        ",br(),"
                        The Dataset is pre-processed using FARMS method and includes 3 patient cases,
                        each with HN (histologically normal) and DCIS (ductal carcinoma in situ) RMA samples.
                        ",br(),"
                        The three columns are gene expression fold changes of three pairs of 
                        cancer (DCIS) vs normal (HN) samples from three patients, respectively." 
                        ,HTML("<ol>",
                                "<li style='color:DodgerBlue;'>
                                    Species: human (KEGG code: 'hsa')
                                </li>
                                 ",
                                "<li style='color:DodgerBlue;'>
                                    Molecule ID type: ENTREZ GENE ID
                                </li>",
                            "</ol>")
                       
                        )
                ),
                downloadButton("Example", "Download Example Table",  style="color: #fff; background-color: #5B90BF; border-color: #2e6da4")
            ),
            
            hr(style = "border-top: 1px solid #8c8b8b"),
            # h3("Input 1: choose omics file"),
            box(
                id = "OmicsFileInputBox",
                title = "Input 1: choose omics file",
                status = "primary",
                # solidHeader = FALSE,
                solidHeader = FALSE,
                collapsible = FALSE,
                collapsed = FALSE,
                width = 30,
            # Input: Select a file ----
                fileInput("file1", "",
                          multiple = FALSE
                )
            ),
            # h3("Input 2: species/organism of the Omics molecules"),
            box(
                id = "OmicsSpeciesInputBox",
                title = "Input 2: species/organism of the Omics molecules",
                status = "primary",
                # solidHeader = FALSE,
                solidHeader = FALSE,
                collapsible = FALSE,
                collapsed = FALSE,
                width = 30
                ,selectInput("org",
                               label = "",
                               c(
                                    mouse = "mmu" 
                                    ,human = "hsa"
                                    )
                )
            ),
            # h3("Input 3: omics molecule ID type"),
            box(
                id = "OmicsIdInputBox",
                title = "Input 3: omics molecule ID type",
                status = "primary",
                # solidHeader = FALSE,
                solidHeader = FALSE,
                collapsible = FALSE,
                collapsed = FALSE,
                width = 30,
                selectInput("OmicsIdType",
                               label = "",
                               c(
                                    "ENSEMBL" 
                                    ,"ENTREZID"
                                    )
                )
            ),
            h4(""),
            #######################
            checkboxInput("ReadTableParaOmicsIn", "Read table parameters", FALSE),
            conditionalPanel(
                condition = "input.ReadTableParaOmicsIn"
            # box(
            #     id = "dataIntro",
            #     title = "Read table parameters",
            #     status = "primary",
            #     solidHeader = TRUE,
            #     collapsible = TRUE,
            #     collapsed = TRUE,
            #     width = 30
            # Input: Checkbox if file has header ----
                ,checkboxInput("header", "Header", TRUE),
                # Input: Select separator ----
                radioButtons("sep", "Separator",
                             choices = c(
                                         Tab = "\t",
                                         Comma = ",",
                                         Semicolon = ";"
                                         ),
                             selected = "\t"),
                
                # Input: Select quotes ----
                radioButtons("quote", "Quote",
                             choices = c(None = "",
                                         "Double Quote" = '"',
                                         "Single Quote" = "'"),
                             selected = '"'),
                radioButtons("disp", "Display",
                             choices = c(Head = "head",
                                         All = "all"),
                             selected = "head")
            ),
            # Horizontal line ----
            
            conditionalPanel(
                # condition = "input.IdMappingSource == 'useUserMapping'"
                condition = "input.usePathways == 'userSBGN'"
                #################
                # id mapping file
                # ,h3("Input 4: choose ID mapping file")
                ,box(
                    id = "UploadMappingBox",
                    title = "Input 4: choose ID mapping file",
                    status = "primary",
                    # solidHeader = FALSE,
                    solidHeader = FALSE,
                    collapsible = FALSE,
                    collapsed = FALSE,
                    width = 30
                    ,fileInput("uploadMapping", "",
                              multiple = FALSE )
                    ,downloadButton("exampleIdMapping","Example ID mapping table",  style="color: #fff; background-color: #5B90BF; border-color: #2e6da4")
                    # Input: Checkbox if file has header ----
                    ,checkboxInput("ReadTableParaIdMappingIn", "Read table parameters", FALSE),
                    conditionalPanel(
                        condition = "input.ReadTableParaIdMappingIn"
                        ,checkboxInput("headerMapping", "Header", TRUE)
                        
                        # Input: Select separator ----
                        ,radioButtons("sepMapping", "Separator",
                                     choices = c(
                                                 Tab = "\t",
                                                 Comma = ",",
                                                 Semicolon = ";"
                                                 ),
                                     selected = "\t")
                        
                        # Input: Select quotes ----
                        ,radioButtons("quoteMapping", "Quote",
                                     choices = c(None = "",
                                                 "Double Quote" = '"',
                                                 "Single Quote" = "'"),
                                     selected = '"')
                    )
                )
            )
            ,tags$hr()
            # Input: Select number of rows to display ----
            ,actionButton(inputId = "uploadOmics"
                   ,label = "Upload and convert to SBGN glyph IDs"
                   ,icon = icon("cloud-upload")
                   ,style="color: #fff; background-color: #337ab7; border-color: #2e6da4"
                   )
            
        ),
        
        # Main panel for displaying outputs ----
        mainPanel(
            # Output: Data file ----
            conditionalPanel(
                # condition = "input.ShowDemoOmics == 'useDemo'",
                condition = "input.ShowDemoOmics",
                hr(class="sidebarsplitter"),
                textOutput("DemoOmicsDataTitle"),
                div(style = "padding-left: 15px;color: var(--neutral2);",
                DT::dataTableOutput("demoDataTable"))
                ,tags$head(tags$style("#DemoOmicsDataTitle{color: DodgerBlue;
                                 font-size: 20px;
                                 font-style: italic;
                                 }"
                                )
                            )
            ),
            # div(style = "padding-left: 15px;color: var(--neutral2);",
            #     h3("Omics data with original molecule IDs")),
            # ,tags$head(tags$style("#originalOmicsTitle{color: DodgerBlue;
            #                  font-size: 20px;
            #                  font-style: italic;
            #                  }"
            #                 )
            #             )
            box(
                id = "uploadedOmicsBox",
                title = "Omics data with original molecule IDs",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = FALSE,
                width = 30,
                textOutput("RunLoadOriginalTable"),
                textOutput("RunResetOriginalTable")
                ,textOutput("RunLoadMappingTable"),
                textOutput("RunGenGlyphIdTable")
                
                ,textOutput("originalOmicsTitle")
                ,DT::dataTableOutput("OriginalOmics")
            )
            
            # ,div(style = "padding-left: 15px;color: var(--neutral2);",
            #     h3("Uploaded ID mapping table")),
            # ,tags$head(tags$style("#uploadedMappingTitle{color: DodgerBlue;
            #                  font-size: 20px;
            #                  font-style: italic;
            #                  }"
            #                 )
            #             )
            ,box(
                id = "uploadedMappingBox",
                title = "ID mapping table",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = FALSE,
                width = 30,
                textOutput("uploadedMappingTitle"),
                DT::dataTableOutput("uploadedMapping")
            )
            
            # ,hr(class="sidebarsplitter")
            # ,div(style = "padding-left: 15px;color: var(--neutral2);",
            #     h3("Omics data with SBGN-ML file glyph IDs: "),
            #     h3("Please select the correct 'Omics molecule ID type', 'species' and 'Source of ID mapping table'")),
            # ,tags$head(tags$style("#GlyphIdOmicsTitle{color: DodgerBlue;
            #                  font-size: 20px;
            #                  font-style: italic;
            #                  }"
            #                 )
            #             )
            ,box(
                id = "OmicsDataGlyphIdBox",
                title = "Omics data with SBGN glyph ID",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = FALSE,
                width = 30,
                
                textOutput("GlyphIdOmicsTitle"),
                DT::dataTableOutput("GlyphIdOmics")
            )
        )
        
    )
)
chemokine/OmicsSBGN documentation built on June 27, 2019, 7:52 p.m.