Repository navigation
importBugphyzz(): includeDroppedAsr adds back the ASR rows the export removed (1.7.12) - #289
Conversation
… removed (1.7.12) With version = "devel" or a commit hash, read bugphyzz_asr_dropped.csv.gz from bugphyzzExports and bind it in before applying mccThreshold and r2Threshold, so thresholds below the export's can be evaluated. Zenodo versions refuse the option. Co-authored-by: Claude Code <noreply@anthropic.com>
| } else { | ||
| dplyr::filter(dropped, Attribute_type == type) | ||
| } | ||
| dplyr::bind_rows(output[[i]], dplyr::select(part, -Validation)) |
There was a problem hiding this comment.
bind_rows() is fragile here. read.csv() infers column types separately for the dropped file and for the main tables. Any column that is entirely NA in the dropped file (for example Attribute_value or a range column for the numeric subset) is read as logical. The same column is character or numeric in output[[i]], so bind_rows() fails with "Can't combine ..1$X and ..2$X ". An NCBI_ID that is integer in one file and character in the other fails the same way.
The test fixture has only a few columns, so it can't catch this. Fix it by reading the file with the same colClasses as the main tables. Alternatively, coerce the dropped columns to the types of output[[i]] before binding, for example by reading everything as character and using readr::type_convert. Add a test where one of the dropped columns is all NA.
Also, dplyr::select(part, -Validation) errors if a future export omits Validation. Use dplyr::select(part, -dplyr::any_of("Validation")).
| con <- gzfile(tmp, "w"); cat("# header\n", file = con) | ||
| write.table(dropped, con, sep = ",", row.names = FALSE, append = TRUE, col.names = TRUE) | ||
| close(con) | ||
| local_mocked_bindings(.getResource = function(...) tmp) |
There was a problem hiding this comment.
The test only calls .addDroppedAsr() directly. Nothing tests the feature through importBugphyzz(includeDroppedAsr = TRUE, mccThreshold = ...), which is the behaviour the PR describes: dropped rows get a Validation score from the join and are then kept or removed by a lower threshold. Please add a test that mocks .downloadResource and .getResource and checks that a dropped ASR row appears at mccThreshold = 0.3 and is absent at the default 0.7. Also cover the interaction with excludeRarely. The fixture also lacks Frequency, NCBI_ID and the other real columns, so it doesn't exercise type compatibility with the main tables.
|
Issues worth addressing, most important first:
The roxygen and Rd documentation for the new argument, the NEWS entry and the version bump look fine. |
…; cache per version; end-to-end test Co-authored-by: Claude Code <noreply@anthropic.com>
Drafted with Claude Code. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #289 +/- ##
==========================================
+ Coverage 42.32% 44.56% +2.23%
==========================================
Files 5 5
Lines 893 929 +36
==========================================
+ Hits 378 414 +36
Misses 515 515 ☔ View full report in Codecov by Harness. |
Companion to the bugphyzzExports PR that writes
bugphyzz_asr_dropped.csv.gz(the imputed annotations the export's thresholds or rarely/never rule removed, with their validation score).importBugphyzz(version = "devel", includeDroppedAsr = TRUE, mccThreshold = 0.6)downloads that file, binds its rows into the binary, multistate and numeric tables byAttribute_type, and then applies the thresholds as before, so a threshold below the export's 0.7/0.5 can be evaluated against known ground truth (waldronlab/bugphyzz-manuscript#15). A Zenodo version withincludeDroppedAsr = TRUEstops with a message, since releases carry only the filtered data.Test: the Zenodo refusal, and the binding against a small gzipped fixture with
.getResourcemocked. The download path needs the side file ondevel, which the next export produces.Drafted with Claude Code.