Improve handling of ChEMBL database versions - #468
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes ChEMBL version handling more robust by removing the hard-coded “latest” version from the package and introducing a user/project-level pinning mechanism for offline ChEMBL usage.
Changes:
- Make “latest” ChEMBL resolution dynamic (via ChEMBL status endpoint) and shift multiple APIs to default
version = NULL. - Add
chembl_check_db_version()to resolve a pinned default version from.Renviron/.Rprofile(and export it). - Update tests and documentation to reflect the new versioning workflow.
Reviewed changes
Copilot reviewed 7 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-chembl.R | Updates online tests to avoid asserting a pinned “latest” version and tightens version validation expectations. |
| tests/testthat/test-chembl_offline.R | Switches offline tests to use pinned version via options and updates offline setup logic accordingly. |
| R/utils.R | Changes db_connect() default version behavior to use pinned defaults (via version = NULL). |
| R/chembl.R | Implements dynamic “latest” resolution in db_download_chembl() and changes multiple ChEMBL helpers to require explicit/pinned versions. |
| R/chembl_offline.R | Introduces and exports chembl_check_db_version() and updates offline query path to rely on pinned defaults. |
| NEWS.md | Documents the new pinned-version workflow and new helper function. |
| NAMESPACE | Exports chembl_check_db_version(). |
| man/db_download_chembl.Rd | Updates documentation for the new default version = NULL behavior and the “latest” workflow. |
| man/db_connect.Rd | Updates documentation for db_connect() now defaulting to pinned version behavior. |
| man/chembl_query.Rd | Updates documentation for chembl_query() offline version default/pinning behavior. |
| man/chembl_check_db_version.Rd | Adds new man page for chembl_check_db_version(). |
Files not reviewed (4)
- man/chembl_check_db_version.Rd: Generated file
- man/chembl_query.Rd: Generated file
- man/db_connect.Rd: Generated file
- man/db_download_chembl.Rd: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our current definition of the "latest" ChEMBL version in
webchemis fragile because the version number is pinned inside the package. Whenever there is a new ChEMBL release we have to update the flag in webchem, which is not good practice. With this PR the "latest" flag becomes dynamic, and e.gdb_download_chembl()queries the ChEMBL webservice for the current latest version.At the same time, the PR introduces new functionality to pin ChEMBL database version for a user or a project. It adds
chembl_check_db_version()(similar mechanism tocs_check_key()) which looks forCHEMBL_DB_VERSIONin .Renviron or thechembl_db_versionoption in .Rprofile. This is an exported function to help users with pinning, but it is also used internally to resolveversion = NULLin offline ChEMBL functions.version = NULLis the new default, so instead of defaulting to the latest version which can change over time, functions will default to the pinned version.With this, the suggested workflow becomes:
versionargumentPR task list:
devtools::document()