# R script for programtic access to Revigo. Run it with (last output file name is optional): # Rscript revigo.R example.csv result.csv library(httr) library(stringi) args = commandArgs(trailingOnly=TRUE) # Read user data from a file fileName <- args[1] #"example.csv" userData <- readChar(fileName,file.info(fileName)$size) # Default output file name is result.csv if (length(args)>=2) { fileNameOutput <- args[2] } else { fileNameOutput <- "result.csv" } # Submit job to Revigo httr::POST( url = "http://revigo.irb.hr/Revigo", body = list( cutoff = "0.7", valueType = "pvalue", speciesTaxon = "0", measure = "SIMREL", goList = userData ), # application/x-www-form-urlencoded encode = "form" ) -> res dat <- httr::content(res, as="text", encoding="UTF-8") # Write results to a file dat <- stri_replace_all_fixed(dat, "\r", "") cat(dat, file=fileNameOutput, fill = FALSE)