2

I don't get to upload and display a rda file with the library shiny in R. Someone knows how to do it ? I use the R version 3.1.1. Here is the web site for using shiny : http://shiny.rstudio.com

**

#ui.R
library(shiny)
shinyUI(navbarPage("MareyMap online",

                   tabPanel("Présentation",

h2("A web-service for estimating recombination rates along the genome",align="center"),

br()

),

tabPanel("Step 1 : Data Selection",


         fileInput("file", label = h3("or upload a data set")),
                         'Note: Upload the marey map data for your species using the following format: txt, rda,
Rda, rdata or Rdata.',

        "Optional -- Would you agree to include your dataset in our database after data curation",

         tableOutput("table")

         )
))
#server.R
library(shiny)
library(MareyMap)
shinyServer(function(input, output) {

  output$table <- renderPrint({
    input$file
  })  
})

**

adrbessy
  • 41
  • 6
  • Try `load(input$file$datapath)` instead of `input$file` in `renderPrint` and look at http://shiny.rstudio.com/gallery/file-upload.html – Victorp Mar 13 '15 at 14:08
  • When i use`load(input$file$datapath)` instead of `input$file` in `renderPrint `, the console displays `Error in load(input$file$datapath) : bad 'file' argument` – adrbessy Mar 13 '15 at 14:35
  • What is the name of the object you try to load ? How do you load it in a normal way in R ? – Victorp Mar 13 '15 at 14:47
  • The error is because you don't have chosen a file yet. – Victorp Mar 13 '15 at 15:00
  • And if you use `tableOutput` in ui.R, it's better to use `renderTable` in server.R – Victorp Mar 13 '15 at 15:03
  • The file is Arabidopsis_thalianan.rda I don't get to load it in R. If I use renderTable, it displays pas de méthode pour 'xtable' applicable pour un objet de classe "character" – adrbessy Mar 13 '15 at 15:34
  • So use `textOuput` instead of `tableOutput` in ui.R. – Victorp Mar 13 '15 at 15:43

1 Answers1

0

It doesn't work but finally I try with a .txt file:

"set" "map" "mkr" "phys" "gen" "vld" "Arabidopsis thaliana" "Chromosome 1" "SGCSNP131" 184351 0 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP5" 189722 2.61 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP247" 662031 2.54 TRUE "Arabidopsis thaliana" "Chromosome 1" "GST1" 663291 3.99 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP151" 1148355 3.35 TRUE "Arabidopsis thaliana" "Chromosome 1" "AtEAT1" 1435872 3.87 TRUE "Arabidopsis thaliana" "Chromosome 1" "ve002" 1521308 7.15 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP388" 1526933 7.66 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP170" 1642565 7.66 TRUE "Arabidopsis thaliana" "Chromosome 1" "ve003" 2032443 7.76 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP308" 2664435 0.89 TRUE "Arabidopsis thaliana" "Chromosome 1" "phyA" 3097714 11.35 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP107" 3097951 11.86 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP138" 3121108 14.69 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP270" 3190609 13.8 TRUE "Arabidopsis thaliana" "Chromosome 1" "ve005" 3194953 11.48 TRUE "Arabidopsis thaliana" "Chromosome 1" "nga63" 3224435 11.48 TRUE "Arabidopsis thaliana" "Chromosome 1" "ARR4" 3443848 11.35 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP148" 3658292 11.99 TRUE "Arabidopsis thaliana" "Chromosome 1" "BFN1" 3773426 11.98 TRUE "Arabidopsis thaliana" "Chromosome 1" "NCC1" 4107626 12.6 TRUE "Arabidopsis thaliana" "Chromosome 1" "ve006" 4459553 16.13 TRUE "Arabidopsis thaliana" "Chromosome 1" "SGCSNP132" 4588103 14.04 TRUE ...

server.R

library(shiny) library(MareyMap)

shinyServer(function(input, output) {

output$table <- renderPrint({

#data(Arabidopsis_thalianan)
#Arabidopsis_thalianan@maps  

})

output$table2 <- renderTable({

inFile <- input$file

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

read.csv(inFile$datapath, header = TRUE,
         sep = ' ', quote ='"')

})

output$table3 <- renderTable({

inFile <- input$file

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

a<-read.csv(inFile$datapath, header = TRUE,
         sep = ' ', quote ='"')
a[,"map"]

})

})

ui.R

library(shiny)

shinyUI(navbarPage("MareyMap online",

               tabPanel("Présentation",
                        
                        h2("A web-service for estimating recombination rates along the genome",align="center"),
                        
                        
                        br(),
                        
                        helpText("MareyMap allows to estimate local recombination rates along the genome. MareyMap relies on
                                 comparing the genetic and the physical maps of a given chromosome to estimate local recombination
                                 rates (given by the slope of the curve describing the relationship between both variables), a graphical
                                 method called the Marey map method introduced by A. Chakravarti in 1991 . MareyMap accepts Marey
                                 map data as input (genetic and physical positions of markers for a set of chromosomes of a species) and
                                 will return local recombination rate estimates.")
                        ),
               
               
               
               tabPanel("Step 1 : Data Selection",
                        
                        selectInput("dataset", label = h3("Select a dataset in our database",align="center"),
                                    choices = c("Arabidopsis_thalianan", "Caenorhabditis_elegans" ,
                                                "Drosophila melanogaster","Homo sapiens")),
                        
                        fileInput("file", label = h3("or upload a data set")),
                        'Note: Upload the marey map data for your species using the following format: txt',
                        
                        br(),
                        br(),
                        
                        "Optional -- Would you agree to include your dataset in our database after data curation",
                        
                        textOutput("table"),
                        tableOutput("table2")
                        
                        
               ),
               tabPanel("Step 2 : Data curation",
                        "list of chromosomes:",
                        br(),
                        tableOutput("table3")
               ),
               tabPanel("Step 3 : Interpolation"),
               tabPanel("Step 4 : Rec Rates export")
                        ))

But I don't get to display only the map colum.

Community
  • 1
  • 1
adrbessy
  • 41
  • 6