inst/app/code/ui/overlay.omics.R

pageWithSidebar(
    headerPanel(''),
    sidebarPanel(
        conditionalPanel(
            condition = "input.usePathways == 'UsePrePathways'"
            ,selectizeInput(
                'pathway.id'
                ,'Select one pathway (you can search here with keywords)'
                ,choices = get.pathway.candidates()
                ,options = list(create = TRUE)
                ,selected = "R-HSA-877300"
            )
        )
        ,conditionalPanel(
            condition = "input.usePathways == 'userSBGN'"
            ,textOutput("upSBGN")
        )
        ,conditionalPanel(
            condition = "input.usePathways == 'enrichAnalysis'"
            ,h4("Using pathways from enrichment analysis")
            ,h4("Selected pathways are shown on the left panel")
            ,uiOutput("selectedPathwaysOverlayPage")
        )
        ,box(
            id = "graphParams",
            title = "Graph Parameters",
            status = "primary",
            solidHeader = TRUE,
            collapsible = TRUE,
            collapsed = TRUE,
            width = 30
            ,box(
                id = "ColPanel",
                title = "Color Panel",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = TRUE,
                width = 30
                ,numericInput('color.panel.scale', 'Color panel size', 1)
                ,column(5 ,numericInput('max.gene.value', 'Max gene value', 1) )
                ,column(5 ,colourpicker::colourInput(inputId = "col.gene.high", label = "Max gene color", value = "red") )
                ,column(5 ,numericInput('mid.gene.value', 'Mid gene value',  0))
                ,column(5 ,colourpicker::colourInput(inputId = "col.gene.mid", label = "Mid gene color", value = "gray"))
                ,column(5 ,numericInput('min.gene.value', 'Min gene value', -1))
                ,column(5 ,colourpicker::colourInput(inputId = "col.gene.low", label = "Min gene color", value = "green"))
                ,numericInput('space.between.color.panel.and.entity', 'space.between.color.panel.and.entity', 100)
            )
            
            ,selectInput('node.sum', 'Summary stat: when multiple molecules mapped to the same glyph'
                         ,choices = c(
                             "mean" = "mean"
                             ,"median" = "median"
                             ,"min" = "min"
                             ,"max" = "max"
                         )
                         ,selected = "mean"
             )
            ,box(
                id = "Labels",
                title = "Labels",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = TRUE,
                width = 30
                ,selectizeInput(
                    'label.spliting.string'
                    ,'Label spliting strings'
                    , choices = c("-" = "-"
                                  ,"_" = "_"
                                  ,"space" = " "
                                  ,"=" = "="
                                  ,"," = ","
                                  ,"Don't split" = "no split"
                                  ,"Split at any string" = "any"
                                  ),
                    options = list(create = TRUE)
                    , multiple = TRUE
                    ,selected = c("-","_"," ")
                )
                ,numericInput('font.size', 'Font size', 2)
                ,numericInput('status.node.font.scale', 'Auxiliary glyph font size', 3)
                ,numericInput('font.size.scale.gene', 'Macromolecule font size', 3)
                ,numericInput('font.size.scale.cpd', 'Compound font size', 3)
                
                
                ,h4("All glyphs"
                    ,style="background-color:#B9F9B3;")
                ,numericInput('text.length.factor.macromolecule', 'Label width: macromolecule', 0.8)
                
                
                ,h4("Process glyphs"
                    ,style="background-color:#B9F9B3;")
                ,numericInput('logic.node.font.scale', 'Logic nodes font size', 6)
                
                
                ,h4("Complexes"
                    ,style="background-color:#B9F9B3;")
                ,numericInput('text.length.factor.complex', 'Label width: complex', 3)
                ,numericInput('complex.compartment.label.margin', 'Complex/compartment label vertical shift', 8)
                ,radioButtons('ifScaleComplexFontSize', 'If scale complex font size for bigger complex'
                             ,choices = c(
                                 "TRUE" = 'TRUE'
                                 ,"FALSE" = 'FALSE'
                             )
                             ,selected = FALSE
                 )
                ,conditionalPanel(
                    condition = "input.ifScaleComplexFontSize == 'TRUE'"
                    # condition = "input.ifScaleCompartmentFontSize"
                    ,numericInput('node.if.scale.complex.font.size', 'Scaling factor', 0.058)
                )
                ,conditionalPanel(
                    condition = "input.ifScaleComplexFontSize == 'FALSE'"
                    ,numericInput('font.size.scale.complex', 'Complex font size', 1.5)
                )
                
                
                
                ,h4("Compartments"
                    ,style="background-color:#B9F9B3;")
                # ,selectInput('ifScaleCompartmentFontSize', 'if.scale.compartment.font.size'
                ,numericInput('text.length.factor.compartment', 'Label width: compartment', 2)
                ,radioButtons('ifScaleCompartmentFontSize', 'If scale compartment font size for bigger compartments'
                             ,choices = c(
                                 "TRUE" = 'TRUE'
                                 ,"FALSE" = 'FALSE'
                             )
                             ,selected = TRUE
                 )
                ,conditionalPanel(
                    condition = "input.ifScaleCompartmentFontSize == 'TRUE'"
                    # condition = "input.ifScaleCompartmentFontSize"
                    ,numericInput('node.width.adjust.factor.compartment', 'Scaling factor', 0.058)
                )
                ,conditionalPanel(
                    condition = "input.ifScaleCompartmentFontSize == 'FALSE'"
                    ,numericInput('font.size.scale.compartment', 'Compartment font size', 1.5)
                )
                
                
            )
            ,box(
                id = "opacity",
                title = "Opacity",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = TRUE,
                width = 30
                ,numericInput('auxiliary.opacity', 'Auxiliary glyphs opacity', 1)
                ,numericInput('compartment.opacity', 'Compartment opacity', 0.7)
            )
                
            ,box(
                id = "Edges",
                title = "Edge parameters",
                status = "primary",
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsed = TRUE,
                width = 30
                ,numericInput('inhibition.edge.end.shift', 'Inhibition edge end shift', 1)
                ,numericInput('edge.tip.size', 'edge.tip.size', 6)
            )
        ) 
        # run SBGNview button
        ,actionButton(inputId = "run.OmicsSBGN"
               ,label = "Run", icon = icon("play"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
        
        ##########################################
    ),
    mainPanel(
        # uiOutput('downloadSvgButton'),
        h4('', id = "svgPanel"),
        # sliderInput("height", label = "Image Height", min = 10, max = 3000, value = 800)
        # ,sliderInput("width", label = "Image Width", min = 10, max = 3000, value = 800)
        sliderInput("zoom", label = "Image zoom", min = 10, max = 3000, value = 800)
        # ,column(5
            ,downloadButton("downloadImg", "Download SVG Image", style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
        # ),
        h4(''),
        conditionalPanel(
            condition = "input.usePathways == 'UsePrePathways' || input.usePathways == 'enrichAnalysis'"
            # ,column(5
            ,downloadButton("downloadSBGN", "Download SBGN-ML file", style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
            # )
            
            ,h4('')
            ,conditionalPanel(
                condition = "input.usePathways == 'enrichAnalysis'"
                # ,column(10
                    ,actionButton("nextImg", "Next pathway"
                              ,icon = icon("arrow-circle-right" ,lib = "font-awesome")
                              ,style="color: #fff; background-color: #337ab7
                              ; border-color: #2e6da4
                              ;float:right
                              ")
                    ,actionButton("previousImg", "Previous pathway"
                              ,icon = icon("arrow-circle-left" ,lib = "font-awesome")
                              ,style="color: #fff; background-color: #337ab7
                              ; border-color: #2e6da4
                              ;float:right
                              ")
                # )
            )
        ),
        br(),
        textOutput("currentViewPathway"),
        imageOutput("image"
              ,
              click = "image_click",
              hover = hoverOpts(
                  id = "image_hover",
                  delay = 500,
                  delayType = "throttle"
              ),
              brush = brushOpts(id = "image_brush")
        )
        
        # , tableOutput('table')
    )
)
chemokine/OmicsSBGN documentation built on June 27, 2019, 7:52 p.m.