Enhance com2links to subset matrices and improve error handling#148
Enhance com2links to subset matrices and improve error handling#148smasongarrison merged 20 commits intomainfrom
Conversation
com2links now selects the smallest provided relationship matrix (by column count) as the ID guide, extracts IDs from it, and subsets any larger matrices to that ID set and ordering. Adds error checks when no matrices or IDs are available and emits verbose messages when subsetting. Includes unit tests covering mismatched-dimension scenarios and updates NEWS.md to document the fix.
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull request overview
This PR improves robustness around pedigree-derived relationship matrices and family ID assignment, primarily by subsetting mismatched matrices in com2links and adding an overwrite control to ped2fam.
Changes:
- Update
com2linksto subset all provided matrices to the smallest (by column count) to prevent dimension mismatches. - Enhance
ped2fam/.ped2idwith anoverwriteargument and additional warnings around ID coercion. - Add tests for
com2linksmismatched-dimension scenarios; update docs/metadata/vignette and NEWS.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
R/makeLinks.R |
Implements “subset to smallest matrix” behavior for com2links. |
tests/testthat/test-makeLinks.R |
Adds regression tests for mismatched matrix dimensions in com2links. |
R/segmentPedigree.R |
Adds overwrite argument to ped2fam and warning logic for ID coercion. |
man/ped2fam.Rd |
Documents new overwrite parameter for ped2fam. |
NEWS.md |
Notes changes for string ID handling and matrix size handling. |
DESCRIPTION |
Bumps package version. |
vignettes/articles/tutorialmanuscript.Xmd |
Minor formatting/content edits in tutorial vignette. |
Agent-Logs-Url: https://github.com/R-Computing-Lab/BGmisc/sessions/f8a84ab6-f22c-49f1-8cdb-c72741ea5e09 Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mason Garrison <garrissm@wfu.edu>
…tests for ped2fam" This reverts commit 8a80c8d.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
76b6b24 to
63ae064
Compare
|
@copilot can you make a unit test for the new function (alignPhenToMatrix)? |
Agent-Logs-Url: https://github.com/R-Computing-Lab/BGmisc/sessions/0719b949-711a-487f-8b47-006ff2a1508f Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Added 7 unit tests for
No |
This pull request introduces several improvements and bug fixes to the BGmisc package, focusing on more robust handling of pedigree matrices, smarter string ID management, and enhanced control over family ID assignment. The most important changes are summarized below:
Robust handling of mismatched pedigree matrix dimensions
com2linksfunction now automatically subsets all input matrices to match the smallest matrix by number of columns, ensuring consistent IDs and preventing errors when matrices of different sizes are provided. This includes informative messages and error handling for missing or malformed IDs.com2linkscorrectly handles mismatched matrix dimensions, including cases with two or three matrices and different combinations of which matrix is smallest.Improvements to ID handling and family assignment
ped2famand underlying.ped2idfunctions now have anoverwriteargument (default TRUE) that controls whether an existing family ID column in the pedigree is replaced, with appropriate user warnings. [1] [2] [3] [4] [5]Documentation and metadata updates
DESCRIPTIONfile andNEWS.mdwere updated to reflect the new version and summarize the main changes. [1] [2]ped2famwas updated to describe the newoverwriteparameter. [1] [2]Minor tutorial and vignette corrections