Skip to content

ChEMBL offline resources#450

Merged
stitam merged 45 commits intoropensci:masterfrom
stitam:resources
Feb 27, 2026
Merged

ChEMBL offline resources#450
stitam merged 45 commits intoropensci:masterfrom
stitam:resources

Conversation

@stitam
Copy link
Copy Markdown
Contributor

@stitam stitam commented Dec 1, 2025

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:

  • Update NEWS
  • Add tests (if appropriate)
  • Update documentation with devtools::document()
  • Check package passed

@stitam stitam added this to the 25-ISC-1-02-M1 milestone Dec 1, 2025
@stitam stitam marked this pull request as draft December 1, 2025 20:01
@stitam stitam requested a review from Copilot December 1, 2025 20:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 output parameter replacing the tidy option in chembl_query() to control result format ("raw" or "tidy")
  • A replace_nulls feature 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 tidy boolean to output parameter with "raw"/"tidy" options for clearer intent
  • Implemented offline query functions that replicate web service behavior using local SQLite database
  • Added replace_nulls functionality 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.

@stitam stitam marked this pull request as ready for review February 27, 2026 11:14
@stitam stitam merged commit 281ac1c into ropensci:master Feb 27, 2026
7 checks passed
@stitam stitam deleted the resources branch February 27, 2026 11:42
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.

2 participants