Fix parse_ml_filename() misparsing year/country-stratified filenames - #34
Open
eboyer221 wants to merge 1 commit into
Open
Fix parse_ml_filename() misparsing year/country-stratified filenames#34eboyer221 wants to merge 1 commit into
eboyer221 wants to merge 1 commit into
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
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.