【发布时间】:2018-09-25 01:42:13
【问题描述】:
我是 R 和 Shiny 的新手。到目前为止,我能够使用rentrez 包制作一个从ncbi 获取蛋白质序列的脚本。但是我无法让它在闪亮的应用程序中工作。
我在 ui 中有以下输入
sidebarPanel(
uiOutput("maps.protein.input")
),
在应用文件中:
output$maps.protein.input <- renderUI({
selectInput("prot.accession", "Accession:", as.list(pep.accession))
这部分运行良好,它将 pep.accession 列表读入selectInput
现在我想用rentrez下载蛋白质序列
protein_seq <- reactive({
raw_seq <- entrez_fetch(db="protein", id= paste(input$prot.accession), rettype = "fasta")
raw_seq <- str_sub(raw_seq, start = str_locate(pattern = "\n", protein_seq)[,1] +1 )
str_replace_all(raw_seq, "[\r\n]" , "")
})
在我使用的 R 脚本中:
protein_seq <- entrez_fetch(db="protein", id="XP_011524437.1", rettype = "fasta")
protein_seq <- str_sub(protein_seq, start = str_locate(pattern = "\n", protein_seq)[,1] +1 )
protein_seq <- str_replace_all(protein_seq, "[\r\n]" , "")
并且此代码有效。我只是想让它具有交互性。
【问题讨论】:
-
您需要提供一些可重现的数据,以便我们提供帮助。例如,在您的代码中,
pep.accession是什么? -
您遇到的具体问题是什么?它不工作吗?你有错误吗?