Skip to content

Development - #71

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

Development#71
alex-sandercock wants to merge 45 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.

josuechinchillaand 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

CopilotAI 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
FileDescription
tests/testthat/test-validate_pedigree.RRemoved tests for validate_pedigree() (function removed from package).
tests/testthat/test-madc2vcf_multi.RUpdated expected IUPAC-related error message for madc2vcf_multi().
tests/testthat/test-madc2vcf_all.RUpdated tests to expect warnings and revised error messages for marker ID matching / IUPAC handling.
tests/testthat/test-find_parentage.RRemoved tests for find_parentage() (function removed from package).
tests/testthat/test-filterVCF.RAdded/updated regression tests for INFO scientific-notation parsing and unreadable-value handling.
tests/testthat/test-check_ped.RRemoved tests for check_ped() (function removed from package).
tests/testthat/test-check_madc_sanity.RUpdated expected check set/ordering and expectations for new IUPAC checks.
tests/testthat/test-breedtools_poly.RRemoved tests for legacy breed composition functions (moved to BIGpopA).
tests/testthat/corrected_pedigree.txtRemoved tracked output artifact from prior pedigree tests.
README.mdUpdated citation block.
R/validate_pedigree.RRemoved validate_pedigree() implementation.
R/updog2vcf.RImproved CHROM/POS extraction and POS normalization (strip leading zeros safely).
R/madc2vcf_targets.RAdded POS validation/correction and robust sorting; updated imports.
R/madc2vcf_multi.RUpdated IUPAC error messaging and marker ID column guidance.
R/madc2vcf_all.RAdded new “Other” allele filters and more robust IUPAC/POS handling throughout conversion.
R/imputation_concordance.RRefreshed documentation and imports; clarified examples and plotting imports.
R/find_parentage.RRemoved find_parentage() implementation.
R/filterVCF.RFixed INFO value parsing (scientific notation, exact field matching), hardened filtering against NA indices, improved docs/validation.
R/check_ped.RRemoved check_ped() implementation.
R/check_madc_sanity.RAdded new checks and outputs for IUPAC positioning/equality and Match/Other alleles.
R/breedtools_functions.RRemoved legacy breed composition functions (moved to BIGpopA).
NEWS.mdAdded BIGr 0.9.0 changelog and expanded notes for 0.8.1 fixes.
NAMESPACERemoved exports/imports for deleted APIs; added ggplot2 imports and cleaned up imports.
man/validate_pedigree.RdRemoved Rd for deleted function.
man/solve_composition_poly.RdRemoved Rd for deleted function.
man/madc2vcf_all.RdDocumented new others_min_dist / others_max_close_snps arguments and updated markers_info ID guidance.
man/imputation_concordance.RdSynced Rd with updated roxygen/docs.
man/find_parentage.RdRemoved Rd for deleted function.
man/filterVCF.RdUpdated documentation to match new filtering semantics and return behavior.
man/check_ped.RdRemoved Rd for deleted function.
man/check_madc_sanity.RdUpdated documentation for new checks/return fields.
man/allele_freq_poly.RdRemoved Rd for deleted function.
inst/check_ped_test.txtUpdated header/fixture contents for pedigree-related test data.
dev/dev_history.RUpdated release/dev helper script.
DESCRIPTIONBumped version to 0.9.0; adjusted dependencies/imports/suggests and metadata formatting.
.RbuildignoreIgnored additional local tooling directories.
.gitignoreIgnored .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 threadREADME.md
If you use BIGr in your research, please cite as:

Sandercock, Alexander M., Cristiane H. Taniguti, Josue Chinchilla-Vargas, Dongyan Zhao, Shufen Chen, Meng Lin, Manoj Sapkota, and Breeding Insight Team. 2025. “Breeding Insight Genomics Functions for Polypoid and Diploid Species.” https://github.com/Breeding-Insight/BIGr.
Sandercock A.M., Peel M.D., Taniguti C.H., Chinchilla-Vargas J., Chen S., Sapkota M., Lin M., Zhao D., Ackerman A.J., Basnet B.R., Beil C.T., Sheehan M.J. (2025). BIGapp: A User-Friendly Genomic Tool Kit Identified Quantitative Trait Loci for Creeping Rootedness in Alfalfa (Medicago sativa L.)., The Plant Genome. doi:https://doi.org/10.1002/tpg2.70067
Comment threadNEWS.md
* `others_max_close_snps` (default 3 SNPs)

* By default, `Other` tags will be discarded if they have more than 3 SNPs with less than 5bp distance between them
* Adapt `madc2vcf_all` code to let pass identical IUPAC code in identical position in REF/ALT but ignore polymorphims in Match or Other alleles at the same position
Comment threadR/madc2vcf_all.R
}
other_ref_base <- substring(ref_seq, pos_ref_idx, pos_ref_idx)
other_alt_base <- substring(others_seq[j,]$AlleleSequence, pos_alt_idx, pos_alt_idx)
# Cases found where the AltMatch is another alternative for the target SNP - they are discarted
Comment threaddev/dev_history.R
# Update dependencies in DESCRIPTION
# install.packages('attachment', repos = 'https://thinkr-open.r-universe.dev')
#attachment::att_amend_desc()
attachment::att_amend_desc()
Comment threadR/madc2vcf_all.R
alt_base_match <- alt_base_match[-rm_pos]
}

if(length(alt_base_match) >0){ # If the N is the only polymorphis found, the Match tag will be discarted
@codecov

codecovBot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.28342% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.34%. Comparing base (f2c847b) to head (9e17245).
⚠️ Report is 5 commits behind head on main.

Files with missing linesPatch %Lines
R/madc2vcf_all.R54.41%31 Missing ⚠️
R/madc2vcf_targets.R66.66%3 Missing ⚠️
R/madc2vcf_multi.R50.00%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #71 +/- ##
==========================================
- Coverage 82.02% 81.34% -0.69% 
==========================================
Files 23 19 -4 Lines 2876 2385 -491 ==========================================
- Hits 2359 1940 -419 + Misses 517 445 -72 

☔ 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.

Sign up for freeto 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

@alex-sandercock@Cristianetaniguti@josuechinchilla@shbrainard