inst/extdata/example_peps-master/example_BiocProject_remote/readRemoteData.R

readRemoteData = function(project) {
  # get the data from the Project object
  url = pepr::sampleTable(project)$remote_url[[1]]
  # download the file
  bfc = BiocFileCache::BiocFileCache(cache=tempdir(),ask=FALSE)
  path = BiocFileCache::bfcrpath(bfc, url)
  # read it in
  df = read.table(path)
  # formatting
  colnames(df) = c('chr', 'start', 'end', 'name')
  # convert to GRanges object
  GenomicRanges::GRanges(df)
}
pepkit/BiocProject documentation built on July 28, 2023, 2:49 p.m.