Skip to content

Conversation

@stitam
Copy link
Contributor

@stitam stitam commented Nov 7, 2025

This PR expands the functionality of chembl_query(). It adds a new argument mode which can be either "ws" (default) or "offline". This governs whether the function will attempts to retrieve data from the webservice or extract from the offline database. Note, ChEMBL contains almost 30 resources. For this PR I focused on establishing the framework for implementing offline access. Currenly only the "molecule" resource is supported for offline queries, the others will return an informative error.

Other then improving this user facing function I have added other functions as well which help the dev work.

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 Nov 7, 2025
@stitam stitam requested a review from Copilot November 7, 2025 19:48
Copy link

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 refactors the ChEMBL query interface to support both webservice and offline database modes. The key changes include introducing a chembl_options() function for configuration parameters, splitting the query logic into separate chembl_query_ws() and chembl_query_offline() functions, and updating the test parameter test_service_down to be passed via ... arguments instead of as an explicit parameter.

Key changes:

  • Added chembl_options() function to consolidate query configuration options (cache_file, similarity, tidy, version)
  • Refactored chembl_query() to support both "ws" (webservice) and "offline" modes via a new mode parameter
  • Created new file R/chembl_offline.R with offline query implementations for various ChEMBL resources
  • Updated function signatures across multiple functions to use ... for internal testing arguments

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 35 comments.

Show a summary per file
File Description
R/chembl.R Added chembl_options() helper, refactored chembl_query() to support mode selection, updated test parameter handling in multiple functions
R/chembl_offline.R New file implementing offline query functionality with resource-specific handlers and comparison utilities
tests/testthat/test-chembl.R Updated test calls to use chembl_options() syntax and improved code formatting
man/chembl_query.Rd Updated documentation to reflect new API design with mode parameter and options function
man/chembl_status.Rd Updated to document ... parameter instead of test_service_down
man/chembl_img.Rd Updated to document ... parameter instead of test_service_down
man/chembl_atc_classes.Rd Updated to document ... parameter instead of test_service_down
Comments suppressed due to low confidence (1)

R/chembl.R:1

  • Example shows passing a bare list() to the options parameter, but the function signature and parameter documentation indicate options should be the result of calling chembl_options(). The example should use options = chembl_options(tidy = FALSE) for consistency with the function's design, or clarify that both forms are acceptable.
#' Control options for ChEMBL queries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant