Skip to content

Read curation sheets from bugphyzzExports instead of Google (#306) - #311

Merged
lwaldron merged 2 commits into
develfrom
read-sheets-from-exports
Nov 25, 2026
Merged

lwaldron merged 2 commits into
develfrom
read-sheets-from-exports

Conversation

@lwaldron

Copy link
Copy Markdown
Member

Closes #306. Needs waldronlab/bugphyzzExports#113, which is merged.

physiologies() read all 24 curation sheets and the fatty acid sheet live from Google on every call. It now reads the snapshots in bugphyzzExports sources/sheets/ (bugphyzzExports ADR 0007, waldronlab/bugphyzzExports#113) through BiocFileCache, like the programmatic sources. Results are identical; the sheet data is now cached, so a change to a sheet shows up only after forceDownload = TRUE.

Changes

  • spreadsheet_links.tsv and spreadsheet_customlinks.tsv: link now holds the path under sources/ (sheets/aerophilicity.csv); source_link is kept per ADR 0007.
  • .importSpreadsheets() and .fattyAcidComposition() resolve link against .sourcesBaseUrl() and read through .getResource(), so options(bugphyzz.sourcesBaseUrl = ...) points them at a local checkout. forceDownload added to .importSpreadsheets() and passed through from physiologies().
  • An unreachable base URL when reading the sheets is a hard error (without the sheets there is no curation data). The programmatic-sources read stays a warning, with the "Using sheets only" text corrected.
  • sources = FALSE still means "skip programmatic sources" and reads the sheet data.
  • Tests: the two base-URL tests get a tiny sheet file; added an offline sheet-read test. source_link stays, so .appendLinks() (dead code, referenced only in inst/backup/) is left untouched.
  • Docs: README data lineage and Contributing, inst/scripts/README.md (and the custmolinks typo), physiologies() @details/@param and .Rd, NEWS. Version is already 1.9.1.

Old vs new comparison

Run back to back so the sheets could not change in between (old = live Google Sheets, new = this branch against bugphyzzExports). Everything is identical on rows, sorted content, and column types.

Check Result
.importSpreadsheets(showPhys("spreadsheets")) 24 physiologies, all identical
.fattyAcidComposition() identical, 138,496 rows
physiologies("all") 45 physiologies, all identical
bugphyzzExports apply_sheet_overrides() on the new output all 5 override rows matched

Do not merge between about 21:00 UTC Sunday and 01:00 UTC Monday, while the weekly export runs.

🤖 Drafted with Claude Code

physiologies() read all 24 curation sheets and the fatty acid sheet live
from Google on every call. It now reads the snapshots in bugphyzzExports
sources/sheets/ (bugphyzzExports ADR 0007, #113) through BiocFileCache,
like the programmatic sources.

- spreadsheet_links.tsv / spreadsheet_customlinks.tsv: link now holds the
  path under sources/ (sheets/aerophilicity.csv); source_link kept.
- .importSpreadsheets() and .fattyAcidComposition() resolve link against
  .sourcesBaseUrl() and read via .getResource(), so a sheet is cached and a
  change shows up only after forceDownload = TRUE. forceDownload added to
  .importSpreadsheets() and passed through from physiologies().
- An unreachable base URL when reading the sheets is a hard error; the
  programmatic-sources read stays a warning, with corrected text.
- Tests: give the base-URL tests a sheet file, add an offline sheet read.
- Docs: README, inst/scripts/README (and the custmolinks typo),
  physiologies() @details/@PARAM and .Rd, NEWS.

Verified old-vs-new, run back to back: .importSpreadsheets (24),
.fattyAcidComposition (138,496 rows) and physiologies("all") (45) are
identical on rows and column types, and bugphyzzExports
apply_sheet_overrides() matches all 5 override rows on the new output.

Co-authored-by: Claude Code <noreply@anthropic.com>
Comment thread R/fattyAcidComposition.R
## CSV in waldronlab/bugphyzzExports, sources/sheets/ (ADR 0007); the `link`
## column of spreadsheet_customlinks.tsv holds the path there, resolved against
## .sourcesBaseUrl() and read through the cache like .importSpreadsheets().
.fattyAcidComposition <- function(forceDownload = FALSE){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

forceDownload is added here, but nothing in R/ calls .fattyAcidComposition(). physiologies(forceDownload = TRUE) therefore never refreshes this sheet, although the docs say it re-downloads "the curation sheets". Either pass it through from the caller or drop the argument and adjust the docs. The new caching code is also duplicated from .importSpreadsheets() (tag + .getResource + cache-key construction); a small shared helper would keep the two in step.

@claude

claude Bot commented Nov 25, 2026

Copy link
Copy Markdown

Review notes:

  1. R/fattyAcidComposition.R: .fattyAcidComposition(forceDownload) has no caller in R/, so physiologies(forceDownload = TRUE) does not refresh that sheet, contrary to the updated docs. Wire it through or adjust the docs.
  2. The cache-key and download logic is duplicated between .importSpreadsheets() and .fattyAcidComposition(). A shared helper would avoid drift.

I found nothing else worth raising. Exported docs (man/physiologies.Rd) and NEWS were updated.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.76%. Comparing base (eec5063) to head (b4e5d6e).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
R/fattyAcidComposition.R 0.00% 3 Missing ⚠️
R/physiologies.R 86.66% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            devel     #311       +/-   ##
===========================================
+ Coverage   46.69%   56.76%   +10.06%     
===========================================
  Files           5        5               
  Lines         816      821        +5     
===========================================
+ Hits          381      466       +85     
+ Misses        435      355       -80     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

.importSources(), .importSpreadsheets() and .fattyAcidComposition()
repeated the base-URL hash cache key and the .getResource() call. Pull it
into one helper so the keying cannot drift between them. No behaviour
change: physiologies("all") and the sheet/fatty-acid imports are identical
to before (addresses the PR #311 review).

Co-authored-by: Claude Code <noreply@anthropic.com>
@lwaldron

Copy link
Copy Markdown
Member Author

Thanks. Addressed both points:

2 (duplication): extracted .getSourceResource() in b4e5d6e, now used by .importSources(), .importSpreadsheets() and .fattyAcidComposition(), so the cache-key and .getResource() call live in one place. Verified physiologies("all"), .importSpreadsheets() and .fattyAcidComposition() are byte-identical to before the refactor.

1 (.fattyAcidComposition(forceDownload) has no caller in R/): this is expected, not a doc contradiction. "fatty acid composition" is in spreadsheet_customlinks.tsv, not spreadsheet_links.tsv, so it is not in showPhys("spreadsheets") and never appears in physiologies() output (physiologies("all") returns 45 names, none of them fatty acid). It was not wired into physiologies() before this change either. The @param refers to the sheets physiologies() actually reads, which do not include fatty acid, so nothing contradicts. The forceDownload argument is there for parity with .importSpreadsheets() and so the read is testable against a local checkout, as the issue asked.

@claude review

@lwaldron
lwaldron merged commit 28b262a into devel Nov 25, 2026
5 checks passed
@lwaldron
lwaldron deleted the read-sheets-from-exports branch November 25, 2026 22:41
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.

Read the curation sheets from bugphyzzExports instead of Google

1 participant