Skip to content

Development - #71

Open
alex-sandercock wants to merge 58 commits into
mainfrom
development
Open

alex-sandercock wants to merge 58 commits into
mainfrom
development

Conversation

@alex-sandercock

Copy link
Copy Markdown
Collaborator

This pull request introduces BIGr version 0.9.0, which includes important feature enhancements, bug fixes, and codebase cleanup. The main updates focus on improving the handling and validation of IUPAC codes in allele sequences, adding new arguments and logic to the madc2vcf_all function, and removing legacy breed composition functions that have been moved to a separate package.

Key highlights:

  • Improved IUPAC code detection and reporting in MADC sanity checks.
  • New filtering options for "Other" alleles in madc2vcf_all.
  • Multiple bug fixes in filterVCF() and VCF export logic.
  • Removal of breed composition functions (now in BIGpopA package).
  • Package metadata and dependency updates.

MADC and VCF Handling Improvements

  • Enhanced check_madc_sanity to distinguish between presence of IUPAC codes, their positions, and their presence in Ref/Alt/Other alleles, with new logical outputs: IUPACcodes, IUPACcodes_IdenticalRefAlt, and IUPACcodes_MatchAlleles. The documentation now describes twelve validation checks instead of nine. [1] [2] [3]
  • madc2vcf_all now supports two new arguments: others_min_dist (default 5bp) and others_max_close_snps (default 3 SNPs), allowing the discarding of "Other" tags with too many close SNPs by default.
  • Updated logic in madc2vcf_all, madc2vcf_targets, and madc2vcf_multi to handle IUPAC codes more robustly, only throwing errors when different IUPACs are present in REF/ALT.
  • Fixed madc2vcf_all() to ensure exported positions are always integers and negative positions are removed. Also fixed an "invalid substring arguments" error when handling off-target alleles.

VCF Filtering Bug Fixes

  • Fixed filterVCF() to properly parse INFO values in scientific notation, avoid writing corrupt all-NA variants, and ensure filters are correctly applied regardless of INFO field order or presence. Documentation was also corrected and expanded.

Package Cleanup and Dependency Updates

  • Removed breed composition and allele frequency functions (allele_freq_poly, solve_composition_poly, etc.) from the codebase and NAMESPACE, as these are now part of the separate BIGpopA package. [1] [2] [3]
  • Updated package metadata in DESCRIPTION: bumped version to 0.9.0, revised dependencies (added ggplot2, removed janitor, quadprog, data.table), and improved formatting.
  • Updated NAMESPACE imports to match new dependencies and remove unused ones. [1] [2]

Documentation

  • Added a detailed changelog for version 0.9.0 in NEWS.md, summarizing all major changes and fixes.

josuechinchilla and others added 30 commits April 22, 2026 13:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… or file paths, updated documentation and test files
…ring genotype matrices for comparisons. updated test file to accomodate nw arguments
Replaced separate with extract to parse SNP ID into CHROM and POS. Updated POS formatting to handle leading zeros.
…atches

When add_others = TRUE, compare() computed other_ref_base/other_alt_base with
substring() before checking that any mismatch positions remained. If an off-target
("Other") allele aligns to the reference with its only mismatch at the target SNP
position, that position is removed and pos_ref_idx/pos_alt_idx become integer(0),
so substring() errors with "invalid substring arguments" and the whole run aborts.

Move the two substring() calls inside the existing 'if (length(pos_ref_idx) > 0)'
guard, mirroring how the off-target Match alleles are already handled. Behavior is
unchanged when mismatch positions remain; existing madc2vcf_all tests still pass.
…tring

Fix madc2vcf_all() "invalid substring arguments" error on off-target alleles

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Human review recommended

It touches multiple core data-processing paths (MADC→VCF conversion and VCF filtering) while also removing public APIs, so a final human review is needed to confirm behavioral compatibility and release readiness.

Pull request overview

This PR prepares the BIGr 0.9.0 release by tightening MADC/VCF handling (especially around IUPAC codes and POS parsing), fixing long-standing filterVCF() INFO parsing issues, and cleaning out legacy pedigree/parentage/breed-composition functionality that has been moved elsewhere.

Changes:

  • Expanded check_madc_sanity() IUPAC reporting (distinguish differing vs identical-position IUPAC in REF/ALT, and IUPAC in Match/Other alleles) and aligned madc2vcf_* error/warning behavior accordingly.
  • Added new “Other allele” filtering controls to madc2vcf_all() and hardened VCF POS generation/sorting to enforce positive integer positions (including scientific-notation correction).
  • Reworked filterVCF() INFO parsing (scientific notation, missing/unreadable values) and updated tests/docs; removed legacy pedigree/parentage and breed composition functions + docs + tests.
