Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds offline database support for ChEMBL resources, allowing users to query ChEMBL data from a local SQLite database instead of relying solely on the web service API. The implementation includes:
- A new
outputparameter replacing thetidyoption inchembl_query()to control result format ("raw" or "tidy") - A
replace_nullsfeature that converts JSON NULL values to typed NA values based on field schemas - Offline implementations for five ChEMBL resources (atc_class, binding_site, biotherapeutic, cell_line, compound_record, document)
- Version updates for ChEMBL database from v35 to v36
Key Changes
- Refactored API parameters from
tidyboolean tooutputparameter with "raw"/"tidy" options for clearer intent - Implemented offline query functions that replicate web service behavior using local SQLite database
- Added
replace_nullsfunctionality to handle NULL values in API responses more gracefully by converting them to appropriate typed NAs
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| R/chembl.R | Added replace_nulls parameter and output parameter to replace tidy; implemented replace_nulls() function for NULL handling; updated to ChEMBL v36; fixed typo "compund_record" |
| R/chembl_offline.R | Implemented offline query functions for multiple resources (atc_class, binding_site, biotherapeutic, cell_line, compound_record, document); added helper functions for validation and data conversion |
| tests/testthat/test-chembl.R | Updated version expectations from v35 to v36; updated parameter usage from options$tidy to output parameter |
| tests/testthat/test-chembl_offline.R | New test file with comprehensive tests for offline ChEMBL functionality including resource-specific tests and comparison with web service results |
| tests/testthat/test-wikidata.R | Updated expected Wikidata ID from Q20987744 to Q10420388 |
| man/chembl_query.Rd | Updated documentation to reflect new output parameter and removal of tidy option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Feb 27, 2026
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.
Related to #449.
This PR refactors some of the existing code around offline ChEMBL access plus implements offline access for more ChEMBL resources.
Note, many ETOX tests failed and it seems there may have been a schema change. The website looks different as well. The examples pass but the responses are usually NA. We'll have to look into this but for now I just commented out these tests.
PR task list:
devtools::document()