Skip to contents

Function to download RData from the web. Intended to download epigenetic data from Google Cloud Storage but can be used for any public URL that points to an RData file.

Usage

get_rdata_from_url(
  tissue = NULL,
  assay = NULL,
  suffix = NULL,
  scratchdir = ".",
  url = NULL,
  obj_name = NULL,
  nrows = Inf
)

Arguments

tissue

character, tissue abbreviation, one of MotrpacRatTraining6moData::TISSUE_ABBREV. Only used if url is NULL.

assay

character, assay abbreviation, one of MotrpacRatTraining6moData::ASSAY_ABBREV. Only used if url is NULL.

suffix

character, object suffix. Only used if url is NULL.

scratchdir

character, local directory in which to download data from the web. Current working directory by default. Downloaded files are deleted before returning the result.

url

character, RData URL. Optional if URL cannot be constructed from tissue, assay, and suffix.

obj_name

character, name of object saved within RData file. Only required if more than one object is saved in the RData file.

nrows

integer, number of rows to return. Defaults to Inf.

Value

object saved in the RData file, optionally specified by obj_name

Details

See the readme for this repository for all available files: https://github.com/MoTrPAC/MotrpacRatTraining6moData/blob/main/README.md

Examples

if (FALSE) {
# return gastrocnemius chromatin accessibility differential analysis results 
data = get_rdata_from_url(tissue="SKM-GN", assay="ATAC", suffix="DA", scratchdir="/tmp")

# return brown adipose DNA methylation raw counts 
data = get_rdata_from_url(tissue="BAT", assay="METHYL", suffix="RAW_COUNTS", scratchdir="/tmp")

# return DNA methylation feature annotation
data = get_rdata_from_url(
  url=paste0("https://storage.googleapis.com/motrpac-rat-training-6mo-extdata/",
             "epigen-rda/METHYL_FEATURE_ANNOT.rda"), 
  scratchdir="/tmp"
)

# return raw DNA methylation data for brown adipose
data = get_rdata_from_url(
  url=paste0("https://storage.googleapis.com/motrpac-rat-training-6mo-extdata/",
             "epigen-rda/METHYL_BAT_RAW_DATA.rda"), 
  scratchdir="/tmp"
)
}