#' Calculate phenotypic similarity between set of terms
#' @param id ref_id
#' @param limit_rows limit_rows
#' @param taxon taxon
#' @param metric metric
#' @importFrom tibble as_tibble
#' @importFrom dplyr rename bind_cols
#' @importFrom httr user_agent modify_url GET
#' @rdname biolink_search_similar
#' @export
biolink_search_similar <- function(id, limit_rows, taxon, metric) {
# Check internet connection
check_internet()
if (!(metric %in% c('phenodigm', 'jaccard', 'simGIC', 'resnik', 'symmetric_resnik'))) {
stop("Metric not found")
}
# Set user agent header
names(id) <- rep('id', length(id))
id <- as.list(id)
metric <- list(metric = metric)
args <- append(id, metric)
url <- modify_url(base_url, path = paste0('api/', 'sim/search'))
resp <- GET(url, user_agent = ua, query = args)
check_response(resp)
parsed <- jsonlite::fromJSON(content(resp, as = "text", encoding = 'UTF-8'), simplifyVector = TRUE)
result_tbl <- parsed$matches %>% as_tibble()
result_tbl
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.