R/downloadRecount.R

Defines functions downloadRecount

Documented in downloadRecount

#' Download gene-level RangedSummarizedExperiment data from Recount
#'
#' This function downloads the RangedSummarizedExperiment object with the data summarized at the gene level
#' from Recount (https://jhubiostatistics.shinyapps.io/recount/)
#'
#' @param x a recount dataset ID
#' @return RangedSummarizedExperiment object for the given study
#' @examples \dontrun{
#' downloadRecount("SRP032775") }
#' recount<-BioDataome:::recountData
#' @export
#' @importFrom recount download_study

downloadRecount <- function(x) {
  rse_gene <- NULL
  a <- TRUE
  while(a) {
    rse_gene <- try(recount::download_study(x))
    if(!inherits(rse_gene,"try-error")) a <- FALSE
    else cat("Recount was busy, trying again\n")
  }
  return(rse_gene)
}
mensxmachina/BioDataome documentation built on July 24, 2021, 1:05 p.m.