Repository navigation
Added network provenance and save_network() / load_network() - #132
Conversation
* get_network() returns provenance: when, from which backend and URL, for which organism, and with which arguments the network was retrieved * save_network() saves a network to .rds, warning without provenance * load_network() reads it back and checks it with validate_network() * Tests fix the retrieval time; getSubnetworkFromIndra() is unchanged Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughINDRA network queries now attach provenance describing the query and retrieval. The package also exports functions to save networks to RDS files and load them after validation. ChangesNetwork Provenance and Persistence
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Merge Risk: ⚪ Minimal · up to This change adds query provenance to network results and lets users save and load validated networks. No actionable merge-blocking risk was identified. Pre-merge checks |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #132 +/- ##
==========================================
+ Coverage 86.97% 87.21% +0.23%
==========================================
Files 24 25 +1
Lines 2757 2808 +51
==========================================
+ Hits 2398 2449 +51
Misses 359 359 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
get_network()now also returnsprovenance, a one-row data.frame:backend_database,query_type,retrieved_at(UTC, taken when the CoGEx response arrives),backend_version(NAfor INDRA, which has no data versions),backend_url,organism,parameters(the query arguments as JSON), andpackage_version. It joins to the edges onbackend_database+query_type. INDRA's data changes over time, so this is the only record of which data a network came from.merge_networks()(Added merge_networks() and a shared backend contract test helper #130) already row-binds it.merge_networks()dedups one statement from two retrievals it would otherwise have to drop one of the times.save_network(network, file)validates the network and saves it to.rds, warning when there is no provenance (lost when the list is rebuilt withlist(nodes = , edges = )).load_network(file)reads it back and runsvalidate_network(), naming the file if it fails the current contract.getSubnetworkFromIndra()output is unchanged (noprovenance);filter_by_curation()keeps it.Phase 5c of the API refactor. No new dependencies. Independent of #131: this branch is off
devel, and its diff applies cleanly on the #131 branch (1119 tests pass combined), so the two can merge in either order.Test plan
devtools::test(): 1099 pass, 0 faildevtools::check(): 0 errors, 0 warnings, 1 pre-existing NOTE (MSstats in Depends not imported)test-network-io.R(13 tests): provenance values and join to edges, clock read after the request, customcogex_url, UTC time, survival throughmerge_networks()andfilter_by_curation(), unchangedgetSubnetworkFromIndra()output, save/load round trip, missing-provenance warning, input errorsnodesandedges; the INDRA test mock fixes the retrieval time, so theexpect_identicaltest of twoget_network()calls no longer depends on both falling in the same secondCo-Authored-By: Claude noreply@anthropic.com
Motivation and solution
Network results need to retain information about how they were retrieved. This change adds provenance to
get_network()results and addssave_network()andload_network()to persist and validate networks.Changes
provenanceas a data frame inget_network()results. It records retrieval details and links to edges bybackend_databaseandquery_type.nodesandedges.save_network(). It validates the network, saves it as an RDS file, warns when provenance is absent, and invisibly returns the file path.load_network(). It reads an RDS file and validates the network against the current contract. Validation errors identify the file.Tests
nodesandedges.Coding guidelines