Please help me;] What am I subsetting and where am I wrong.The error is certainly the passage with biomaRT, but I do not know where.
My error: Listening on http://127.0.0.1:5836 Warning: Error in [: object of type 'closure' is not subsettable
My code:
ui.R
library(shiny) library("biomaRt")
shinyUI(fluidPage(
titlePanel("Analiza funkcjonalna dla danych cytogenetycznych"),
sidebarLayout(
sidebarPanel(
fileInput(inputId='plik1', label='Wybierz plik z danymi'),
tags$hr(),
checkboxInput(inputId='header', label='Header', value=TRUE),
tags$hr(),
radioButtons(inputId = 'sep', label= 'Separator', choices = c(Przecinek=',',Srednik=';',Tab='\t', Spacja=''), selected = ','),
tags$hr(),
p("Kliknij w ponizszy przycisk jesli chcesz wykonac analize funkcjonalna wprowadzonych danych"),
actionButton("act","Kliknij aby wykonac analize")
),
mainPanel(
uiOutput('tabelazb'),
dataTableOutput('opracowane')
)
)
))
server.R
shinyServer(function(input, output) {
dane<-reactive({
folder<-input$plik1
if(is.null(folder)){return()}
read.table(file=folder$datapath,sep=input$sep,header = input$header)
})
output$tabela1<- renderTable({
if(is.null(dane())){return()}
input$plik1
})
output$tabelad<-renderTable({
if(is.null(dane())){return()}
dane()
})
output$opracowane<-renderDataTable({
input$act
if(input$act==0)
{return()}
else
{if(is.null(dane()))
{return()}
else
{x=data.frame()
y=list()
x=dane[,c("chromosome","position_start","position_stop")]# dodanie nazw kolumn
y[[1]]=x
#listMarts()
z=useMart("ensembl")
z=useDataset("hsapiens_gene_ensembl",mart=z)
filtry=listFilters(z)
#listAttributes(z)
#Zbieramy wyniki
b=list()
g=list()
for (i in 1:length(y))
{
d=as.matrix(y[[i]])
#name_1006 - go term name
b[[i]]=getBM(attributes=c("entrezgene","hgnc_symbol", "chromosome_name", "start_position", "end_position","band","description"),filters=filtry[1:3,1],values=list(d[,1],d[,2],d[,3]),mart=z)
Na=which(b[[i]][,1] %in% NA == TRUE)
if (length(Na) >= 1)
{
b[[i]] <- b[[i]][-c(Na),]
}
}}
}
})
output$tabelazb<-renderUI({
if(is.null(dane()))
{h5(helpText("Brak wczytanego pliku"))}
else
{tabsetPanel(tabPanel("O pliku ",tableOutput("tabela1")),tabPanel("Dane",tableOutput("tabelad")))}
})
})