File summaries
File Description
tests/testthat/test-validate_pedigree.R Removed tests for validate_pedigree() (function removed from package).
tests/testthat/test-madc2vcf_multi.R Updated expected IUPAC-related error message for madc2vcf_multi().
tests/testthat/test-madc2vcf_all.R Updated tests to expect warnings and revised error messages for marker ID matching / IUPAC handling.
tests/testthat/test-find_parentage.R Removed tests for find_parentage() (function removed from package).
tests/testthat/test-filterVCF.R Added/updated regression tests for INFO scientific-notation parsing and unreadable-value handling.
tests/testthat/test-check_ped.R Removed tests for check_ped() (function removed from package).
tests/testthat/test-check_madc_sanity.R Updated expected check set/ordering and expectations for new IUPAC checks.
tests/testthat/test-breedtools_poly.R Removed tests for legacy breed composition functions (moved to BIGpopA).
tests/testthat/corrected_pedigree.txt Removed tracked output artifact from prior pedigree tests.
README.md Updated citation block.
R/validate_pedigree.R Removed validate_pedigree() implementation.
R/updog2vcf.R Improved CHROM/POS extraction and POS normalization (strip leading zeros safely).
R/madc2vcf_targets.R Added POS validation/correction and robust sorting; updated imports.
R/madc2vcf_multi.R Updated IUPAC error messaging and marker ID column guidance.
R/madc2vcf_all.R Added new “Other” allele filters and more robust IUPAC/POS handling throughout conversion.
R/imputation_concordance.R Refreshed documentation and imports; clarified examples and plotting imports.
R/find_parentage.R Removed find_parentage() implementation.
R/filterVCF.R Fixed INFO value parsing (scientific notation, exact field matching), hardened filtering against NA indices, improved docs/validation.
R/check_ped.R Removed check_ped() implementation.
R/check_madc_sanity.R Added new checks and outputs for IUPAC positioning/equality and Match/Other alleles.
R/breedtools_functions.R Removed legacy breed composition functions (moved to BIGpopA).
NEWS.md Added BIGr 0.9.0 changelog and expanded notes for 0.8.1 fixes.
NAMESPACE Removed exports/imports for deleted APIs; added ggplot2 imports and cleaned up imports.
man/validate_pedigree.Rd Removed Rd for deleted function.
man/solve_composition_poly.Rd Removed Rd for deleted function.
man/madc2vcf_all.Rd Documented new others_min_dist / others_max_close_snps arguments and updated markers_info ID guidance.
man/imputation_concordance.Rd Synced Rd with updated roxygen/docs.
man/find_parentage.Rd Removed Rd for deleted function.
man/filterVCF.Rd Updated documentation to match new filtering semantics and return behavior.
man/check_ped.Rd Removed Rd for deleted function.
man/check_madc_sanity.Rd Updated documentation for new checks/return fields.
man/allele_freq_poly.Rd Removed Rd for deleted function.
inst/check_ped_test.txt Updated header/fixture contents for pedigree-related test data.
dev/dev_history.R Updated release/dev helper script.
DESCRIPTION Bumped version to 0.9.0; adjusted dependencies/imports/suggests and metadata formatting.
.Rbuildignore Ignored additional local tooling directories.
.gitignore Ignored .positai directory.
Review details

Files not reviewed (4)

  • man/check_madc_sanity.Rd: Generated file
  • man/filterVCF.Rd: Generated file
  • man/imputation_concordance.Rd: Generated file
  • man/madc2vcf_all.Rd: Generated file

Suppressed comments (1)

R/madc2vcf_all.R:742

  • Spelling in comment: "polymorphis"/"discarted" should be "polymorphism"/"discarded".
            if(length(other_alt_base) >0){ # If the N or IUPAC code is the only polymorphis found, the Match tag will be discarted
  • Files reviewed: 32/37 changed files
  • Comments generated: 5
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread README.md Resolved
Comment thread NEWS.md Resolved
Comment thread R/madc2vcf_all.R Resolved
Comment thread dev/dev_history.R Resolved
Comment thread R/madc2vcf_all.R Resolved
@codecov

codecov Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.72553% with 82 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.30%. Comparing base (f2c847b) to head (f95fd56).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
R/madc_plot.R 92.69% 32 Missing ⚠️
R/madc2vcf_all.R 77.92% 17 Missing ⚠️
R/madc_utils.R 88.51% 17 Missing ⚠️
R/madc_summary.R 94.73% 8 Missing ⚠️
R/madc2vcf_targets.R 66.66% 3 Missing ⚠️
R/updog2vcf.R 78.57% 3 Missing ⚠️
R/filterMADC.R 96.66% 1 Missing ⚠️
R/madc2vcf_multi.R 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
+ Coverage   82.02%   85.30%   +3.28%     
==========================================
  Files          23       22       -1     
  Lines        2876     3138     +262     
==========================================
+ Hits         2359     2677     +318     
+ Misses        517      461      -56     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI lite review requested due to automatic review settings November 9, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI lite review requested due to automatic review settings November 10, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

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.

5 participants