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

Make instantiation of Grounder more flexible #15

Merged
merged 4 commits into from Mar 17, 2020

Conversation

cthoyt
Copy link
Member

@cthoyt cthoyt commented Mar 16, 2020

This PR allows the user to either specify the terms_file argument to Grounder.__init__() as either a:

  • None -> look up the default path using gilda.resources.get_grounding_terms() as well as ensure the data has been downloaded from Amazon
  • str -> use the grounding terms file at the given path
  • dict -> use a pre-made dictionary of normalized names to terms, with the same structure as gilda.grounder.load_terms_file() returns

As a consequence, the redundant callings of Grounder(get_grounding_terms()) have been simplified to just Grounder().

This allows the user to either specify terms_file as:
- None -> look up the path and download the data from Amazon if necessary (old functionality)
- str -> look up the grounding terms file at the given path
- dict -> use a pre-made dictionary of normalized names to terms
Becuase of the functionality added in the last commit, the grounding terms path is looked up automatically (using the same get_grounding_terms() function) if none is given.
@bgyori bgyori merged commit 3e5ff23 into gyorilab:master Mar 17, 2020
@cthoyt cthoyt deleted the improve-api-extensibility branch March 17, 2020 14:38
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

Successfully merging this pull request may close these issues.

None yet

2 participants