Add unit tests for align-GCIMSSample.R#31
Merged
Conversation
align-GCIMSSample.R had 0% test coverage despite implementing the retention-time and drift-time alignment logic (the pipeline step right after peak-independent preprocessing, and the file touched by the earlier pow-dependency CI fix). Covers: - alignDt(): exact multiplicative drift-time correction from the RIP (reactant ion peak) position - alignRt_ip(): exact index-based slicing to a common injection-point aligned retention time grid - prealign(): combined dt+injection-point alignment, the pass-through branch when both are disabled, and the guard against aligning an already all-missing sample - align(method_rt = "ptw"): a shifted synthetic RIC is correctly warped onto a reference (peak position and correlation checked), including the branch where the reference RIC lives on a different rt grid and the branch where an already-aligned sample needs no polynomial correction - align(method_rt = "pow") fails with a clear message when the optional pow package isn't installed (skipped if it is) - align() aborts instead of silently returning empty/all-NA data when given an incompatible reference retention time Brings align-GCIMSSample.R from 0% to 82% coverage (the rest is pow's actual warping math, untestable without the optional pow package). Package-wide: 30.8% -> 35.9%.
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.
Summary
align-GCIMSSample.R— retention-time and drift-time alignment logic — had 0% test coverage.tests/testthat/test-align-GCIMSSample.R, covering:alignDt(): exact multiplicative drift-time correction from the RIP (reactant ion peak) positionalignRt_ip(): exact index-based slicing to a common injection-point-aligned retention time gridprealign(): combined dt + injection-point alignment, the pass-through branch when both are disabled, and the guard against aligning an already all-missing samplealign(method_rt = "ptw"): a shifted synthetic RIC is correctly warped onto a reference (peak position and correlation checked), including the branch where the reference RIC lives on a different rt grid and the branch where an already-aligned sample needs no polynomial correctionalign(method_rt = "pow")fails with a clear message when the optionalpowpackage isn't installed (test skips itself ifpowis installed)align()aborts instead of silently returning empty/all-NA data when given an incompatible reference retention timealign-GCIMSSample.Rcoverage: 0% → 82% (the remaining gap isalignRt_pow()'s actual warping math, untestable without the optionalpowpackage). Package-wide coverage: 30.8% → 35.9%.Test plan
testthat::test_local(".")— full existing suite passes, including the new file (21 assertions)covr::package_coverage()confirmsalign-GCIMSSample.Rat 82% and no regressions elsewhereGenerated by Claude Code