R 如何连接上传的文件以获取_ontology()函数?

R 如何连接上传的文件以获取_ontology()函数?,r,shiny,bioinformatics,R,Shiny,Bioinformatics,我想用Shiny来演示我的R分析过程 因为我的原始文件是.obo格式。 所以我需要使用get_ontology函数(ontologyIndex包)在R中读取它 但是当我使用Shiny的fileinput()函数输入文件时,它无法连接到获取_ontology()来读取它 错误消息显示 用户界面 服务器.r function(input, output) { output$contents <- renderTable({ # input$patent_file will b

我想用Shiny来演示我的R分析过程

因为我的原始文件是.obo格式。 所以我需要使用get_ontology函数(ontologyIndex包)在R中读取它

但是当我使用Shiny的fileinput()函数输入文件时,它无法连接到获取_ontology()来读取它

错误消息显示

用户界面

服务器.r

function(input, output) {

  output$contents <- renderTable({

    # input$patent_file will be NULL initially. After the user selects
    # and uploads a file, head of that data file by default,
    # or all rows if selected, will be shown.

     inFile <- input$patent_file
    if (is.null(inFile))
      return(NULL)

    req(input$patent_file)
    patent_df <- read.csv(input$patent_file$datapath)

    if (is.null(patent_df))
      return(NULL)

    req(input$ontology_file)
    ontology_df <- read.csv(input$ontology_file$datapath)

    if(input$file_disp == "patent") {
      return(patent_df)
    }
    else if (input$file_disp == "ontology") {
      return(ontology_df)
    }
})

#---------------------------
  library(ontologyIndex)
  library(ontologyPlot)

  # display 10 rows initially
  output$ex1 <- renderDataTable({
  ontology_get <- get_ontology(input$ontology_file, propagate_relationships = "is_a")

  #Plot ontology
  plot_ontology <- onto_plot(ontology, terms=ontology$id, frequencies = NULL,
            edge_attributes = list(color = "#000000", lty = "solid"), 
            fontsize = 35,
            width =1,
            fixedsize = "true",
            shape = "circle")  
  }
 )
}
功能(输入、输出){
输出$contents为什么使用`ontology\\ df get\\本体(输入$ontology\\文件$datapath,…)为什么使用`ontology\\ df get\\本体(输入$ontology\\文件$datapath,…)
function(input, output) {

  output$contents <- renderTable({

    # input$patent_file will be NULL initially. After the user selects
    # and uploads a file, head of that data file by default,
    # or all rows if selected, will be shown.

     inFile <- input$patent_file
    if (is.null(inFile))
      return(NULL)

    req(input$patent_file)
    patent_df <- read.csv(input$patent_file$datapath)

    if (is.null(patent_df))
      return(NULL)

    req(input$ontology_file)
    ontology_df <- read.csv(input$ontology_file$datapath)

    if(input$file_disp == "patent") {
      return(patent_df)
    }
    else if (input$file_disp == "ontology") {
      return(ontology_df)
    }
})

#---------------------------
  library(ontologyIndex)
  library(ontologyPlot)

  # display 10 rows initially
  output$ex1 <- renderDataTable({
  ontology_get <- get_ontology(input$ontology_file, propagate_relationships = "is_a")

  #Plot ontology
  plot_ontology <- onto_plot(ontology, terms=ontology$id, frequencies = NULL,
            edge_attributes = list(color = "#000000", lty = "solid"), 
            fontsize = 35,
            width =1,
            fixedsize = "true",
            shape = "circle")  
  }
 )
}