Skip to content

Add unit tests for align-GCIMSSample.R#31

Merged
zeehio merged 1 commit into
masterfrom
claude/package-status-report-0shf74
Jul 9, 2026
Merged

Add unit tests for align-GCIMSSample.R#31
zeehio merged 1 commit into
masterfrom
claude/package-status-report-0shf74

Conversation

@zeehio

@zeehio zeehio commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

  • align-GCIMSSample.R — retention-time and drift-time alignment logic — had 0% test coverage.
  • Adds tests/testthat/test-align-GCIMSSample.R, covering:
    • 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 (test skips itself if pow is installed)
    • align() aborts instead of silently returning empty/all-NA data when given an incompatible reference retention time
  • align-GCIMSSample.R coverage: 0% → 82% (the remaining gap is alignRt_pow()'s actual warping math, untestable without the optional pow package). 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() confirms align-GCIMSSample.R at 82% and no regressions elsewhere

Generated by Claude Code

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%.
@zeehio zeehio merged commit fafa962 into master Jul 9, 2026
2 checks passed
@zeehio zeehio deleted the claude/package-status-report-0shf74 branch July 9, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants