为什么我在RShiny的搜索栏中找不到该商品?

ffscu2ro  于 2023-03-20  发布在  其他
关注(0)|答案(1)|浏览(194)

搜索栏无法完成预期功能。例如,我尝试传递一些词,如'gsea''bioinformatics''gtexportal',因为这些是已完成的一些检查,并出现在我的应用程序中的不同检查中。然而,当我搜索它们时,搜索栏无法工作。
1.是否有解决此问题的方法?是否有更简单的解决方案?希望我能找到更简单的解决方案
所有的信息都在html文件中。
因为我确实收到了如下错误:

Listening on http://127.0.0.1:3668
Warning: Error in $: Can't read output 'gene_links'
  54: <Anonymous>
  53: signalCondition
  52: signal_abort
  51: rlang::abort
  50: $.shinyoutput
  47: observe [#26]
  46: <observer>
   3: runApp
   2: print.shiny.appobj
   1: <Anonymous>
Warning: Error in $: Can't read output 'genomic_links'
  53: <Anonymous>
  52: signalCondition
  51: signal_abort
  50: rlang::abort
  49: $.shinyoutput
  47: observe [#35]
  46: <observer>
   3: runApp
   2: print.shiny.appobj
   1: <Anonymous>

可能是因为在服务器中,我已经添加了来自每个项目'gene''genomic'的html链接,但它无法读取吗?
下面是一个可重现的示例:

library(shiny)

ui <- shiny::fluidPage(
  theme = shinythemes::shinytheme("united"),

  tags$head(tags$style(".navbar {margin-bottom: 0px;}")),

  tags$head(
    tags$style(".container-fluid {padding-right: 0px; padding-left: 0px;}")
  ),

  navbarPage(
    title = div(
      img(src = "www/bftb_logo_v8_bare.png", height = "30px"),
      "AZ Oncology Bioinformatics Toolbox"
    ),
    windowTitle = "BFTB Landing Page",

    tabPanel("Toolbox", icon = icon("wrench"), disable = TRUE,
             shinydashboard::dashboardPage(
               header = shinydashboard::dashboardHeader(title = "   ", titleWidth = 300, disable = TRUE),
               shinydashboard::dashboardSidebar(
                 width = 300 ,
                 textInput("search_term", "Search for apps:"),
                 actionButton("search_button", "Search"),
                 shinydashboard::sidebarMenu(
                   shinydashboard::menuItem(
                     "Tools",
                     tabName = "tools_app",
                     icon = icon("wrench")
                   ),
                   shinydashboard::menuSubItem(
                     "Gene Expression/Signature/Pathways",
                     tabName = "gene_app",
                     icon = icon("chart-line")
                   ),
                   shinydashboard::menuSubItem(
                     "Genomic",
                     tabName = "genomic_app",
                     icon = icon("universal-access")
                   )
                 )
               ),
               shinydashboard::dashboardBody(
                 shinydashboard::tabItems(
                   shinydashboard::tabItem("tools_app", mod_tools_path_ui("tools_path_ui_1")),
                   shinydashboard::tabItem("gene_app", mod_gene_expressions_sign_path_ui("gene_expression_sign_path_ui")),
                   shinydashboard::tabItem("genomic_app", mod_genomic_ui("genomic_ui_1"))
                 )
               )
             )
    )
  )
)

server <- function(input, output){

  # rv <- reactiveValues(links = character())

  observe({

    links_gene <- mod_gene_expressions_sign_path_ui("gene_expression_sign_path_ui")$output$gene_links
    links_genomic <- mod_genomic_ui("genomic_ui_1")$output$genomic_links

    links_all <- c(links_genomic, links_gene)
    rv$links <- unique(links_all)
  })

  rv <- reactiveValues(links = character())

  output$gene_links <- reactive({

    output$gene_links <- reactive({
      htmltools::htmlTemplate("www/gene.html")
    })
  })
  observe({
    links <- unlist(output$gene_links())
    rv$links <- unique(c(rv$links, links))
  })

  output$genomic_links <- reactive({
    htmltools::htmlTemplate("www/genomic.html")
  })
  observe({
    links <- output$genomic_links()
    rv$links <- unique(c(rv$links, links))
  })

  observeEvent(input$search_button, {
    search_term <- input$search_term
    if (search_term != "") {
      links_filtered <- grep(search_term, rv$links, value = TRUE)
    } else {
      links_filtered <- rv$links
    }
    output$search_results <- renderUI({
      if (length(links_filtered) > 0) {
        tagList(
          lapply(links_filtered, function(link) {
            tags$a(href = link, link)
          })
        )
      } else {
        "No results found."
      }
    })
  })

}

shinyApp(ui = ui, server = server)

以下是导航栏上每个项目的模块:

mod_tools_path_ui <- function(id){
  ns <- NS(id)
  tagList(
    
  )
}

mod_gene_expressions_sign_path_ui <- function(id){
  ns <- NS(id)
  tagList(
    shinydashboard::tabItem(
      tabName = "gene_app",
      fluidRow(
        shiny::headerPanel(h3()),
        br(),
        htmltools::htmlTemplate("www/gene.html")
      )
    )
  )
  
}

mod_genomic_ui <- function(id){
  ns <- NS(id)
  tagList(
    shinydashboard::tabItem(
      tabName = "mutapp",
      fluidRow(
        shiny::headerPanel(h3()),
        br(),
        htmltools::htmlTemplate("www/genomic.html")
        )
      )
    )
}

下面是两个html文件:
1.用于基因模块

<!DOCTYPE html>
<html>
<head>
    <style>
        .container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
        }
        .box {
            width: 200px;
            height: 200px;
            margin: 10px;
            padding: 10px;
            border: 2px solid black;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
        }
        .box img {
            max-width: 50%;
            height: auto;
            margin-bottom: 10px;
        }
        .heading {
            font-size: 24px;
            font-weight: bold;
            text-align: center;
            margin-top: 50px;
        }
    </style>
</head>
<body>

    
    <h2 class="heading">Gene Expression Analysis</h2>
    <div class="container">
        <div class="box">
            <a href= "https://rstudio-connect.scp.astrazeneca.net/RStudio_FLAT/", target=”_blank” >
                <img src= "www/FluidigmAnalysisToolkit.v2.png" alt="Box 1">
                <p>Fludigm_Browser</p>
                <p>Perform Fluidigm data analysis</p>
            </a>
        </div>
        <div class="box">
            <a href="https://gtexportal.org/home", target=”_blank”>
                <img src="www/gtex.png" alt="Box 2">
                <p>GTEx Portal</p>
                <p>Gene expression in normal tissue</p>
            </a>
        </div>
        <div class="box">
            <a href="https://azcollaboration.sharepoint.com/sites/AZ208/SitePages/BioTuring.aspx?OR=Teams-HL&CT=1670593304007&clickparam =eyJBcHBOYW1lIjoiVGVhbXMtRGVza3RvcCIsIkFwcFZlcnNpb24iOiIyOC8yMjExMzAwNDEwMCIsIkhhc0ZlZGVyYXRlZFVzZXIiOmZhbHNlfQ%3D%3D", target=”_blank”>
                <img src="www/bioturing.svg" alt="Box 3">
                <p> BioTuring </p>
                <p>Platform for single-cell analysis and spatial transcriptomics exploration</p>
            </a>
        </div>
        <div class="box">
            <a href="http://informatics.medimmune.com/shiny/scope/", target=”_blank”>
                <img src="www/scope.svg" alt="Box 4">
                <p>SCOPE</p>
                <p>Explore available single cell RNA-Seq studies</p>
            </a>
        </div>
    </div>

    <h2 class="heading">Pathway Analysis</h2>
    <div class="container">
        <div class="box">
            <a href="https://clarivate.com/cortellis/learning/clarivate-for-astrazeneca1796/", target=”_blank”>
                <img src="www/clarivate.png" alt="Box 1">
                <p>Clarivate</p>
                <p>Pathway analysis tools from Cortellis including MetaCore</p>
            </a>
        </div>
        <div class="box">
            <a href="https://analysis.ingenuity.com/pa/launch.jsp">
                <img src= "www/ipa.png" alt="Box 2">
                <p>Ingenuity Pathway Analysis</p>
                <p>Analyze data using manually curated gene sets</p>
            </a>
        </div>
        <div class="box">
            <a href="https://astrazeneca.onramp.bio", target=”_blank”>
                <img src= "www/onramp.png" alt="Box 3">
                <p>OnRamp - Rosalind</p>
                <p>Interactively explore RNA-seq and ChIP-Seq data</p>
            </a>
        </div>
        <div class="box">
            <a href="http://software.broadinstitute.org/gsea/msigdb/index.jsp", target=”_blank”>
                <img src="www/gsea.png" alt="Box 4">
                <p>GSEA</p>
                <p>Gene set enrichment analysis</p>
            </a>
        </div>
    </div>

1.用于基因组模块

<!DOCTYPE html>
<html>
<head>
    <style>
        .container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
        }
        .box {
            width: 200px;
            height: 200px;
            margin: 10px;
            padding: 10px;
            border: 2px solid black;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
        }
        .box img {
            max-width: 35%;
            height: auto;
            margin-bottom: 10px;
        }
        .heading {
            font-size: 24px;
            font-weight: bold;
            text-align: center;
            margin-top: 50px;
        }
        .section {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            margin-top: 50px;
        }
    </style>
