Fix parse_ml_filename() misparsing year/country-stratified filenames - #34
Merged
Merged
Conversation
…t filenames, not after the drug value so there was mislabeling. Corrected the token order to match was regex expects, and added regression tests for the stratified and unstratified cases.
eboyer221
requested review from
AbhirupaGhosh,
amcim,
epbrenner and
jananiravi
August 12, 2026 21:24
7 tasks
AbhirupaGhosh
previously approved these changes
Sep 2, 2026
Contributor
There was a problem hiding this comment.
- I made a few changes to remove the existing confusion with parse_ml_filename() using stratified filenames. I removed those steps so that it is only used by buildPerfPq() and buildTopFeatsPq().
- I also did a comparative major change; the performance and top features were saved as TSVs previously, which I changed to PARQUET. To adapt the parquets, I updated the merge_ml_results.
- Added a function to call all the merge functions.
parse_ml_filename() no longer carries stratification tokens, so a year/country stratified filename was silently mislabelled (drug and seed came out wrong). Detect the strat label after drug/drug_class and stop() with a message pointing at buildPerfPqYearCountry(). Rewrite the regression tests to match the current design: .parquet fixtures, no strat_label/strat_value fields, and explicit expect_error coverage for stratified names and a bad drug token.
The path argument was renamed to perf_dir_path without updating the roxygen block, leaving all four arguments undocumented (R CMD check WARNING).
…-stratified # Conflicts: # NAMESPACE
Contributor
Author
|
My most recent commits made parse_ml_filename() throw a clear error when handed a year/country-stratified filename (instead of silently mis-parsing it), rewrote its tests to match the branch's current unstratified-only design, and added the missing docs for buildPerfPq(). Then merged current main into the branch and resolved the NAMESPACE conflict by regenerating the docs, so PR #34 is now conflict-free with all 231 tests passing. Question I have for @AbhirupaGhosh :
|
Contributor
|
Cover filename parsing for the single-token stratified format: year and country stratification, drug and drug_class, plus the Importance numeric coercion in the top-features aggregator.
AbhirupaGhosh
approved these changes
Sep 3, 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.
##Description
parse_ml_filename()inR/merge_ml_results.Rexpected the stratification token (year/country) to appear after the drug value in a filename, but the actual filenames written by the matrix-generation code place it before the drug value (e.g.Csp_drug_year_AMX_2010-2015_genes_binary_year_42_performance.tsv). This caused stratified filenames to be parsed with the wrong drug and a missing seed, with no error.Why it matters
parse_ml_filename()is exported and documented as supporting stratified filenames, so any code parsing a stratified result filename with it gets silently wrong metadata.Fix
Reordered the token-parsing logic so the strat label is read immediately after
drug/drug_class, before the drug value, matching the grammar already used bybuildPerfPqYearCountry().Testing
Added
tests/testthat/test-merge-ml-results.Rcovering: unstratified drug, unstratified drug_class, shuffled, year-stratified drug, and country-stratified drug_class filenames. Full suite passes (230/230).Found while reviewing #32. Resolves PR1) of Issue #33.