Skip to content

fix(pedexport): integer layout for WOMBAT, add HIBLUP format - #13

Merged
luansheng merged 2 commits into
mainfrom
fix-pedexport-wombat-hiblup
Sep 22, 2026
Merged

luansheng merged 2 commits into
mainfrom
fix-pedexport-wombat-hiblup

Conversation

@luansheng

Copy link
Copy Markdown
Owner

Summary

Systematic end-to-end testing of pedexport() (new in v1.10.0) against the real binaries (ASReml 4.3, WOMBAT 26-05-2025, renumf90/BLUPF90, HIBLUP) revealed one genuine bug and motivated one addition:

  1. Bug fix — software = "wombat": v1.10.0 wrote character IDs, assuming WOMBAT accepts alphanumeric codes and recodes them internally. Real WOMBAT rejects such files (ERROR: reading data file on the first record). The WOMBAT manual §6.3 requires three integer variables, codes in 0..2147483647, offspring codes numerically larger than either parent, unknown parents coded 0, ascending order recommended. The wombat format now shares the integer layout with blupf90 (including the xref attribute and <file>.xref mapping file), satisfying all of these by construction.

  2. New format — software = "hiblup": character IDs, no header by default, missing parents coded "0" — ready for HIBLUP's --pedigree file.

  3. Documentation: ASReml-SA silently ignores !SKIP on the pedigree file line unless it is placed immediately after the file name (empirically verified: trailing !SKIP 1 after !MAKE reads the header as 3 phantom individuals; leading !SKIP 1 works). The roxygen docs now state the required placement.

Verification

  • Unit/systematic tests: updated test-pedexport.R (150 assertions) + new test-pedexport-extra.R (~500 assertions: format invariants across all built-in datasets and formats, file round-trips through fread+tidyped, xref bijection, custom missing symbols, addnum/addgen = FALSE reconstruction, 48.5k-individual scale). Full suite passes via testthat::test_local() (FAIL 0).
  • End-to-end against real binaries on a simulated 1500-individual / 8-generation pedigree with phenotypes (truth Va=1.0, Ve=2.0), all four programs consuming pedexport() output directly and converging:
format program result
asreml (header, !SKIP 1 !ALPHA !MAKE) ASReml 4.3 1500 identities, Va = 0.9999
wombat (new integer layout) WOMBAT 26-05-2025 converged, Va = 0.9888; Inbr% == visPedigree f (max diff 5e-6)
blupf90 renumf90 1440 records + 60 phantom parents; renf90.inb == visPedigree f (max diff 5e-7)
hiblup (new format) HIBLUP Va = 1.0001, h2 = 0.320

EBV correlations between any pair of backends ≥ 0.9999; cor(EBV, simulated true breeding values) = 0.71 (consistent with h² = 0.33).

Notes

  • Behaviour change for software = "wombat" is intentional (the 1.10.0 output was unusable with real WOMBAT); 1.10.0 was never submitted to CRAN, so no CRAN users are affected.
  • NEWS.md entry added; version bumped to 1.10.1; man/pedexport.Rd regenerated with roxygen2.

pedexport(software = "wombat") in 1.10.0 wrote character IDs based on the
incorrect assumption that WOMBAT accepts alphanumeric codes and recodes
them internally. Real WOMBAT rejects such files: the manual (section 6.3)
requires three integer variables with codes in 0..2147483647, offspring
codes numerically larger than either parent, and unknown parents coded 0.
The wombat format now shares the integer layout with blupf90 (including
the xref attribute and <file>.xref mapping file).

New software = "hiblup" format for HIBLUP's --pedigree file: character
IDs, no header by default, missing parents coded "0".

Also document that ASReml-SA silently ignores !SKIP on the pedigree file
line unless it is placed immediately after the file name.

All changes verified end-to-end against real binaries (ASReml 4.3,
WOMBAT 26-05-2025, renumf90, HIBLUP) on a simulated 1500-individual
pedigree: all four programs converge on pedexport() output, variance
estimates agree (Va 0.99-1.00 vs truth 1.0), EBV correlations >= 0.9999,
and renumf90/WOMBAT inbreeding coefficients match visPedigree's f.

Bump version to 1.10.1.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f85780e335

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/pedexport.R
Comment on lines 289 to 293
missing_int <- suppressWarnings(as.integer(missing))
if (!is.numeric(missing) || length(missing) != 1L || is.na(missing) ||
is.na(missing_int) || missing_int != missing) {
stop("For numeric formats (blupf90, mtdfreml, dmu, numeric), ",
stop("For numeric formats (blupf90, wombat, mtdfreml, dmu, numeric), ",
"'missing' must be a single integer value.", call. = FALSE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require the WOMBAT missing-parent code to be zero

When software = "wombat" is combined with a custom integer such as missing = -99L, this generic numeric validation accepts it and .pedexport_num() replaces every unknown parent with that value. The resulting file violates WOMBAT's stated requirement that unknown parents be coded as 0, so an explicitly supported argument can produce an unusable or misinterpreted WOMBAT pedigree; reject nonzero missing values for this format.

Useful? React with 👍 / 👎.

WOMBAT manual section 6.3 requires unknown parents to be coded 0;
a custom nonzero 'missing' symbol would produce a pedigree file that
WOMBAT cannot interpret. Reject nonzero values explicitly.

Addresses Codex review on PR #13.
@luansheng

Copy link
Copy Markdown
Owner Author

Codex review addressed in 2556620: software = "wombat" now rejects any nonzero missing symbol with an explicit error (WOMBAT manual §6.3 requires unknown parents coded 0). Added regression tests (default and explicit missing = 0L accepted; -99L and 9L rejected), updated roxygen docs and NEWS. Full test suite passes (FAIL 0).

@luansheng
luansheng merged commit 4a0ae37 into main Sep 22, 2026
1 check passed
@luansheng
luansheng deleted the fix-pedexport-wombat-hiblup branch September 22, 2026 14:24
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.

1 participant