</head>
<body>

    <h2 class="heading">Mutation Profiling in Cancer</h2>
    <div class="container">
        <div class="box">
            <a href="https://cbioportal.rd.astrazeneca.net",target=”_blank” >
                <img src="www/azcbioportal.png" alt="Box 1">
                <p>AZcBioPortal</p>
                <p>Provides visualization, analysis and download of AstraZeneca genomics data sets</p>
            </a>
        </div>
        <div class="box">
            <a href="http://www.cbioportal.org", target=”_blank”>
                <img src="www/cbioportal.png" alt="Box 2">
                <p>cBioPortal</p>
                <p>Provides visualization, analysis and download of large-scale cancer genomics data sets (e.g. TCGA)</p>
            </a>
        </div>
    </div>

    <h2 class="heading">Functional Genomics Analysis</h2>
    <div class="section">
        <div class="box">
            <a href="https://oncologynibr.shinyapps.io/drive", target=”_blank” >
                <img src="www/drivedataportal.png" alt="Box 3">
                <p>DRIVE Data Portal</p>
                <p>Gene dependence profiles across cell lines (RNAi) from Novatis</p>
            </a>
        </div>
        <div class="box">
            <a href="https://dmc.depmap.org/portal/depmap", target=”_blank”>
                <img src="www/depmap.svg" alt="Box 4">
                <p>DepMap</p>
                <p>Cancer Dependency Map - RNAi and CRISPR screens</p>
            </a>
        </div>
        <div class="box">
            <a href="https://rstudio-connect.scp.astrazeneca.net/orthocheck/",target=”_blank” >
                <img src="www/nologo.svg" alt="Box 5">
                <p>OrthoCheck</p>
                <p>Identify homology between human kinase protein sequences and common model species. By Anton Martinsson and Bino John</p>
            </a>
        </div>
    </div>
    
        <h2 class="heading">Sequencing</h2>
    <div class="section">
        <div class="box">
            <a href= "https://rstudio-connect.scp.astrazeneca.net/ngs/apps/production_informatics/Dashboard/", target=”_blank”>
                <img src="www/solvebio_dashboard.png" alt="Box 3">
                <p>SolveBio Dashboard</p>
                <p>A summary list of patients by measurement technique in SolveBio vaults</p>
            </a>
        </div>
        <div class="box">
            <a href="https://ngs-report.apps.solvebio.net",target=”_blank” >
                <img src="www/ngs_reports.png" alt="Box 4">
                <p>NGS Reports</p>
                <p>Explore and visualize results from AZ sequencing projects</p>
            </a>
        </div>
        <div class="box">
            <a href="http://astrazeneca.solvebio.com", target=”_blank”>
                <img src="www/solvebio.png" alt="Box 4">
                <p>SolveBio</p>
                <p>SolveBio is a data warehouse of AZ internal genomic data</p>
            </a>
        </div>
    </div>

正如你可能已经意识到的,我已经把html文件放在www中,每个模块的每个项目都放在盒子里。
我已经更新了代码,使它更清楚。

xjreopfe

xjreopfe1#

无法在Shiny应用中读取output对象:像x <- output$...这样东西是被禁止的。
你不必把电抗导体分配给输出对象,我的意思是你可以这样做:
output$gene <- reactive(......)
您应该改为:
gene <- reactive(......)

相关问题