diff --git a/DESCRIPTION b/DESCRIPTION index eede360..d606017 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,6 +18,7 @@ Imports: R.utils, stringr, tibble, + tidyr, tools, utils Suggests: diff --git a/NAMESPACE b/NAMESPACE index 9883e7a..693337d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,15 +2,15 @@ export(.BEDbase) export(BEDbase) -export(bb_search) -export(download_file) -export(get_rec_type) exportClasses(BEDbase) exportMethods(bb_beds_in_bedset) -exportMethods(bb_count) -exportMethods(bb_genomes) +exportMethods(bb_list_beds) +exportMethods(bb_list_bedsets) exportMethods(bb_metadata) -exportMethods(bb_records) +exportMethods(bb_metadata_classification) +exportMethods(bb_metadata_files) +exportMethods(bb_search) +exportMethods(bb_to_granges) importFrom(AnVIL,Service) importFrom(BiocFileCache,BiocFileCache) importFrom(BiocFileCache,bfcadd) @@ -18,21 +18,19 @@ importFrom(BiocFileCache,bfcdownload) importFrom(BiocFileCache,bfcneedsupdate) importFrom(BiocFileCache,bfcquery) importFrom(BiocFileCache,bfcrpath) +importFrom(GenomicRanges,GRanges) +importFrom(IRanges,IRanges) importFrom(dplyr,bind_rows) +importFrom(dplyr,filter) +importFrom(dplyr,mutate) importFrom(httr,content) -importFrom(httr2,req_perform) -importFrom(httr2,request) -importFrom(httr2,resp_body_json) -importFrom(purrr,map_dfr) -importFrom(purrr,set_names) -importFrom(rlang,abort) +importFrom(purrr,map_depth) importFrom(rlang,inform) -importFrom(stringr,regex) -importFrom(stringr,str_detect) -importFrom(stringr,str_split_1) -importFrom(tibble,as_tibble) +importFrom(rtracklayer,import) +importFrom(rtracklayer,import.bed) +importFrom(stringr,str_replace) importFrom(tibble,tibble) +importFrom(tidyr,unnest) +importFrom(tidyr,unnest_wider) importFrom(tools,R_user_dir) importFrom(utils,URLencode) -importFrom(utils,download.file) -importFrom(utils,tail) diff --git a/R/bedbaser.R b/R/bedbaser.R index 3f3b9ae..f7bddfb 100644 --- a/R/bedbaser.R +++ b/R/bedbaser.R @@ -28,156 +28,128 @@ BEDbase <- function() { ) } -setGeneric(name = "bb_count", - def = function(x, rec_type = c("bed", "bedset")) { - standardGeneric("bb_count") +setGeneric(name = "bb_metadata", + def = function(x, id, rec_type = c("bed", "bedset"), full = TRUE) { + standardGeneric("bb_metadata") }) -#' Count BEDs or BEDsets -#' -#' @param rec_type character() bed or bedset -#' -#' @importFrom httr content -#' -#' @return integer() the number of BEDs or BEDsets available -#' -#' @examples -#' client <- BEDbase() -#' bb_count(client, "bed") -#' -#' @export -setMethod( - "bb_count", "BEDbase", - function(x, rec_type = c("bed", "bedset")) { - rec_type <- match.arg(rec_type) - if (rec_type == "bed") - content(x$count_bed_record_bed_count_get()) - else - content(x$get_bedset_count_bedset_count_get()) - } -) - -setGeneric(name = "bb_genomes", - def = function(x, rec_type = c("bed", "bedset")) { - standardGeneric("bb_genomes") -}) +#### TODO -#' Get genome assemblies in BEDbase +#' Get metadata for an BED or BEDset #' +#' @param id integer() record or object identifier #' @param rec_type character() BED or BEDset +#' @param full logical() include all metadata #' #' @importFrom httr content -#' @importFrom purrr map_dfr -#' @importFrom tibble tibble #' -#' @return tibble +#' @return list() metadata #' #' @examples #' client <- BEDbase() -#' bb_genomes(client, "bed") +#' bb_metadata(client, "0dcdf8986a72a3d85805bbc9493a1302", "bed") #' #' @export setMethod( - "bb_genomes", "BEDbase", - function(x, rec_type = c("bed", "bedset")) { + "bb_metadata", "BEDbase", + function(x, id, rec_type = c("bed", "bedset"), full = TRUE) { rec_type <- match.arg(rec_type) if (rec_type == "bed") - resp <- x$get_bed_genome_assemblies_bed_genomes_get() + rsp <- x$get_bed_metadata_v1_bed__bed_id__metadata_get(bed_id = id, + full = full) else - resp <- x$get_bedset_genome_assemblies_bedset_genomes_get() - genome_list <- content(resp) - genome_tibble <- tibble() - if (length(genome_list)) { - cnames <- names(genome_list[[1]]) - genome_tibble <- genome_list |> - map_dfr(function(y) { set_names(unlist(y), cnames) }) - } - genome_tibble + rsp <- + x$get_bedset_metadata_v1_bedset__bedset_id__metadata_get(bedset_id = id, + full = full) + content(rsp) } ) -setGeneric(name = "bb_metadata", - def = function(x, id, rec_type = c("bed", "bedset")) { - standardGeneric("bb_metadata") +setGeneric(name = "bb_list_beds", + def = function(x, genome = NULL, bed_type = NULL, limit = 1000, + offset = 0) { + standardGeneric("bb_list_beds") }) -#' Get metadata for an BED or BEDset +#' List BEDs #' -#' @param id integer() record or object identifier -#' @param rec_type character() BED or BEDset +#' @param genome character() (defaults to NULL) genome keyword +#' @param bed_type character() (defaults to NULL) bed file type +#' @param limit integer() (defaults to 1000) maximum records +#' @param offset integer() (defaults to 0) page token of records #' +#' @importFrom dplyr bind_rows #' @importFrom httr content +#' @importFrom purrr map_depth #' -#' @return list() metadata +#' @return a tibble of BED records #' #' @examples #' client <- BEDbase() -#' bb_metadata(client, "421d2128e183424fcc6a74269bae7934", "bed") +#' bb_list_beds(client) #' #' @export setMethod( - "bb_metadata", "BEDbase", - function(x, id, rec_type = c("bed", "bedset")) { - rec_type <- match.arg(rec_type) - if (rec_type == "bed") - resp <- x$get_bed_metadata_bed__bed_id__metadata_get(id) - else - resp <- x$get_bedset_metadata_bedset__bedset_id__metadata_get(id) - record <- content(resp) - record$metadata + "bb_list_beds", "BEDbase", + function(x, genome = NULL, bed_type = NULL, limit = 1000, offset = 0) { + rsp <- x$list_beds_v1_bed_list_get(genome = genome, bed_type = bed_type, + limit = limit, offset = offset) + recs <- content(rsp) + results <- tibble() + if (recs$count) + results <- map_depth(.x = recs$results, 2, ~ replace(.x, is.null(.x), NA)) |> + bind_rows() + results } ) -setGeneric(name = "bb_records", - def = function(x, rec_type, limit = NULL, token = NULL) { - standardGeneric("bb_records") +setGeneric(name = "bb_list_bedsets", + def = function(x, query = NULL, limit = 1000, offset = 0) { + standardGeneric("bb_list_bedsets") }) -#' Get record identifiers and names for BEDs or BEDsets +#' List BEDsets #' -#' Note: how to get next page token -#' -#' @param rec_type character() bed or bedset -#' @param limit integer() (defaults to NULL) maximum records -#' @param token integer() (defaults to NULL) page token of records +#' @param query character() (defaults to NULL) BEDset keyword +#' @param limit integer() (defaults to 1000) maximum records +#' @param offset integer() (defaults to 0) page token of records #' +#' @importFrom dplyr bind_rows #' @importFrom httr content -#' @importFrom purrr map_dfr set_names -#' @importFrom tibble tibble as_tibble +#' @importFrom purrr map_depth #' -#' @return a tibble of record identifiers and record names +#' @return a tibble of BEDset records #' #' @examples #' client <- BEDbase() -#' bb_records(client, "bed") +#' bb_list_bedsets(client) #' #' @export setMethod( - "bb_records", "BEDbase", - function(x, rec_type = c("bed", "bedset"), limit = NULL, token = NULL) { - rec_type <- match.arg(rec_type) - if (rec_type == "bed") - resp <- x$list_beds_bed_list_get(limit=limit, token=token) - else - resp <- x$list_bedsets_bedset_list_get(limit=limit, token=token) - records_tibble <- tibble() - records_list <- content(resp) - if (length(records_list)) { - cnames <- names(records_list$records[[1]]) - records_tibble <- records_list$records |> - map_dfr(function(x) { set_names(unlist(x), cnames) }) |> - as_tibble() - } - records_tibble + "bb_list_bedsets", "BEDbase", + function(x, query = NULL, limit = 1000, offset = 0) { + rsp <- x$list_bedsets_v1_bedset_list_get(query = query, limit = limit, + offset = offset) + recs <- content(rsp) + results <- tibble() + if (recs$count) + results <- bind_rows(recs$results) |> + unnest(bed_ids) + results } ) setGeneric(name = "bb_beds_in_bedset", - def = function(x, rec_id) { standardGeneric("bb_beds_in_bedset") }) + def = function(x, rec_id, limit = 100, offset = 0, full = FALSE) { + standardGeneric("bb_beds_in_bedset") +}) #' Get BEDs associated with BEDset #' #' @param rec_id integer() BEDset record identifier +#' @param limit integer() (defaults to 100) maximum records to include +#' @param offset integer() (defaults to 0) page offset +#' @param full logical() (defaults to FALSE) include all metadata #' #' @importFrom httr content #' @@ -185,16 +157,24 @@ setGeneric(name = "bb_beds_in_bedset", #' #' @examples #' client <- BEDbase() -#' bb_beds_in_bedset(client, "bed") -#' rec_id <- "421d2128e183424fcc6a74269bae7934" +#' rec_id <- "gse218680" +#' bb_beds_in_bedset(client, rec_id) #' @export setMethod( "bb_beds_in_bedset", "BEDbase", - function(x, rec_id) { - response <- - x$get_bedfiles_in_bedset_bedset__bedset_id__bedfiles_get(rec_id) - records <- content(resp) - unlist(records$bedfile_metadata, use.names = FALSE) + function(x, rec_id, limit = 100, offset = 0, full = FALSE) { + rsp <- + x$get_bedfiles_in_bedset_v1_bedset__bedset_id__bedfiles_get( + rec_id, limit, offset, full) + recs <- content(rsp) + results <- tibble() + if (recs$count) { + if (!full) + results <- bind_rows(recs$results) + # TODO: full + } + + results } ) @@ -206,12 +186,13 @@ setGeneric(name = "bb_search", #' Search BEDbase #' #' @param query character() keywords to search -#' @param limit integer() (defaults to NULL) maximum number of results -#' @param offset integer() (defaults to NULL) page offset of results +#' @param limit integer() (defaults to 10) maximum number of results +#' @param offset integer() (defaults to 0) page offset of results #' #' @importFrom dplyr bind_rows #' @importFrom httr content -#' @importFrom tibble as_tibble +#' @importFrom tibble tibble +#' @importFrom tidyr unnest #' @importFrom utils URLencode #' #' @return tibble() @@ -221,94 +202,108 @@ setGeneric(name = "bb_search", #' bb_search(client, "excluderanges") #' #' @export -bb_search <- function(x, query, limit = NULL, offset = NULL) { - encoded_query <- URLencode(query, reserved = TRUE) - resp <- x$text_to_bed_search_search_bed__query__get(encoded_query, - limit = limit, - offset = offset) - results <- content(resp) - if (!length(results)) - return(results) - metadata <- tibble() - for (result in results) { - fmd <- list() - for (i in 1:length(result$metadata)) { - if (length(result$metadata[[i]]) > 1) { - cname <- names(result$metadata[i]) - cnames <- sapply(names(result$metadata[[i]]), function(y) { - paste(cname, y, sep="_") - }) - names(result$metadata[[i]]) <- c(cnames) - submetadata <- unlist(result$metadata[[i]], recursive = TRUE) - fmd <- append(fmd, submetadata) - } else { - fmd <- append(fmd, result$metadata[i]) - } +setMethod( + "bb_search", "BEDbase", + function(x, query, limit = 10, offset = 0) { + encoded_query <- URLencode(query, reserved = TRUE) + rsp <- x$text_to_bed_search_v1_bed_search_text_post(encoded_query, + limit, offset) + records <- content(rsp) + results <- tibble() + if (records$count) { + results <- records$results +# results <- bind_rows(records$results) |> +# unnest(c(payload, metadata)) } - bind_rows(metadata, as_tibble(fmd)) + results } - metadata -} +) + +setGeneric(name = "bb_metadata_files", + def = function(x, rec_id) { standardGeneric("bb_metadata_files") }) -#' Download BED or thumbnail +#' BED files metadata #' #' @param rec_id integer() BED record identifier -#' @param file_type character() type of file to download, bytes or thumbnail -#' @param acc_id character() (default http) access identifier, "local" -#' is removed. -#' @param quiet logical() (default FALSE) display message #' -#' @importFrom BiocFileCache bfcrpath -#' @importFrom httr2 req_perform request resp_body_json -#' @importFrom stringr str_split_1 -#' @importFrom utils download.file tail +#' @importFrom httr content #' -#' @return character() path to file +#' @return tibble() records #' #' @examples -#' telomere <- download_file("80d2b2581bb25fa6b73ec56c11969fb3", "bytes") +#' client <- BEDbase() +#' metadata <- bb_metadata_files(client, "bbad85f21962bb8d972444f7f9a3a932") #' #' @export -download_file <- function(rec_id, file_type = c("bytes", "thumbnail"), - acc_id = "http", quiet = FALSE) { - obj_id <- make_obj_id(rec_id) - stopifnot(acc_id %in% get_access_ids(obj_id, TRUE)) - file_type <- match.arg(file_type) - url <- paste0("objects/", obj_id, "/access/", acc_id) - if (file_type == "thumbnail") - url <- paste(url, file_type, sep="/") - download_url <- query_bedbase(url, quiet) - .download_and_cache(download_url, quiet) -} +setMethod( + "bb_metadata_files", "BEDbase", + function(x, rec_id) { + rsp <- x$get_bed_files_v1_bed__bed_id__metadata_files_get(rec_id) + .format_metadata_files(content(rsp)) + } +) + +setGeneric(name = "bb_metadata_classification", + def = function(x, rec_id) { + standardGeneric("bb_metadata_classification") +}) + +#' Get BED metadata classification +#' +#' @param rec_id BEDbase record identifier +#' +#' @importFrom dplyr filter +#' +#' @return tibble() records +#' +#' @examples +#' client <- BEDbase() +#' bb_metadata_classification(client, "bbad85f21962bb8d972444f7f9a3a932") +#' +#' @export +setMethod( + "bb_metadata_classification", "BEDbase", + function(x, rec_id) { + metadata <- bb_metadata(rec_id) + record <- metadata$files |> + filter(name == paste(file_type, "file", sep = "_"), + access_id == "http") + file_path <- .download_and_cache(record$url, quietly) + bb_to_granges(file_path, metadata$bed_type) + } +) -##' Create a GRanges object from a BED file -##' -##' @param filepath path to a BED file -##' -##' @importFrom GenomicRanges GRanges -##' @importFrom rtracklayer import -##' @importFrom IRanges IRanges -##' -##' @return a GRanges object -##' -##' @examples -##' grobj <- file_to_granges(filepath) -##' -##' @export -#file_to_granges <- function(filepath) { -#} +setGeneric(name = "bb_to_granges", + def = function(x, rec_id, file_type = c("bed", "bigbed"), + quietly = FALSE) { + standardGeneric("bb_to_granges") +}) -##' Download BED file by record identifier and create a GRanges object -##' -##' @param rec_id BEDbase record identifier -##' -##' @return a GRanges object -##' -##' @examples -##' grobj <- to_granges("421d2128e183424fcc6a74269bae7934") -##' -##' @export -#to_granges <- function(rec_id) { -# filepath <- download_bed_file(rec_id, destdir=tempdir()) -# file_to_granges(filepath) -#} +#' Create a GRanges object given a BED id +#' +#' @param rec_id BEDbase record identifier +#' @param file_type character() bed or bigbed +#' @param quietly logical() (defaults to FALSE) display messages +#' +#' @importFrom dplyr filter +#' +#' @return a GRanges object +#' +#' @examples +#' client <- BEDbase() +#' bb_to_granges(client, "421d2128e183424fcc6a74269bae7934") +#' +#' @export +setMethod( + "bb_to_granges", "BEDbase", + function(x, rec_id, file_type = c("bed", "bigbed"), quietly = FALSE) { + file_type <- match.arg(file_type) + metadata <- bb_metadata(x, rec_id) + record <- .format_metadata_files(metadata$files) |> + filter(name == paste(file_type, "file", sep = "_"), + access_id == "http") + gzipfile <- .download_and_cache(record$url, quietly) + file_path <- .ungzip(gzipfile) + .file_to_granges(file_path, metadata$bed_type, metadata$bed_format) + } +) diff --git a/R/cache.R b/R/cache.R index 00d836d..8cc72a6 100644 --- a/R/cache.R +++ b/R/cache.R @@ -21,7 +21,7 @@ #' This function is described in the BiocFileCache vignette. #' #' @param url character() remote resource -#' @param quiet logical() display message +#' @param quietly logical() display message #' #' @importFrom BiocFileCache BiocFileCache bfcadd bfcdownload bfcneedsupdate #' bfcquery bfcrpath @@ -32,11 +32,11 @@ #' @examples #' url <- "https://data2.bedbase.org/bed_files/hg38_UCSC_telomere.bed.gz" #' filepath <- .download_and_cache(url) -.download_and_cache <- function(url, quiet = FALSE) { +.download_and_cache <- function(url, quietly = FALSE) { bfc <- .get_cache() rid <- bfcquery(bfc, url)$rid if (!length(rid)) { - if (!quiet) + if (!quietly) inform(paste("Downloading", url, "...")) rid <- names(bfcadd(bfc, url)) } diff --git a/R/utils.R b/R/utils.R index dffa143..93ca369 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,32 +1,5 @@ -#' Get record type -#' -#' @param id character() BEDbase identifier -#' -#' @importFrom rlang abort -#' @importFrom stringr regex str_detect -#' -#' @return logical() -#' -#' @examples -#' get_rec_type("eaf9ee97241f300f1c7e76e1f945141f") -#' -#' @export -get_rec_type <- function(id) { - if (str_detect(id, regex("^bed.[:alnum:]+.bedfile$"))) - rec_type <- "bed" - else if (str_detect(id, regex("^bed.[:alnum:]+.bedset$"))) - rec_type <- "bedset" - else if (str_detect(id, regex("^[:alnum:]+$"))) - rec_type <- "object" - else - abort(paste("Unknown record identifier:", id)) - rec_type -} - #' Construct object identifier #' -#' Note: only rec_type = bed, result_id = bedfile? -#' #' @param rec_id character() BEDbase record identifier #' @param rec_type character() (default bed) BEDbase record type #' @param result_id character() (default bedfile) BEDbase result identifier @@ -34,29 +7,85 @@ get_rec_type <- function(id) { #' @return String #' #' @examples -#' obj_id <- make_obj_id("eaf9ee97241f300f1c7e76e1f945141f") +#' obj_id <- make_obj_id("bbad85f21962bb8d972444f7f9a3a932") make_obj_id <- function(rec_id, rec_type = "bed", result_id = "bedfile") { paste(rec_type, rec_id, result_id, sep =".") } -#' Get valid access identifiers +#' Decompress gunzip file +#' +#' @param file_path character() path to gunzip file +#' +#' @importFrom stringr str_replace +#' +#' @return character() decompressed file path +#' +#' @examples +#' .ungzip("path/to/my.gzip") +.ungzip <- function(file_path) { + system(paste("gzip -d", file_path)) + str_replace(file_path, "\\.gz", "") +} + +#' Format BED file metadata +#' +#' @param records list() metadata records +#' +#' @importFrom dplyr bind_rows mutate +#' @importFrom purrr map_depth +#' @importFrom tidyr unnest_wider +#' +#' @return tibble() file metadata +#' +#' @examples +#' client <- BEDbase() +#' example <- content(client$get_example_bed_record_v1_bed_example_get()) +#' .format_metadata_files(example$files) +.format_metadata_files <- function(records) { + results <- map_depth(.x = records, 2, ~ replace(.x, is.null(.x), NA),) |> + bind_rows() |> + mutate(access_methods = map_depth(access_methods, 2, + ~ replace(.x, is.null(.x), NA))) |> + unnest_wider(access_methods) |> + mutate(access_url = map_depth(access_url, 2, + ~ replace(.x, is.null(.x), NA))) |> + unnest_wider(access_url) + results +} + +#' Format BED file metadata #' -#' Note: omits 'local' option +#' @param file_path character() path to BED file +#' @param bed_type character() bed type +#' @param bed_format character() format name #' -#' @param obj_id character() BEDbase object record identifier -#' @param quiet logical() (default FALSE) display message +#' @importFrom GenomicRanges GRanges +#' @importFrom IRanges IRanges +#' @importFrom rtracklayer import import.bed +#' @importFrom stringr str_replace #' -#' @return character() available access identifiers +#' @return GRanges() #' #' @examples -#' get_access_ids("bed.421d2128e183424fcc6a74269bae7934.bedfile") -get_access_ids <- function(obj_id, quiet = FALSE) { - metadata <- get_metadata(obj_id, "object", quiet = FALSE) - access_methods <- unlist(lapply(metadata$access_methods, `[[`, c('type'))) - remove_index <- match("local", access_methods) - if (!is.na(remove_index)) { - access_methods <- access_methods[-remove_index] +#' .file_to_granges(file_path, bed_type, bed_format) +.file_to_granges <- function(file_path, bed_type, bed_format) { + nums <- stringr::str_replace(bed_type, "bed", "") + if (bed_format == "broadpeak" && bed_type == "bed6+3") { + extraCols <- c(signalValue = "numeric", pValue = "numeric", + qValue = "numeric") + obj <- import(file_path, format = "BED", extraCols = extraCols) + } else if (bed_format == "narrowpeak" && bed_type == "bed6+4") { + extraCols <- c(signalValue = "numeric", pValue = "numeric", + qValue = "numeric", peak = "integer") + obj <- import(file_path, format = "BED", extraCols = extraCols) + } else if (as.double(num[2]) == 0) { + obj <- import.bed(file_path) + } else { + # extraCols <- + # obj <- import(f, format = "BED", extraCols = extraCols) + # t <- read.table(f) + message("Not yet implemented") } - access_methods + obj } diff --git a/inst/service/openapi.json b/inst/service/openapi.json index b7ff343..2ad30ce 100644 --- a/inst/service/openapi.json +++ b/inst/service/openapi.json @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"bedhost","description":"BED file/sets statistics and image server API","version":"0.3.0"},"paths":{"/":{"get":{"tags":["home"],"summary":"API intro page","description":"Display the index UI page","operationId":"index__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/docs/changelog":{"get":{"tags":["home"],"summary":"Release notes","operationId":"changelog_docs_changelog_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/docs/guide":{"get":{"tags":["home"],"summary":"Developer guide","operationId":"guide_docs_guide_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/service-info":{"get":{"tags":["home"],"summary":"GA4GH service info","description":"Returns information about this service, such as versions, name, etc.","operationId":"service_info_service_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/objects/{object_id}":{"get":{"tags":["objects"],"summary":"Get DRS object metadata","description":"Returns metadata about a DrsObject.","operationId":"get_drs_object_metadata_objects__object_id__get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/objects/{object_id}/access/{access_id}":{"get":{"tags":["objects"],"summary":"Get URL where you can retrieve files","description":"Returns a URL that can be used to fetch the bytes of a DrsObject.","operationId":"get_object_bytes_url_objects__object_id__access__access_id__get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}},{"name":"access_id","in":"path","required":true,"schema":{"type":"string","title":"Access Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/objects/{object_id}/access/{access_id}/bytes":{"get":{"tags":["objects"],"summary":"Download actual files","description":"Returns the bytes of a DrsObject.","operationId":"get_object_bytes_objects__object_id__access__access_id__bytes_get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}},{"name":"access_id","in":"path","required":true,"schema":{"type":"string","title":"Access Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/objects/{object_id}/access/{access_id}/thumbnail":{"get":{"tags":["objects"],"summary":"Download thumbnail","description":"Returns the bytes of a thumbnail of a DrsObject","operationId":"get_object_thumbnail_objects__object_id__access__access_id__thumbnail_get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}},{"name":"access_id","in":"path","required":true,"schema":{"type":"string","title":"Access Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bed/genomes":{"get":{"tags":["bed"],"summary":"Get available genome assemblies in the database","description":"Returns available genome assemblies in the database","operationId":"get_bed_genome_assemblies_bed_genomes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Response Get Bed Genome Assemblies Bed Genomes Get"}}}}}}},"/bed/count":{"get":{"tags":["bed"],"summary":"Number of BED records in the database","description":"Returns the number of bed records available in the database","operationId":"count_bed_record_bed_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"integer","title":"Response Count Bed Record Bed Count Get"}}}}}}},"/bed/schema":{"get":{"tags":["bed"],"summary":"Schema for BED records","description":"Get pipestat schema for BED records used by this database","operationId":"get_bed_schema_bed_schema_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Bed Schema Bed Schema Get"}}}}}}},"/bed/example":{"get":{"tags":["bed"],"summary":"Get metadata for an example BED record","operationId":"get_example_bed_record_bed_example_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedMetadataResponse"}}}}}}},"/bed/list":{"get":{"tags":["bed"],"summary":"Paged list of all BED records","description":"To get the first page, leave token field empty. The response will include a\n'next_page_token' field, which can be used to get the next page.","operationId":"list_beds_bed_list_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":1000,"title":"Limit"}},{"name":"token","in":"query","required":false,"schema":{"type":"integer","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBedFilesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bed/{bed_id}/metadata":{"get":{"tags":["bed"],"summary":"Get metadata for a single BED record","description":"Returns metadata from selected columns for selected BED record","operationId":"get_bed_metadata_bed__bed_id__metadata_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"},{"name":"attr_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column name to select from the table","title":"Attr Id"},"description":"Column name to select from the table"},{"name":"raw","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Add raw metadata from pephub","default":false,"title":"Raw"},"description":"Add raw metadata from pephub"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedMetadataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bed/{bed_id}/regions/{chr_num}":{"get":{"tags":["bed"],"summary":"Get regions from a BED file that overlap a query region.","description":"Returns the queried regions with provided ID and optional query parameters","operationId":"get_regions_for_bedfile_bed__bed_id__regions__chr_num__get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"},{"name":"chr_num","in":"path","required":true,"schema":{"type":"string","pattern":"^\\S+$","description":"Chromosome number","title":"Chr Num"},"description":"Chromosome number","example":"chr1"},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"query range: start coordinate","title":"Start"},"description":"query range: start coordinate"},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"query range: start coordinate","title":"End"},"description":"query range: start coordinate"}],"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bedset/genomes":{"get":{"tags":["bedset"],"summary":"Get Bedset Genome Assemblies","description":"Returns available genome assemblies in the database","operationId":"get_bedset_genome_assemblies_bedset_genomes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"object"},"type":"array","title":"Response Get Bedset Genome Assemblies Bedset Genomes Get"}}}}}}},"/bedset/count":{"get":{"tags":["bedset"],"summary":"Get Bedset Count","description":"Returns the number of bedsets available in the database","operationId":"get_bedset_count_bedset_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"integer","title":"Response Get Bedset Count Bedset Count Get"}}}}}}},"/bedset/schema":{"get":{"tags":["bedset"],"summary":"Get Bedset Schema","description":"Get bedsets pipestat schema","operationId":"get_bedset_schema_bedset_schema_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Bedset Schema Bedset Schema Get"}}}}}}},"/bedset/example":{"get":{"tags":["bedset"],"summary":"Get metadata for an example BEDset record","operationId":"get_example_bedset_record_bedset_example_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetMetadataResponse"}}}}}}},"/bedset/list":{"get":{"tags":["bedset"],"summary":"Paged list of all BEDset records","description":"Returns a paged list of all BEDset records","operationId":"list_bedsets_bedset_list_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":1000,"title":"Limit"}},{"name":"token","in":"query","required":false,"schema":{"type":"integer","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBedFilesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bedset/{bedset_id}/metadata":{"get":{"tags":["bedset"],"summary":"Get Bedset Metadata","description":"Returns metadata from selected columns for selected bedset","operationId":"get_bedset_metadata_bedset__bedset_id__metadata_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}},{"name":"ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Column name to select from the table","title":"Ids"},"description":"Column name to select from the table"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetMetadataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bedset/{bedset_id}/bedfiles":{"get":{"tags":["bedset"],"summary":"Get Bedfiles In Bedset","operationId":"get_bedfiles_in_bedset_bedset__bedset_id__bedfiles_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}},{"name":"metadata","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether to add metadata to response","default":false,"title":"Metadata"},"description":"Whether to add metadata to response"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedsetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/bedset/{bedset_id}/track_hub":{"get":{"tags":["bedset"],"summary":"Get Track Hub Bedset","description":"Generate track hub files for the BED set","operationId":"get_track_hub_bedset_bedset__bedset_id__track_hub_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/search/bed/{query}":{"get":{"tags":["search"],"summary":"Text To Bed Search","operationId":"text_to_bed_search_search_bed__query__get","parameters":[{"name":"query","in":"path","required":true,"schema":{"title":"Query"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BedFile":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"BED file name","nullable":true},"genome":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Genome","description":"genome assembly of the BED files","nullable":true},"bed_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bed Type","description":"type of BED file, eg. \"bed3\", \"bed6+4\"","nullable":true},"bed_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bed Format","description":"format type of BED file, narrowpeak, broadpeak, or bed","nullable":true},"bedfile":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Bedfile","description":"BED file","nullable":true},"bigbedfile":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Bigbedfile","description":"bigBed file","nullable":true},"regions_no":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Regions No","description":"Number of regions","nullable":true},"gc_content":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Gc Content","description":"GC content","nullable":true},"median_tss_dist":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median Tss Dist","description":"Median TSS distance","nullable":true},"mean_region_width":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Mean Region Width","description":"Mean region width","nullable":true},"exon_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Exon Frequency","description":"Exon frequency","nullable":true},"intron_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intron Frequency","description":"Intron frequency","nullable":true},"promoterprox_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promoterprox Frequency","description":"Promoter frequency","nullable":true},"intergenic_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intergenic Frequency","description":"Intergenic frequency","nullable":true},"promotercore_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promotercore Frequency","description":"Promoter core frequency","nullable":true},"fiveutr_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fiveutr Frequency","description":"5' UTR frequency","nullable":true},"threeutr_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threeutr Frequency","description":"3' UTR frequency","nullable":true},"fiveutr_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fiveutr Percentage","description":"5' UTR percentage","nullable":true},"threeutr_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threeutr Percentage","description":"3' UTR percentage","nullable":true},"promoterprox_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promoterprox Percentage","description":"Promoter proc percentage","nullable":true},"exon_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Exon Percentage","description":"Exon percentage","nullable":true},"intron_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intron Percentage","description":"Intron percentage","nullable":true},"intergenic_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intergenic Percentage","description":"Intergenic percentage","nullable":true},"promotercore_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promotercore Percentage","description":"Promoter core percentage","nullable":true},"tssdist":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Tssdist","description":"Region-TSS distance plot","nullable":true},"chrombins":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Chrombins","description":"Regions distribution over chromosomes plot","nullable":true},"gccontent":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Gccontent","description":"GC content plot","nullable":true},"partitions":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Partitions","description":"Regions distribution over genomic partitions plot","nullable":true},"expected_partitions":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Expected Partitions","description":"Expected distribution over genomic partitions plot","nullable":true},"cumulative_partitions":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Cumulative Partitions","description":"Cumulative distribution over genomic partitions plot","nullable":true},"widths_histogram":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Widths Histogram","description":"Quantile-trimmed histogram of widths","nullable":true},"neighbor_distances":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Neighbor Distances","description":"Distance between neighbor regions","nullable":true},"open_chromatin":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Open Chromatin","description":"Cell specific enrichment for open chromatin plot","nullable":true},"other":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Other","description":"Other, not categorized BED file metadata","nullable":true},"upload_status":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Upload Status","description":"Status of the upload to the databases: Dict[s3, qdrant, pephub]","nullable":true}},"additionalProperties":true,"type":"object","title":"BedFile"},"BedMetadataResponse":{"properties":{"record_identifier":{"type":"string","title":"Record Identifier"},"metadata":{"$ref":"#/components/schemas/BedFile"},"raw":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Raw"}},"type":"object","required":["record_identifier","metadata"],"title":"BedMetadataResponse"},"BedSet":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"BED set name","nullable":true},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"description of the BED set","nullable":true},"md5sum":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Md5Sum","description":"digest of the BED set","nullable":true},"genome":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Genome","description":"genome assembly of the BED sets","nullable":true},"bedset_means":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Bedset Means","description":"Mean statistics of the BED files in this BED set","nullable":true},"bedset_standard_deviation":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Bedset Standard Deviation","description":"Standard deviations of statistics of the BED files in this BED set","nullable":true},"region_commonality":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Region Commonality","description":"Region commonality plot","nullable":true},"processed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Processed","description":"whether the BED set stats/plot are completed","nullable":true},"pephub_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pephub Path","description":"PEPhub registry path","nullable":true}},"additionalProperties":true,"type":"object","title":"BedSet"},"BedSetMetadataResponse":{"properties":{"record_identifier":{"type":"string","title":"Record Identifier"},"metadata":{"$ref":"#/components/schemas/BedSet"},"raw":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Raw"}},"type":"object","required":["record_identifier","metadata"],"title":"BedSetMetadataResponse"},"BedsetResponse":{"properties":{"bedset_record_id":{"type":"string","title":"Bedset Record Id"},"number_of_bedfiles":{"type":"integer","title":"Number Of Bedfiles"},"bedfile_metadata":{"items":{"type":"object"},"type":"array","title":"Bedfile Metadata"}},"type":"object","required":["bedset_record_id","number_of_bedfiles","bedfile_metadata"],"title":"BedsetResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ListBedFilesResponse":{"properties":{"total_size":{"type":"integer","title":"Total Size"},"page_size":{"type":"integer","title":"Page Size"},"next_page_token":{"type":"integer","title":"Next Page Token"},"records":{"items":{"$ref":"#/components/schemas/RecordsIdReturn"},"type":"array","title":"Records"}},"type":"object","required":["total_size","page_size","next_page_token","records"],"title":"ListBedFilesResponse"},"RecordsIdReturn":{"properties":{"record_identifier":{"type":"string","title":"Record Identifier"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","default":[null]}},"type":"object","title":"RecordsIdReturn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"home","description":"General landing page and service info"},{"name":"objects","description":"Download BED files or BEDSET files via [GA4GH DRS standard](https://ga4gh.github.io/data-repository-service-schemas/). For details, see [BEDbase Developer Guide](/docs/guide)."},{"name":"bed","description":"Endpoints for retrieving metadata for BED records"},{"name":"bedset","description":"Endpoints for retrieving metadata for BEDSET records"},{"name":"search","description":"Discovery-oriented endpoints for finding records of interest"}]} \ No newline at end of file +{"openapi":"3.1.0","info":{"title":"bedhost","description":"BED file/sets statistics and image server API","version":"0.4.0"},"paths":{"/":{"get":{"tags":["home"],"summary":"API intro page","description":"Display the index UI page","operationId":"index__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/docs/changelog":{"get":{"tags":["home"],"summary":"Release notes","operationId":"changelog_docs_changelog_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/v1/stats":{"get":{"tags":["base"],"summary":"Get summary statistics for the DRS object store","description":"Returns statistics","operationId":"get_bedbase_db_stats_v1_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsReturn"}}}}}}},"/v1/service-info":{"get":{"tags":["base"],"summary":"GA4GH service info","description":"Returns information about this service, such as versions, name, etc.","operationId":"service_info_v1_service_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceInfoResponse"}}}}}}},"/v1/bed/example":{"get":{"tags":["bed"],"summary":"Get example BED record metadata","description":"Get metadata for an example BED record.","operationId":"get_example_bed_record_v1_bed_example_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedMetadata"}}}}}}},"/v1/bed/list":{"get":{"tags":["bed"],"summary":"Paged list of all BED records","description":"Returns list of BED files in the database with optional filters.","operationId":"list_beds_v1_bed_list_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":1000,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"genome","in":"query","required":false,"schema":{"type":"string","description":"filter by genome of the bed file. e.g. 'hg38'","title":"Genome"},"description":"filter by genome of the bed file. e.g. 'hg38'"},{"name":"bed_type","in":"query","required":false,"schema":{"type":"string","description":"filter by bed type. e.g. 'bed6+4'","title":"Bed Type"},"description":"filter by bed type. e.g. 'bed6+4'"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedListResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/metadata":{"get":{"tags":["bed"],"summary":"Get metadata for a single BED record","description":"Example\n bed_id: bbad85f21962bb8d972444f7f9a3a932","operationId":"get_bed_metadata_v1_bed__bed_id__metadata_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"},{"name":"full","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Return full record with stats, plots, files and metadata","default":false,"title":"Full"},"description":"Return full record with stats, plots, files and metadata"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/metadata/plots":{"get":{"tags":["bed"],"summary":"Get plots for a single BED record","description":"Example\n bed_id: bbad85f21962bb8d972444f7f9a3a932","operationId":"get_bed_plots_v1_bed__bed_id__metadata_plots_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedPlots"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/metadata/files":{"get":{"tags":["bed"],"summary":"Get metadata for a single BED record","description":"Example\n bed_id: bbad85f21962bb8d972444f7f9a3a932","operationId":"get_bed_files_v1_bed__bed_id__metadata_files_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedFiles"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/metadata/stats":{"get":{"tags":["bed"],"summary":"Get stats for a single BED record","description":"Example\n bed_id: bbad85f21962bb8d972444f7f9a3a932","operationId":"get_bed_stats_v1_bed__bed_id__metadata_stats_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedStatsModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/metadata/classification":{"get":{"tags":["bed"],"summary":"Get classification of single BED file","description":"Example\n bed_id: bbad85f21962bb8d972444f7f9a3a932","operationId":"get_bed_classification_v1_bed__bed_id__metadata_classification_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedClassification"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/metadata/raw":{"get":{"tags":["bed"],"summary":"Get raw metadata for a single BED record","description":"Returns raw metadata for a single BED record. This metadata is stored in PEPHub. And is not verified.Example\n bed_id: bbad85f21962bb8d972444f7f9a3a932","operationId":"get_bed_pephub_v1_bed__bed_id__metadata_raw_get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedPEPHub"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/{bed_id}/regions/{chr_num}":{"get":{"tags":["bed"],"summary":"Get regions from a BED file that overlap a query region.","description":"Returns the queried regions with provided ID and optional query parameters","operationId":"get_regions_for_bedfile_v1_bed__bed_id__regions__chr_num__get","parameters":[{"name":"bed_id","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":32,"pattern":"^\\w+$","description":"BED digest","title":"Bed Id"},"description":"BED digest"},{"name":"chr_num","in":"path","required":true,"schema":{"type":"string","pattern":"^\\S+$","description":"Chromosome number","title":"Chr Num"},"description":"Chromosome number","example":"chr1"},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"query range: start coordinate","title":"Start"},"description":"query range: start coordinate"},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"query range: start coordinate","title":"End"},"description":"query range: start coordinate"}],"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/search/text":{"post":{"tags":["bed","search"],"summary":"Search for a BedFile","description":"Search for a BedFile by a text query.\nExample: query=\"cancer\"","operationId":"text_to_bed_search_v1_bed_search_text_post","parameters":[{"name":"query","in":"query","required":true,"schema":{"title":"Query"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedListSearchResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bed/search/bed":{"post":{"tags":["bed","search"],"summary":"Search for similar bed files","operationId":"text_to_bed_search_v1_bed_search_bed_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_text_to_bed_search_v1_bed_search_bed_post"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedListSearchResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bedset/example":{"get":{"tags":["bedset"],"summary":"Get metadata for an example BEDset record","operationId":"get_example_bedset_record_v1_bedset_example_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetMetadata"}}}}}}},"/v1/bedset/list":{"get":{"tags":["bedset","search"],"summary":"Paged list of all BEDset records","description":"Returns a list of BEDset records in the database with optional filters and search.","operationId":"list_bedsets_v1_bedset_list_get","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string","title":"Query"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":1000,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetListResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bedset/{bedset_id}/metadata":{"get":{"tags":["bedset"],"summary":"Get all metadata for a single BEDset record","description":"Example\n bed_id: gse218680","operationId":"get_bedset_metadata_v1_bedset__bedset_id__metadata_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}},{"name":"full","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Full"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bedset/{bedset_id}/metadata/plots":{"get":{"tags":["bedset"],"summary":"Get plots for single bedset record","description":"Example\n bed_id: gse218680","operationId":"get_bedset_metadata_v1_bedset__bedset_id__metadata_plots_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetPlots"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bedset/{bedset_id}/metadata/stats":{"get":{"tags":["bedset"],"summary":"Get stats for a single BEDSET record","description":"Example\n bed_id: gse218680","operationId":"get_bedset_metadata_v1_bedset__bedset_id__metadata_stats_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetStats"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bedset/{bedset_id}/bedfiles":{"get":{"tags":["bedset"],"summary":"Get Bedfiles In Bedset","description":"Example\n bed_id: gse218680","operationId":"get_bedfiles_in_bedset_v1_bedset__bedset_id__bedfiles_get","parameters":[{"name":"bedset_id","in":"path","required":true,"schema":{"type":"string","title":"Bedset Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"full","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Full"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BedSetBedFiles"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/objects/{object_id}":{"get":{"tags":["objects"],"summary":"Get DRS object metadata","description":"Returns metadata about a DrsObject.","operationId":"get_drs_object_metadata_v1_objects__object_id__get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DRSModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/objects/{object_id}/access/{access_id}":{"get":{"tags":["objects"],"summary":"Get URL where you can retrieve files","description":"Returns a URL that can be used to fetch the bytes of a DrsObject.","operationId":"get_object_bytes_url_v1_objects__object_id__access__access_id__get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}},{"name":"access_id","in":"path","required":true,"schema":{"type":"string","title":"Access Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"string","title":"Response Get Object Bytes Url V1 Objects Object Id Access Access Id Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/objects/{object_id}/access/{access_id}/bytes":{"get":{"tags":["objects"],"summary":"Download actual file","description":"Returns the bytes of a DrsObject.","operationId":"get_object_bytes_v1_objects__object_id__access__access_id__bytes_get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}},{"name":"access_id","in":"path","required":true,"schema":{"type":"string","title":"Access Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"string","format":"binary","title":"Response Get Object Bytes V1 Objects Object Id Access Access Id Bytes Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/objects/{object_id}/access/{access_id}/thumbnail":{"get":{"tags":["objects"],"summary":"Download thumbnail file","description":"Returns the bytes of a thumbnail of a DrsObject","operationId":"get_object_thumbnail_v1_objects__object_id__access__access_id__thumbnail_get","parameters":[{"name":"object_id","in":"path","required":true,"schema":{"type":"string","title":"Object Id"}},{"name":"access_id","in":"path","required":true,"schema":{"type":"string","title":"Access Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"string","format":"binary","title":"Response Get Object Thumbnail V1 Objects Object Id Access Access Id Thumbnail Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AccessMethod":{"properties":{"type":{"type":"string","title":"Type"},"access_url":{"anyOf":[{"$ref":"#/components/schemas/AccessURL"},{"type":"null"}]},"access_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Access Id"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"}},"type":"object","required":["type"],"title":"AccessMethod"},"AccessURL":{"properties":{"url":{"type":"string","title":"Url"},"headers":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["url"],"title":"AccessURL"},"BedClassification":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"genome_alias":{"type":"string","title":"Genome Alias"},"genome_digest":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genome Digest"},"bed_type":{"type":"string","pattern":"^bed(?:[3-9]|1[0-5])(?:\\+|$)[0-9]?+$","title":"Bed Type","default":"bed3"},"bed_format":{"type":"string","title":"Bed Format"}},"type":"object","title":"BedClassification"},"BedFiles":{"properties":{"bed_file":{"anyOf":[{"$ref":"#/components/schemas/FileModel"},{"type":"null"}]},"bigbed_file":{"anyOf":[{"$ref":"#/components/schemas/FileModel"},{"type":"null"}]}},"type":"object","title":"BedFiles"},"BedListResult":{"properties":{"count":{"type":"integer","title":"Count"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"results":{"items":{"$ref":"#/components/schemas/BedMetadata"},"type":"array","title":"Results"}},"type":"object","required":["count","limit","offset","results"],"title":"BedListResult"},"BedListSearchResult":{"properties":{"count":{"type":"integer","title":"Count"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"results":{"items":{"$ref":"#/components/schemas/QdrantSearchResult"},"type":"array","title":"Results"}},"type":"object","required":["count","limit","offset"],"title":"BedListSearchResult"},"BedMetadata":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","default":""},"genome_alias":{"type":"string","title":"Genome Alias"},"genome_digest":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genome Digest"},"bed_type":{"type":"string","pattern":"^bed(?:[3-9]|1[0-5])(?:\\+|$)[0-9]?+$","title":"Bed Type","default":"bed3"},"bed_format":{"type":"string","title":"Bed Format"},"id":{"type":"string","title":"Id"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"submission_date":{"type":"string","format":"date-time","title":"Submission Date"},"last_update_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Update Date"},"stats":{"anyOf":[{"$ref":"#/components/schemas/BedStatsModel"},{"type":"null"}]},"plots":{"anyOf":[{"$ref":"#/components/schemas/BedPlots"},{"type":"null"}]},"files":{"anyOf":[{"$ref":"#/components/schemas/BedFiles"},{"type":"null"}]},"raw_metadata":{"anyOf":[{"$ref":"#/components/schemas/BedPEPHub"},{"type":"null"}]}},"type":"object","required":["id"],"title":"BedMetadata"},"BedPEPHub":{"properties":{"sample_name":{"type":"string","title":"Sample Name"},"genome":{"type":"string","title":"Genome","default":""},"organism":{"type":"string","title":"Organism","default":""},"species_id":{"type":"string","title":"Species Id","default":""},"cell_type":{"type":"string","title":"Cell Type","default":""},"cell_line":{"type":"string","title":"Cell Line","default":""},"exp_protocol":{"type":"string","title":"Exp Protocol","description":"Experimental protocol (e.g. ChIP-seq)","default":""},"library_source":{"type":"string","title":"Library Source","description":"Library source (e.g. genomic, transcriptomic)","default":""},"genotype":{"type":"string","title":"Genotype","description":"Genotype of the sample","default":""},"target":{"type":"string","title":"Target","description":"Target of the assay (e.g. H3K4me3)","default":""},"antibody":{"type":"string","title":"Antibody","description":"Antibody used in the assay","default":""},"treatment":{"type":"string","title":"Treatment","description":"Treatment of the sample (e.g. drug treatment)","default":""},"tissue":{"type":"string","title":"Tissue","description":"Tissue type","default":""},"global_sample_id":{"type":"string","title":"Global Sample Id","description":"Global sample identifier","default":""},"global_experiment_id":{"type":"string","title":"Global Experiment Id","description":"Global experiment identifier","default":""},"description":{"type":"string","title":"Description","description":"Description of the sample","default":""}},"additionalProperties":true,"type":"object","required":["sample_name"],"title":"BedPEPHub"},"BedPlots":{"properties":{"chrombins":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"gccontent":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"partitions":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"expected_partitions":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"cumulative_partitions":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"widths_histogram":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"neighbor_distances":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]},"open_chromatin":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]}},"type":"object","title":"BedPlots"},"BedSetBedFiles":{"properties":{"count":{"type":"integer","title":"Count"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"results":{"items":{"$ref":"#/components/schemas/BedMetadata"},"type":"array","title":"Results"}},"type":"object","required":["count","limit","offset","results"],"title":"BedSetBedFiles"},"BedSetListResult":{"properties":{"count":{"type":"integer","title":"Count"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"results":{"items":{"$ref":"#/components/schemas/BedSetMetadata"},"type":"array","title":"Results"}},"type":"object","required":["count","limit","offset","results"],"title":"BedSetListResult"},"BedSetMetadata":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"md5sum":{"type":"string","title":"Md5Sum"},"statistics":{"anyOf":[{"$ref":"#/components/schemas/BedSetStats"},{"type":"null"}]},"plots":{"anyOf":[{"$ref":"#/components/schemas/BedSetPlots"},{"type":"null"}]},"description":{"type":"string","title":"Description"},"bed_ids":{"items":{"type":"string"},"type":"array","title":"Bed Ids"}},"type":"object","required":["id","name","md5sum"],"title":"BedSetMetadata"},"BedSetPlots":{"properties":{"region_commonality":{"allOf":[{"$ref":"#/components/schemas/FileModel"}]}},"type":"object","title":"BedSetPlots"},"BedSetStats":{"properties":{"mean":{"allOf":[{"$ref":"#/components/schemas/BedStatsModel"}]},"sd":{"allOf":[{"$ref":"#/components/schemas/BedStatsModel"}]}},"type":"object","title":"BedSetStats"},"BedStatsModel":{"properties":{"regions_no":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Regions No"},"gc_content":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Gc Content"},"median_tss_dist":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median Tss Dist"},"mean_region_width":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Mean Region Width"},"exon_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Exon Frequency"},"exon_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Exon Percentage"},"intron_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intron Frequency"},"intron_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intron Percentage"},"intergenic_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intergenic Percentage"},"intergenic_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intergenic Frequency"},"promotercore_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promotercore Frequency"},"promotercore_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promotercore Percentage"},"fiveutr_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fiveutr Frequency"},"fiveutr_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fiveutr Percentage"},"threeutr_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threeutr Frequency"},"threeutr_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threeutr Percentage"},"promoterprox_frequency":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promoterprox Frequency"},"promoterprox_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promoterprox Percentage"}},"type":"object","title":"BedStatsModel"},"Body_text_to_bed_search_v1_bed_search_bed_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","title":"Body_text_to_bed_search_v1_bed_search_bed_post"},"ComponentVersions":{"properties":{"bedhost_version":{"type":"string","title":"Bedhost Version"},"bbconf_version":{"type":"string","title":"Bbconf Version"},"python_version":{"type":"string","title":"Python Version"},"openapi_version":{"type":"string","title":"Openapi Version"}},"type":"object","required":["bedhost_version","bbconf_version","python_version","openapi_version"],"title":"ComponentVersions"},"DRSModel":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"self_uri":{"type":"string","title":"Self Uri"},"size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Size"},"created_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created Time"},"updated_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated Time"},"checksums":{"type":"string","title":"Checksums"},"access_methods":{"items":{"$ref":"#/components/schemas/AccessMethod"},"type":"array","title":"Access Methods"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["id","self_uri","checksums","access_methods"],"title":"DRSModel"},"FileModel":{"properties":{"name":{"type":"string","title":"Name"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"path":{"type":"string","title":"Path"},"thumbnail_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Path"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Size"},"object_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Object Id"},"access_methods":{"items":{"$ref":"#/components/schemas/AccessMethod"},"type":"array","title":"Access Methods"}},"type":"object","required":["name","path"],"title":"FileModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Organization":{"properties":{"name":{"type":"string","title":"Name"},"url":{"type":"string","title":"Url"}},"type":"object","required":["name","url"],"title":"Organization"},"QdrantSearchResult":{"properties":{"id":{"type":"string","title":"Id"},"payload":{"type":"object","title":"Payload"},"score":{"type":"number","title":"Score"},"metadata":{"anyOf":[{"$ref":"#/components/schemas/BedMetadata"},{"type":"null"}]}},"type":"object","required":["id","payload","score"],"title":"QdrantSearchResult"},"ServiceInfoResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"type":{"$ref":"#/components/schemas/Type"},"description":{"type":"string","title":"Description"},"organization":{"$ref":"#/components/schemas/Organization"},"contactUrl":{"type":"string","title":"Contacturl"},"documentationUrl":{"type":"string","title":"Documentationurl"},"updatedAt":{"type":"string","title":"Updatedat"},"environment":{"type":"string","title":"Environment"},"version":{"type":"string","title":"Version"},"component_versions":{"$ref":"#/components/schemas/ComponentVersions"}},"type":"object","required":["id","name","type","description","organization","contactUrl","documentationUrl","updatedAt","environment","version","component_versions"],"title":"ServiceInfoResponse"},"StatsReturn":{"properties":{"bedfiles_number":{"type":"integer","title":"Bedfiles Number","default":0},"bedsets_number":{"type":"integer","title":"Bedsets Number","default":0},"genomes_number":{"type":"integer","title":"Genomes Number","default":0}},"type":"object","title":"StatsReturn"},"Type":{"properties":{"group":{"type":"string","title":"Group"},"artifact":{"type":"string","title":"Artifact"},"version":{"type":"string","title":"Version"}},"type":"object","required":["group","artifact","version"],"title":"Type"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"home","description":"General landing page and service info"},{"name":"base","description":"Basic endpoints for the service and statistics."},{"name":"objects","description":"Download BED files or BEDSET files via [GA4GH DRS standard](https://ga4gh.github.io/data-repository-service-schemas/). For details, see [BEDbase Developer Guide](/docs/guide)."},{"name":"bed","description":"Endpoints for retrieving metadata for BED records"},{"name":"bedset","description":"Endpoints for retrieving metadata for BEDSET records"},{"name":"search","description":"Discovery-oriented endpoints for finding records of interest"}]} \ No newline at end of file diff --git a/man/bb_beds_in_bedset-BEDbase-method.Rd b/man/bb_beds_in_bedset-BEDbase-method.Rd index ef3abdb..e1380e1 100644 --- a/man/bb_beds_in_bedset-BEDbase-method.Rd +++ b/man/bb_beds_in_bedset-BEDbase-method.Rd @@ -4,10 +4,16 @@ \alias{bb_beds_in_bedset,BEDbase-method} \title{Get BEDs associated with BEDset} \usage{ -\S4method{bb_beds_in_bedset}{BEDbase}(x, rec_id) +\S4method{bb_beds_in_bedset}{BEDbase}(x, rec_id, limit = 100, offset = 0, full = FALSE) } \arguments{ \item{rec_id}{integer() BEDset record identifier} + +\item{limit}{integer() (defaults to 100) maximum records to include} + +\item{offset}{integer() (defaults to 0) page offset} + +\item{full}{logical() (defaults to FALSE) include all metadata} } \value{ list() BED record identifiers @@ -17,6 +23,6 @@ Get BEDs associated with BEDset } \examples{ client <- BEDbase() -bb_beds_in_bedset(client, "bed") -rec_id <- "421d2128e183424fcc6a74269bae7934" +rec_id <- "gse218680" +bb_beds_in_bedset(client, rec_id) } diff --git a/man/bb_count-BEDbase-method.Rd b/man/bb_count-BEDbase-method.Rd deleted file mode 100644 index 04fc7fe..0000000 --- a/man/bb_count-BEDbase-method.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bedbaser.R -\name{bb_count,BEDbase-method} -\alias{bb_count,BEDbase-method} -\title{Count BEDs or BEDsets} -\usage{ -\S4method{bb_count}{BEDbase}(x, rec_type = c("bed", "bedset")) -} -\arguments{ -\item{rec_type}{character() bed or bedset} -} -\value{ -integer() the number of BEDs or BEDsets available -} -\description{ -Count BEDs or BEDsets -} -\examples{ -client <- BEDbase() -bb_count(client, "bed") - -} diff --git a/man/bb_genomes-BEDbase-method.Rd b/man/bb_genomes-BEDbase-method.Rd deleted file mode 100644 index 863b2b0..0000000 --- a/man/bb_genomes-BEDbase-method.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bedbaser.R -\name{bb_genomes,BEDbase-method} -\alias{bb_genomes,BEDbase-method} -\title{Get genome assemblies in BEDbase} -\usage{ -\S4method{bb_genomes}{BEDbase}(x, rec_type = c("bed", "bedset")) -} -\arguments{ -\item{rec_type}{character() BED or BEDset} -} -\value{ -tibble -} -\description{ -Get genome assemblies in BEDbase -} -\examples{ -client <- BEDbase() -bb_genomes(client, "bed") - -} diff --git a/man/bb_list_beds-BEDbase-method.Rd b/man/bb_list_beds-BEDbase-method.Rd new file mode 100644 index 0000000..55b7247 --- /dev/null +++ b/man/bb_list_beds-BEDbase-method.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bedbaser.R +\name{bb_list_beds,BEDbase-method} +\alias{bb_list_beds,BEDbase-method} +\title{List BEDs} +\usage{ +\S4method{bb_list_beds}{BEDbase}(x, genome = NULL, bed_type = NULL, limit = 1000, offset = 0) +} +\arguments{ +\item{genome}{character() (defaults to NULL) genome keyword} + +\item{bed_type}{character() (defaults to NULL) bed file type} + +\item{limit}{integer() (defaults to 1000) maximum records} + +\item{offset}{integer() (defaults to 0) page token of records} +} +\value{ +a tibble of BED records +} +\description{ +List BEDs +} +\examples{ +client <- BEDbase() +bb_list_beds(client) + +} diff --git a/man/bb_list_bedsets-BEDbase-method.Rd b/man/bb_list_bedsets-BEDbase-method.Rd new file mode 100644 index 0000000..84fa3fb --- /dev/null +++ b/man/bb_list_bedsets-BEDbase-method.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bedbaser.R +\name{bb_list_bedsets,BEDbase-method} +\alias{bb_list_bedsets,BEDbase-method} +\title{List BEDsets} +\usage{ +\S4method{bb_list_bedsets}{BEDbase}(x, query = NULL, limit = 1000, offset = 0) +} +\arguments{ +\item{query}{character() (defaults to NULL) BEDset keyword} + +\item{limit}{integer() (defaults to 1000) maximum records} + +\item{offset}{integer() (defaults to 0) page token of records} +} +\value{ +a tibble of BEDset records +} +\description{ +List BEDsets +} +\examples{ +client <- BEDbase() +bb_list_bedsets(client) + +} diff --git a/man/bb_metadata-BEDbase-method.Rd b/man/bb_metadata-BEDbase-method.Rd index f772207..04d1a3f 100644 --- a/man/bb_metadata-BEDbase-method.Rd +++ b/man/bb_metadata-BEDbase-method.Rd @@ -4,12 +4,14 @@ \alias{bb_metadata,BEDbase-method} \title{Get metadata for an BED or BEDset} \usage{ -\S4method{bb_metadata}{BEDbase}(x, id, rec_type = c("bed", "bedset")) +\S4method{bb_metadata}{BEDbase}(x, id, rec_type = c("bed", "bedset"), full = TRUE) } \arguments{ \item{id}{integer() record or object identifier} \item{rec_type}{character() BED or BEDset} + +\item{full}{logical() include all metadata} } \value{ list() metadata @@ -19,6 +21,6 @@ Get metadata for an BED or BEDset } \examples{ client <- BEDbase() -bb_metadata(client, "421d2128e183424fcc6a74269bae7934", "bed") +bb_metadata(client, "0dcdf8986a72a3d85805bbc9493a1302", "bed") } diff --git a/man/bb_metadata_classification-BEDbase-method.Rd b/man/bb_metadata_classification-BEDbase-method.Rd new file mode 100644 index 0000000..88c3577 --- /dev/null +++ b/man/bb_metadata_classification-BEDbase-method.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bedbaser.R +\name{bb_metadata_classification,BEDbase-method} +\alias{bb_metadata_classification,BEDbase-method} +\title{Get BED metadata classification} +\usage{ +\S4method{bb_metadata_classification}{BEDbase}(x, rec_id) +} +\arguments{ +\item{rec_id}{BEDbase record identifier} +} +\value{ +tibble() records +} +\description{ +Get BED metadata classification +} +\examples{ +client <- BEDbase() +bb_metadata_classification(client, "bbad85f21962bb8d972444f7f9a3a932") + +} diff --git a/man/bb_metadata_files-BEDbase-method.Rd b/man/bb_metadata_files-BEDbase-method.Rd new file mode 100644 index 0000000..1ae9d4c --- /dev/null +++ b/man/bb_metadata_files-BEDbase-method.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bedbaser.R +\name{bb_metadata_files,BEDbase-method} +\alias{bb_metadata_files,BEDbase-method} +\title{BED files metadata} +\usage{ +\S4method{bb_metadata_files}{BEDbase}(x, rec_id) +} +\arguments{ +\item{rec_id}{integer() BED record identifier} +} +\value{ +tibble() records +} +\description{ +BED files metadata +} +\examples{ +client <- BEDbase() +metadata <- bb_metadata_files(client, "bbad85f21962bb8d972444f7f9a3a932") + +} diff --git a/man/bb_records-BEDbase-method.Rd b/man/bb_records-BEDbase-method.Rd deleted file mode 100644 index 9777f8a..0000000 --- a/man/bb_records-BEDbase-method.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bedbaser.R -\name{bb_records,BEDbase-method} -\alias{bb_records,BEDbase-method} -\title{Get record identifiers and names for BEDs or BEDsets} -\usage{ -\S4method{bb_records}{BEDbase}(x, rec_type = c("bed", "bedset"), limit = NULL, token = NULL) -} -\arguments{ -\item{rec_type}{character() bed or bedset} - -\item{limit}{integer() (defaults to NULL) maximum records} - -\item{token}{integer() (defaults to NULL) page token of records} -} -\value{ -a tibble of record identifiers and record names -} -\description{ -Note: how to get next page token -} -\examples{ -client <- BEDbase() -bb_records(client, "bed") - -} diff --git a/man/bb_search-BEDbase-method.Rd b/man/bb_search-BEDbase-method.Rd new file mode 100644 index 0000000..e13b23d --- /dev/null +++ b/man/bb_search-BEDbase-method.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bedbaser.R +\name{bb_search,BEDbase-method} +\alias{bb_search,BEDbase-method} +\title{Search BEDbase} +\usage{ +\S4method{bb_search}{BEDbase}(x, query, limit = 10, offset = 0) +} +\arguments{ +\item{query}{character() keywords to search} + +\item{limit}{integer() (defaults to 10) maximum number of results} + +\item{offset}{integer() (defaults to 0) page offset of results} +} +\value{ +tibble() +} +\description{ +Search BEDbase +} +\examples{ +client <- BEDbase() +bb_search(client, "excluderanges") + +} diff --git a/man/bb_search.Rd b/man/bb_search.Rd deleted file mode 100644 index b7462e2..0000000 --- a/man/bb_search.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bedbaser.R -\name{bb_search} -\alias{bb_search} -\title{Search BEDbase} -\usage{ -bb_search(x, query, limit = NULL, offset = NULL) -} -\arguments{ -\item{query}{character() keywords to search} - -\item{limit}{integer() (defaults to NULL) maximum number of results} - -\item{offset}{integer() (defaults to NULL) page offset of results} -} -\value{ -tibble() -} -\description{ -Search BEDbase -} -\examples{ -bb_bedbase("excluderanges") - -} diff --git a/man/bb_to_granges-BEDbase-method.Rd b/man/bb_to_granges-BEDbase-method.Rd new file mode 100644 index 0000000..4905cef --- /dev/null +++ b/man/bb_to_granges-BEDbase-method.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bedbaser.R +\name{bb_to_granges,BEDbase-method} +\alias{bb_to_granges,BEDbase-method} +\title{Create a GRanges object given a BED id} +\usage{ +\S4method{bb_to_granges}{BEDbase}(x, rec_id, file_type = c("bed", "bigbed"), quietly = FALSE) +} +\arguments{ +\item{rec_id}{BEDbase record identifier} + +\item{file_type}{character() bed or bigbed} + +\item{quietly}{logical() (defaults to FALSE) display messages} +} +\value{ +a GRanges object +} +\description{ +Create a GRanges object given a BED id +} +\examples{ +client <- BEDbase() +bb_to_granges(client, "421d2128e183424fcc6a74269bae7934") + +} diff --git a/man/dot-download_and_cache.Rd b/man/dot-download_and_cache.Rd index b3f2442..cc891c3 100644 --- a/man/dot-download_and_cache.Rd +++ b/man/dot-download_and_cache.Rd @@ -4,12 +4,12 @@ \alias{.download_and_cache} \title{Retrieve path from cache or download file and cache} \usage{ -.download_and_cache(url, quiet = FALSE) +.download_and_cache(url, quietly = FALSE) } \arguments{ \item{url}{character() remote resource} -\item{quiet}{logical() display message} +\item{quietly}{logical() display message} } \value{ filepath character() diff --git a/man/dot-file_to_granges.Rd b/man/dot-file_to_granges.Rd new file mode 100644 index 0000000..0611ec5 --- /dev/null +++ b/man/dot-file_to_granges.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{.file_to_granges} +\alias{.file_to_granges} +\title{Format BED file metadata} +\usage{ +.file_to_granges(file_path, bed_type, bed_format) +} +\arguments{ +\item{file_path}{character() path to BED file} + +\item{bed_type}{character() bed type} + +\item{bed_format}{character() format name} +} +\value{ +GRanges() +} +\description{ +Format BED file metadata +} +\examples{ +.file_to_granges(file_path, bed_type, bed_format) +} diff --git a/man/dot-format_metadata_files.Rd b/man/dot-format_metadata_files.Rd new file mode 100644 index 0000000..619cacb --- /dev/null +++ b/man/dot-format_metadata_files.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{.format_metadata_files} +\alias{.format_metadata_files} +\title{Format BED file metadata} +\usage{ +.format_metadata_files(records) +} +\arguments{ +\item{records}{list() metadata records} +} +\value{ +tibble() file metadata +} +\description{ +Format BED file metadata +} +\examples{ +client <- BEDbase() +example <- content(client$get_example_bed_record_v1_bed_example_get()) +.format_metadata_files(example$files) +} diff --git a/man/dot-ungzip.Rd b/man/dot-ungzip.Rd new file mode 100644 index 0000000..57b8957 --- /dev/null +++ b/man/dot-ungzip.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{.ungzip} +\alias{.ungzip} +\title{Decompress gunzip file} +\usage{ +.ungzip(file_path) +} +\arguments{ +\item{file_path}{character() path to gunzip file} +} +\value{ +character() decompressed file path +} +\description{ +Decompress gunzip file +} +\examples{ +.ungzip("path/to/my.gzip") +} diff --git a/man/download_file.Rd b/man/download_file.Rd deleted file mode 100644 index 56a5caa..0000000 --- a/man/download_file.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bedbaser.R -\name{download_file} -\alias{download_file} -\title{Download BED or thumbnail} -\usage{ -download_file( - rec_id, - file_type = c("bytes", "thumbnail"), - acc_id = "http", - quiet = FALSE -) -} -\arguments{ -\item{rec_id}{integer() BED record identifier} - -\item{file_type}{character() type of file to download, bytes or thumbnail} - -\item{acc_id}{character() (default http) access identifier, "local" -is removed.} - -\item{quiet}{logical() (default FALSE) display message} -} -\value{ -character() path to file -} -\description{ -Download BED or thumbnail -} -\examples{ -telomere <- download_file("80d2b2581bb25fa6b73ec56c11969fb3", "bytes") - -} diff --git a/man/get_access_ids.Rd b/man/get_access_ids.Rd deleted file mode 100644 index c109fb1..0000000 --- a/man/get_access_ids.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{get_access_ids} -\alias{get_access_ids} -\title{Get valid access identifiers} -\usage{ -get_access_ids(obj_id, quiet = FALSE) -} -\arguments{ -\item{obj_id}{character() BEDbase object record identifier} - -\item{quiet}{logical() (default FALSE) display message} -} -\value{ -character() available access identifiers -} -\description{ -Note: omits 'local' option -} -\examples{ -get_access_ids("bed.421d2128e183424fcc6a74269bae7934.bedfile") -} diff --git a/man/get_rec_type.Rd b/man/get_rec_type.Rd deleted file mode 100644 index baae8e9..0000000 --- a/man/get_rec_type.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{get_rec_type} -\alias{get_rec_type} -\title{Get record type} -\usage{ -get_rec_type(id) -} -\arguments{ -\item{id}{character() BEDbase identifier} -} -\value{ -logical() -} -\description{ -Get record type -} -\examples{ -get_rec_type("eaf9ee97241f300f1c7e76e1f945141f") - -} diff --git a/man/make_obj_id.Rd b/man/make_obj_id.Rd index d9a1723..3dc7ee2 100644 --- a/man/make_obj_id.Rd +++ b/man/make_obj_id.Rd @@ -17,8 +17,8 @@ make_obj_id(rec_id, rec_type = "bed", result_id = "bedfile") String } \description{ -Note: only rec_type = bed, result_id = bedfile? +Construct object identifier } \examples{ -obj_id <- make_obj_id("eaf9ee97241f300f1c7e76e1f945141f") +obj_id <- make_obj_id("bbad85f21962bb8d972444f7f9a3a932") } diff --git a/tests/testthat/test-bedbaser.R b/tests/testthat/test-bedbaser.R index 3a62d0d..4ee187f 100644 --- a/tests/testthat/test-bedbaser.R +++ b/tests/testthat/test-bedbaser.R @@ -2,32 +2,12 @@ client <- BEDbase() # test that there's an internet connection -test_that("Check bb_count returns integers for BEDs and BEDsets or errors", { - expect_true(is.integer(bb_count(client, "bed"))) - expect_true(is.integer(bb_count(client, "bedset"))) - expect_error(bb_count(client, "objects")) -}) - -test_that("Check bb_genomes returns a tibble for BEDs and BEDsets or errors", { - bed_genomes <- bb_genomes(client, "bed") - expect_true(is_tibble(bed_genomes)) - expect_contains(bed_genomes$alias, c("ce10", "ce11", "hg19", "hg38")) - #bedset_genomes <- bb_genomes(client, "bedset") - #expect_true(is_tibble(bedset_genomes)) - #expect_contains(bedset_genomes$alias, c("ce10", "ce11", "hg19", "hg38")) - expect_error(bb_genomes(client, "object")) -}) - test_that("Check bb_metadata for BEDs, BEDsets, and invalid input", { - ex_bed <- content(client$get_example_bed_record_bed_example_get()) + ex_bed <- content(client$get_example_bed_record_v1_bed_example_get()) bed <- bb_metadata(client, ex_bed$record_identifier, "bed") - # Removing id - ex_bed$metadata <- ex_bed$metadata[-38] expect_identical(ex_bed$metadata, bed) - ex_bedset <-content(client$get_example_bedset_record_bedset_example_get()) + ex_bedset <-content(client$get_example_bedset_record_v1_bedset_example_get()) bedset <- bb_metadata(client, ex_bedset$record_identifier, "bedset") - # Removing id - ex_bedset$metadata <- ex_bedset$metadata[-38] expect_identical(ex_bedset$metadata, bedset) }) diff --git a/vignettes/bedbaser.Rmd b/vignettes/bedbaser.Rmd index de98c78..893b720 100644 --- a/vignettes/bedbaser.Rmd +++ b/vignettes/bedbaser.Rmd @@ -21,8 +21,9 @@ library(bedbaser) bedbaser is an R client for [BEDbase](https://bedbase.org) a platform for genomic region data, allowing users to search BED files and curate collections. bedbaser provides convenience functions to interact with the -[BEDbase API](https://api.bedbase.org) but it also allow more direct -interaction with the API through `r Biocpkg("AnVIL")`'s `Service` class. +[BEDbase API](https://api.bedbase.org). It also allow more direct +interaction with the API through `r Biocpkg("AnVIL")`'s `Service` class and +imports BED files into `GRanges` objects. ## Install bedbaser @@ -49,8 +50,8 @@ with `r CRANpkg("httr")`. ```{r count_bed_record_bed_count_get} library(httr) -resp <- client$get_example_bed_record_bed_example_get() -example_bed <- content(resp) +rsp <- client$get_example_bed_record_v1_bed_example_get() +example_bed <- content(rsp) ``` bedbaser includes convenience functions prefixed with *bb_* to facilitate @@ -58,15 +59,14 @@ finding BEDs, exploring their metadata, and download files. ## Find a BED file or BEDset -Use `bb_records()` to browse available resources in BEDbase. `bb_records()` +Use `bb_list()` to browse available resources in BEDbase. `bb_list()` will display the record identifiers and names of BED files and BEDsets. Record identifiers can be used to access a specific resource. -```{r get_records} -# limit to 10 results, -bb_records(client, "bed") +```{r bb_list_beds} +bb_list_beds(client) -bb_records(client, "bedset") +bb_list_bedsets(client) ``` ### Examine metadata @@ -74,8 +74,11 @@ bb_records(client, "bedset") Use `bb_metadata()` to learn more about a BED or BEDset associated with a record identifier. -```{r get_metadata} -bb_metadata(client, example_bed$record_identifier, "bed") +Note: Currently a list of lists, but maybe could be a better format? + +```{r bb_metadata} +metadata <- bb_metadata(client, example_bed$id, "bed") + ``` ### Show BED files in BEDset @@ -91,18 +94,22 @@ bb_beds_in_bedset(client, "excluderanges") Search for BED files by keywords: -```{r search_bedbase, eval=FALSE} -# Currently not working -results <- search_bedbase("hg13", limit = 20) +```{r bb_search, eval=FALSE} +# Currently not working correctly +results <- bb_search(client, "hg13") +results ``` -## Download a BED file +## Import a BED into a GRanges object Download a BED file by its record identifier: -```{r downloadBedFile, eval=FALSE} -# Need to rewrite function -filepath <- download_file(example_bed$record_identifier, "bytes") +Note: Still in development, working for broadPeak, narrowPeak, and BEDX+0 + +```{r bb_to_granges} +rec_id <- "bbad85f21962bb8d972444f7f9a3a932" +obj <- bb_to_granges(client, rec_id, file_type="bed", quietly = TRUE) +obj ``` ## SessionInfo()