Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter autocomplete #36

Closed
bschilder opened this issue Aug 19, 2024 · 1 comment
Closed

Parameter autocomplete #36

bschilder opened this issue Aug 19, 2024 · 1 comment

Comments

@bschilder
Copy link
Contributor

A useful feature might be having a variable that contains the different options for each parameter. This both lets users know which options are available for each parameter (without having to look up the docs each time) and only have to type the first couple letters before hitting tab to complete the rest of the option.

For example, currently we have:

g <- monarch |>
	fetch_nodes(query_ids = c("MONDO:0018982", "MONDO:0011871")) |>
	expand(predicates = c("biolink:causes", "biolink:gene_associated_with_condition")) |>
	expand(categories = c("biolink:PhenotypicFeature"), limit = 10)

The variable could be automatically constructed from the engine default priorities as soon as the the engine is created. ie the create_engine_opts function would be called internal to monarch_engine.

That said, we'd need to add some more info about options for predicates.

create_engine_opts <- function(engine){
## Not shown: simplify names from "category_priority" to "categories" to match args in `expand`
opts <<- lapply(engine$preferences, function(x){ x|>`names<-`(gsub("biolink:","", x))|>as.list() })
}



monarch <- monarch_engine()

This would let users construct their queries like this:

g <- monarch |>
	fetch_nodes(query_ids = c("MONDO:0018982", "MONDO:0011871")) |>
	expand(predicates = c(opts$predicates$causes, opts$predicates$gene_associated_with_condition)) |>
	expand(categories = opts$categories$PhenotypicFeature, limit = 10)
@oneilsh
Copy link
Collaborator

oneilsh commented Jan 17, 2025

Closed by PR #48

@oneilsh oneilsh closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants