Skip to content

Commit

Permalink
registry and documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oganm committed Jul 3, 2024
1 parent f6d0277 commit 87ec765
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 8 additions & 1 deletion inst/script/registry.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ names(overrides) = overrides %>% sapply(function(x){
})


res = httr::GET('https://gemma.msl.ubc.ca/rest/v2/openapi.json')
res = httr::GET(paste0(gemmaPath(),'openapi.json'))
writeBin(res$content,con = 'inst/script/openapi.json')
api_file = jsonlite::fromJSON(readLines('inst/script/openapi.json'),simplifyVector = FALSE)

Expand Down Expand Up @@ -131,6 +131,7 @@ registerEndpoint(
#' query across multiple datasets and being able to use the filter argument
#' to search based on result set properties.
#'
#' @param datasets A vector of dataset IDs or short names
#'
#' @inherit processDifferentialExpressionAnalysisResultSetValueObject return
#'
Expand Down Expand Up @@ -294,6 +295,9 @@ registerEndpoint('datasets/{dataset}/analyses/differential',
# /datasets/{datasets}/expressions/genes/{genes}, get_dataset_expression_for_genes ------

#' get_dataset_expression_for_genes
#'
#' @param datasets A vector of dataset IDs or short names
#' @param genes A vector of NCBI IDs, Ensembl IDs or gene symbols.
#' @param consolidate An option for gene expression level consolidation. If empty,
#' will return every probe for the genes. "pickmax" to
#' pick the probe with the highest expression, "pickvar" to pick the prove with
Expand Down Expand Up @@ -636,6 +640,9 @@ registerEndpoint("genes/{gene}/probes?offset={offset}&limit={limit}",

#' get_genes
#'
#'
#' @param genes A vector of NCBI IDs, Ensembl IDs or gene symbols.
#'
#' @inherit processGenes return
#'
#' @examples
Expand Down
13 changes: 11 additions & 2 deletions inst/script/registry_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ parse_open_api_params <- function(prm){
out = prm$schema$oneOf %>% purrr::map_chr('description') %>%
gsub('.','',.,fixed= TRUE) %>% paste(collapse = ' or ') %>%
snakecase::to_sentence_case()
} else{
} else if(!is.null(prm$schema$type)) {
out = prm$schema$type
}else{
browser()
stop('help me!')
}
Expand Down Expand Up @@ -85,7 +87,7 @@ registerEndpoint <- function(endpoint,
return(NULL)
}

logEndpoint(fname, logname)
logEndpoint(fname, open_api_name)

# Make sure arguments are URL encoded
endpoint <- gsub("\\{([^\\}]+)\\}", "\\{encode\\(\\1\\)\\}", endpoint)
Expand Down Expand Up @@ -224,6 +226,13 @@ logEndpoint <- function(fname, logname) {
options(gemmaAPI.logged = c(getOption("gemmaAPI.logged"), setNames(fname, logname)))
}

clearLog <- function(){
options(gemmaAPI.logged = c())
}

getLog <- function(){
getOption('gemmaAPI.logged')
}

#' Comment a function
#'
Expand Down

0 comments on commit 87ec765

Please sign in to comment.