Skip to content

bug in relatedness matrix computation when parents are referenced but missing from the pedigree#155

Merged
smasongarrison merged 22 commits into
mainfrom
dev_main
Jul 6, 2026
Merged

bug in relatedness matrix computation when parents are referenced but missing from the pedigree#155
smasongarrison merged 22 commits into
mainfrom
dev_main

Conversation

@smasongarrison

Copy link
Copy Markdown
Member

This pull request introduces new functionality for tracing and flagging unilineal parental chains (maternal and paternal) within pedigrees, and fixes a subtle bug in relatedness matrix computation when parents are referenced but missing from the pedigree. The most important changes are grouped below.

New features for parental chain analysis:

  • Added addParentalChain(), addPaternalChain(), and addMaternalChain() functions to compute and add ordered parental ancestor chains (maternal or paternal) for each individual in a pedigree, along with readable string representations. These chains allow easy tracing of direct maternal or paternal lines.
  • Added addParentalLineFlag(), addPaternalLineFlag(), and addMaternalLineFlag() functions to flag whether a specified ancestor appears in an individual's maternal or paternal chain, supporting efficient filtering or grouping by lineage.
  • Exported all new chain and flagging functions in the package namespace.

Bug fix and enhancements for relatedness matrix computation:

  • Fixed an issue in ped2com() and related functions where parents referenced in momID/dadID but missing from the pedigree led to understated diagonal relatedness and missing covariance between siblings. Now, a warning is issued when this is detected, and two solutions are available via a new repair_rowless_parents argument: adding placeholder founder rows ("rows" method, default) or applying a Schur complement update ("schur" method, for additive component only). [1] [2] [3] [4] [5]

Documentation and dependency updates:

  • Updated the package version to 1.8.0.9 and documented all new features and fixes in NEWS.md and DESCRIPTION. [1] [2]
  • Added new igraph imports required for the chain functions.

smasongarrison and others added 20 commits June 2, 2026 13:29
Apply code-style and whitespace cleanups across multiple R files: reflow long expressions, unify spacing, remove extra blank lines, and re-indent commented blocks. In readGedcom.R, improve the parse_dates branch by ensuring date columns are only parsed when present (avoids modifying non-existent columns) and clarify a message when date qualifiers are found. Minor signature and test whitespace tweaks and non-functional reformatting in data-raw/df_royal92.R and simulatePedigreeBetween.R.
…rser

Add extractGedcomLevel, extractEventSubBlock, extractInfoFromLines, and
extractCoordFromSubBlock helpers so processEventLine looks up fields by
tag name rather than fixed line offsets, correctly handling missing or
reordered GEDCOM event sub-fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dge case; add tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…blican calendar escape; fix pkgdown catch-all
Potential fix for pull request finding

Potential fix for pull request finding

Potential fix for pull request finding

Potential fix for pull request finding

Potential fix for pull request finding

Potential fix for pull request finding

Co-Authored-By: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Adds a `runmodel` argument to `fitPedigreeModel()` so callers can optionally return the assembled OpenMx model without fitting it. The new parameter is wired into the function logic and documented in the Rd file. Also adds a warning in `ped2com()` when `iss`/`jss` are NULL or empty before building the `isPar` sparse matrix, improving visibility into invalid matrix-construction inputs.
@smasongarrison smasongarrison linked an issue Jul 5, 2026 that may be closed by this pull request
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

rowless parent fix
@smasongarrison smasongarrison merged commit ad924f1 into main Jul 6, 2026
11 checks passed
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.

[Bug] unlinked children

1 participant