Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f590dad
Merge pull request #58 from Breeding-Insight/development
josuechinchilla Apr 22, 2026
20d2764
corrected importFrom statement in parentage functions and ped_check
Apr 22, 2026
f2d3f40
updated NAMESPACE to reflect updated importFrom statements
Apr 22, 2026
c1fe543
Update R/check_ped.R
josuechinchilla Apr 22, 2026
0a13483
updated error handling and reporting for check_ped, Also major improv…
Apr 24, 2026
9bbc507
updated error handling and reporting for check_ped
Apr 24, 2026
f798362
updated parentage functions to work allow user to display NA or not, …
Apr 27, 2026
03725d8
Made edits suggested by autopilot
Apr 27, 2026
506a47f
added edits suggested by copilot
Apr 27, 2026
977e070
modified default params
Apr 28, 2026
5db5fa2
Added authors fror functions and made headers concise
Apr 28, 2026
6b84e18
staged comments for next push
May 20, 2026
4eb79bb
removed zip option and added specific correction arguments
May 20, 2026
1fb19d0
finalzied refactoring according to CRAN standards
May 20, 2026
65d48fd
Updated functions and descriptions to be CRAN compliant and updatede …
May 21, 2026
9b16038
updated parentage functions to standardize inputs and outputs
May 26, 2026
26bae5f
updated functions to work as a workflow accepting inputs from objects…
May 26, 2026
7e34dfe
updated find_parentage to exlcude self comparison and fix bug of orde…
May 29, 2026
e2bdef5
Refactor SNP ID parsing to use regex extraction
alex-sandercock Jun 1, 2026
ef9bd78
Bump version from 0.7.0 to 0.8.0
alex-sandercock Jun 1, 2026
bd54c9a
updated documentation to include updates to find_parentage
Jun 2, 2026
bdd540b
Merge pull request #63 from Breeding-Insight/update_updog2vcf
alex-sandercock Jun 2, 2026
90af9c4
Merge branch 'development' into add_parentage_functions
alex-sandercock Jun 5, 2026
7707dcd
Merge pull request #64 from Breeding-Insight/add_parentage_functions
alex-sandercock Jun 5, 2026
b4ec294
Fix madc2vcf_all() crash on off-target alleles with no remaining mism…
shbrainard Jun 19, 2026
154d879
Remove bad POS
alex-sandercock Jun 24, 2026
0453d12
remove BIGpopA functions
alex-sandercock Jun 24, 2026
2c74425
Merge pull request #65 from shbrainard/fix-madc2vcf-others-empty-subs…
Cristianetaniguti Jul 2, 2026
82e1cb3
update news
Cristianetaniguti Jul 2, 2026
4c9a725
Merge pull request #66 from Breeding-Insight/grape
Cristianetaniguti Jul 2, 2026
8784a7d
init SAT-151
Cristianetaniguti Jul 2, 2026
e0a903f
Let pass identical IUPAC code in Ref Alt
Cristianetaniguti Jul 2, 2026
3d28c45
SAT-111 SAT-188
Cristianetaniguti Jul 30, 2026
cf5fa39
adapt tests
Cristianetaniguti Jul 30, 2026
be99360
up version
Cristianetaniguti Jul 30, 2026
c7da438
adopt copilot suggestions
Cristianetaniguti Jul 30, 2026
cdcca73
adopt more copilot suggestions
Cristianetaniguti Jul 31, 2026
e02e383
bugfix
Cristianetaniguti Jul 31, 2026
a851de7
address minors
Cristianetaniguti Aug 4, 2026
6f18e9d
Fixed scientific notation fail
alex-sandercock Aug 3, 2026
e1e7fce
fixed INFO retrieval
alex-sandercock Aug 3, 2026
9448625
updated filterVCF documentation
alex-sandercock Aug 3, 2026
cbcfb19
fixed NA gap
alex-sandercock Aug 4, 2026
d4f0029
Merge pull request #68 from Breeding-Insight/filterVCF_updates
alex-sandercock Aug 5, 2026
9e17245
Update citation for BIGr in README
alex-sandercock Aug 5, 2026
10dfa3c
updated filterMADC
alex-sandercock Aug 13, 2026
f18930d
Added two new madc functions
alex-sandercock Aug 13, 2026
ec79403
plotting edits
alex-sandercock Aug 13, 2026
3d137bf
updated missing plot
alex-sandercock Aug 13, 2026
8df2f65
Update madc_plot.R
alex-sandercock Aug 14, 2026
603066e
updated plot
alex-sandercock Aug 16, 2026
439507b
updated documentation
alex-sandercock Aug 17, 2026
2d3412a
updated the density plot
alex-sandercock Aug 17, 2026
23a5d0a
titles optional
alex-sandercock Aug 18, 2026
82cda35
updating documentation
alex-sandercock Nov 9, 2026
c35f92a
Updating summary and plot functions
alex-sandercock Nov 9, 2026
fb6dd65
Merge pull request #72 from Breeding-Insight/filterMADC_updates
alex-sandercock Nov 9, 2026
f95fd56
bug fixes and documentation
alex-sandercock Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
^package-code\.Rmd$
^docs$
^CRAN-SUBMISSION$
^\.positai$
^\.claude$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.Ruserdata
revdep/
.DS_Store
.positai
111 changes: 52 additions & 59 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,76 +1,69 @@
Package: BIGr
Title: Breeding Insight Genomics Functions for Polyploid and Diploid Species
Version: 0.7.2
Authors@R: c(person(given='Alexander M.',
family='Sandercock',
email='sandercock.alex@gmail.com',
role=c('cre','aut')),
person(given='Cristiane',
family='Taniguti',
role = 'aut'),
person(given='Josue',
family='Chinchilla-Vargas',
role='aut'),
person(given='Shufen',
family='Chen',
role='ctb'),
person(given='Manoj',
family='Sapkota',
role='ctb'),
person(given='Meng',
family='Lin',
role='ctb'),
person(given='Dongyan',
family='Zhao',
role='ctb'),
person('University', "of Florida",
role=c('cph'),
comment = "Breeding Insight"))
Title: Breeding Insight Genomics Functions for Polyploid and Diploid
Species
Version: 0.10.0
Authors@R: c(
person("Alexander M.", "Sandercock", , "sandercock.alex@gmail.com", role = c("cre", "aut")),
person("Cristiane", "Taniguti", role = "aut"),
person("Josue", "Chinchilla-Vargas", role = "aut"),
person("Shufen", "Chen", role = "ctb"),
person("Manoj", "Sapkota", role = "ctb"),
person("Meng", "Lin", role = "ctb"),
person("Dongyan", "Zhao", role = "ctb"),
person(family = "University of Florida", role = "cph",
comment = "Breeding Insight")
)
Maintainer: Alexander M. Sandercock <sandercock.alex@gmail.com>
Description: Functions developed within Breeding Insight to analyze
diploid and polyploid breeding and genetic data. 'BIGr' provides the
ability to filter variant call format (VCF) files, extract single nucleotide polymorphisms (SNPs)
from diversity arrays technology missing allele discovery count (DArT MADC) files,
and manipulate genotype data for both diploid and polyploid species. It
also serves as the core dependency for the 'BIGapp' 'Shiny' app, which
provides a user-friendly interface for performing routine genotype
analysis tasks such as dosage calling, filtering, principal component analysis (PCA),
genome-wide association studies (GWAS), and
genomic prediction. For more details about the included 'breedTools'
functions, see Funkhouser et al. (2017) <doi:10.2527/tas2016.0003>, and
the 'updog' output format, see Gerard et al. (2018) <doi:10.1534/genetics.118.301468>.
ability to filter variant call format (VCF) files, extract single
nucleotide polymorphisms (SNPs) from diversity arrays technology
missing allele discovery count (DArT MADC) files, and manipulate
genotype data for both diploid and polyploid species. It also serves
as the core dependency for the 'BIGapp' 'Shiny' app, which provides a
user-friendly interface for performing routine genotype analysis tasks
such as dosage calling, filtering, principal component analysis (PCA),
genome-wide association studies (GWAS), and genomic prediction. For
more details about the 'updog' output
format, see Gerard et al. (2018) <doi:10.1534/genetics.118.301468>.
License: Apache License (>= 2)
URL: https://github.com/Breeding-Insight/BIGr
BugReports: https://github.com/Breeding-Insight/BIGr/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Depends: R (>= 4.4.0)
biocViews:
Imports:
parallel,
Depends:
R (>= 4.4.0)
Imports:
Biostrings,
dplyr,
Rdpack (>= 0.7),
ggplot2,
grDevices,
graphics,
grid,
parallel,
pwalign,
readr (>= 2.1.5),
reshape2 (>= 1.4.4),
rlang,
tidyr (>= 1.3.1),
vcfR (>= 1.15.0),
Rsamtools,
Biostrings,
pwalign,
janitor,
quadprog,
tibble,
stats,
stringr,
data.table
Suggests:
tibble,
tidyr (>= 1.3.1),
tools,
utils,
vcfR (>= 1.15.0)
Suggests:
testthat (>= 3.0.0),
circlize,
covr,
ggplot2,
spelling,
polyRAD,
rmdformats,
knitr (>= 1.10),
knitr,
rmarkdown,
polyRAD,
testthat (>= 3.0.0)
RdMacros: Rdpack
readxl,
writexl
biocViews:
Config/roxygen2/version: 8.0.0
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
26 changes: 9 additions & 17 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,49 +1,35 @@
# Generated by roxygen2: do not edit by hand

export(allele_freq_poly)
export(calculate_Het)
export(calculate_MAF)
export(check_homozygous_trios)
export(check_madc_sanity)
export(check_ped)
export(check_replicates)
export(dosage2vcf)
export(dosage_ratios)
export(filterMADC)
export(filterVCF)
export(find_parentage)
export(flip_dosage)
export(get_countsMADC)
export(imputation_concordance)
export(madc2gmat)
export(madc2vcf_all)
export(madc2vcf_multi)
export(madc2vcf_targets)
export(madc_plot)
export(madc_summary)
export(merge_MADCs)
export(solve_composition_poly)
export(thinSNP)
export(updog2vcf)
export(validate_pedigree)
import(dplyr)
import(janitor)
import(parallel)
import(quadprog)
import(stringr)
import(tibble)
import(tidyr)
import(vcfR)
importFrom(Biostrings,DNAString)
importFrom(Biostrings,reverseComplement)
importFrom(Rdpack,reprompt)
importFrom(Rsamtools,bgzip)
importFrom(data.table,CJ)
importFrom(data.table,as.data.table)
importFrom(data.table,copy)
importFrom(data.table,data.table)
importFrom(data.table,fread)
importFrom(data.table,fwrite)
importFrom(data.table,rbindlist)
importFrom(data.table,set)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
importFrom(dplyr,arrange)
Expand All @@ -56,13 +42,19 @@ importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,ungroup)
importFrom(dplyr,where)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_text)
importFrom(ggplot2,geom_bar)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,labs)
importFrom(ggplot2,theme)
importFrom(ggplot2,theme_minimal)
importFrom(pwalign,nucleotideSubstitutionMatrix)
importFrom(pwalign,pairwiseAlignment)
importFrom(readr,read_csv)
importFrom(reshape2,dcast)
importFrom(reshape2,melt)
importFrom(rlang,sym)
importFrom(stats,cor)
importFrom(stats,reorder)
importFrom(stats,setNames)
importFrom(tibble,as_tibble)
Expand Down
43 changes: 43 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# BIGr 0.10.0

* New `madc_summary()`: read-only summary tables for a fixed allele ID MADC - a per-marker microhaplotype frequency distribution, per-sample and per-marker total read depth (`depth`) and on-target `|Ref`/`|Alt` depth (`target_depth`) alongside missing rate, number of mHaps, and off-target read fraction, a missingness threshold sweep, an overall summary, and optional aggregation by a sample-metadata category (e.g. species).
* New `madc_plot()`: visualize a fixed allele ID MADC via a `plot.type` selector - a PCA of alternative read ratios (color by a metadata category, optional second variable by point `shape.col`, custom `palette`), a linear marker-distribution genome plot, a markers x samples read-depth/#mHaps heatmap (failed cells black; depth on a colorblind-safe diverging scale; samples sorted/labeled by category and optionally faceted by chromosome), a per-sample missing-data boxplot (optionally ordered by median missing rate via `miss.sort` and drawn horizontally via `horizontal`), and a publication-oriented `circos` circular plot. The `circos` figure carries four concentric tracks - dominant per-marker locus ticks with a distinct Mb coordinate axis ("Loci"), a marker-density heatmap ring ("Density", window set by `density.window`), log-scaled #mHaps two-tone bars - a neutral base with a red over-threshold segment above a dashed reference ring - flagging paralog-suspect loci ("mHaps", threshold `paralog.flag`), and a gapless depth ribbon flagging problematic and high-depth-outlier loci ("Depth") - identified by horizontal track titles in a 12 o'clock corridor (`label.gap`) with a single compact legend in the center; track colors are customizable (`mhap.col`, `depth.col`, `density.col`). The "Depth" ribbon flags a marker as problematic when its mean depth is below `min.depth` OR its missing rate exceeds `depth.qc.maxmiss` (default 0.5), so high-dropout markers (e.g. 50% zeros / 50% deep) that a mean-depth cut alone reads as normal are caught. Requesting several (non-circos) types returns a multi-panel figure; figures can be saved via `output.file`. Plotting uses `ggplot2` + base `grid`; the `circos` plot uses the suggested `circlize` package.
* `madc_plot()` also provides two QC-focused `plot.type`s: `"balance"`, a ploidy-aware allele read-ratio diagnostic (alt read ratio vs target depth as a 2D density), and `"depth"`, a log-scaled marker mean-depth (uniformity) distribution with a `min.depth` reference line and median/IQR. The `"balance"` plot shows every cell with a defined ratio (including below `min.depth`, marked by a dotted reference line) and, when `ploidy` is given, dashed guides at the expected `(0:ploidy)/ploidy` ratios plus a depth-dependent 95% binomial expectation band around each interior expected ratio (the spread of `A/D` under `Binomial(D, ratio)`), so allele-balance dispersion wider than sequencing-depth sampling noise stands out directly. `balance.density = TRUE` stacks a marginal histogram of the alt-read ratio above the heatmap (returning a composite grob). Heatmap sub-sampling (`max.loci`/`max.samples`) is now deterministic (evenly spaced) so repeated calls give identical figures.
* `madc_plot(titles = FALSE)` drops the title and subtitle from every requested plot (including the `circos` figure, the multi-panel, and the `balance.density` composite), leaving axis labels, legends, and the `"balance"` caption - for figures captioned externally (manuscript, report, slide). Default `TRUE` keeps the current behavior.
* `madc_summary()` additions: per-sample/per-marker depth is summarized with robust statistics (`median_depth`, `depth_mad`, `depth_q10`, `depth_q90`) alongside the mean, plus `total_reads`/`target_reads` and `call_rate`; off-target is reported both as the mean per-locus ratio (`offtarget_fraction`) and read-weighted `sum(offtarget)/sum(total)` (`offtarget_fraction_weighted`, the "% of reads off target" number); the ambiguous mHap count is split into `n_mhaps_defined` (allele rows in the panel) and `n_mhaps_observed` (alleles actually supported by reads). Two new tables: `depth_sweep` (a read-depth threshold sweep mirroring the missingness sweep) and `marker_qc` (advisory per-marker `PASS`/`FLAG`/`FAIL` status with a reason string, thresholds `min.locus.depth`/`max.locus.depth`/`max.missing`/`max.offtarget`/`max.mhaps.per.loci` reusing `filterMADC`'s vocabulary; it classifies without removing). Tables can be written as per-table CSVs or, with `output.format = "xlsx"`, a single workbook with one sheet per table (requires the suggested `writexl` package).
* `filterMADC` updates:
* Now only accepts fixed allele ID MADC files (processed through HapApp). The input is validated with `check_madc_sanity` and raw DArT MADC files (or any file without fixed AlleleIDs) are rejected with an error. This also fixes a crash on raw MADC files caused by non-unique AlleleIDs.
* Removed the `n.summary.columns` argument (breaking change). Fixed allele ID MADC has a fixed column layout, so summary columns no longer need to be specified or detected.
* Replaced the per-mhap `min.mean.reads`/`max.mean.reads` arguments with a per-locus depth window `min.locus.depth`/`max.locus.depth` (breaking change). Depth is the mean reads per sample at a locus (sum of all mhap reads at the locus divided by the number of samples), and loci outside the window are removed whole (Ref and Alt together) - e.g. `max.locus.depth` to exclude paralogous over-amplification.
* `max.mhaps.per.loci` and `target.only` now retain strictly the target `|Ref`/`|Alt` alleles at affected loci, also removing `|Other` alleles (previously only `|RefMatch`/`|AltMatch` were removed).
* The `min.ind.with.reads` presence filter now protects the target `|Ref`/`|Alt` alleles, only pruning non-target (`|RefMatch`/`|AltMatch`/`|Other`) mhaps, so a locus never loses its Ref/Alt pair.
* Fixed `madc2vcf_targets()` removing markers with no match in `markers_info` as invalid POS values, without the warning "markers removed: no matching entry found in markers_info". The POS correction now runs after these markers are removed and reported.
* Fixed `filterVCF()` deciding whether to apply `filter.DP` and `filter.MPP` from the FORMAT column of the first record only. The FORMAT fields are now read from every record, and the missing call written for a filtered genotype matches the FORMAT of its own record. Calls without a DP or MPP value are left unchanged.
* `filterVCF()` now gives an error when `filter.SAMPLE.miss` or `filter.SNP.miss` is outside 0 to 1, so a percentage such as `20` is no longer accepted as a threshold that keeps every sample or variant.
* `madc2vcf_all()` now records `markers_info`, `add_others`, `others_max_snps`, `others_rm_with_indels`, `others_min_dist`, and `others_max_close_snps` in the `##BIGrCommandLine` header line of the VCF.
* `updog2vcf()` now removes SNPs whose position cannot be read from the SNP ID as a positive integer (expected format CHR_POS), with a warning, instead of writing a POS of `0` or `NA` to the VCF.


# BIGr 0.9.0

* `check_madc_sanity` updates: distinguish presence of IUPAC codes on REF/ALT (return logical variable IUPACcodes) from RefMatch/AltMatch/Others (returned logical variable IUPACcodes_MatchAlleles) and from Identical IUPAC code in identical positions in REF/ALT (returned logical variable IUPACcodes_IdenticalRefAlt)
* Two new arguments to the `madc2vcf_all` function:
* `others_min_dist` (default 5bp)
* `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 polymorphisms in Match or Other alleles at the same position
* `madc2vcf_targets` and `madc2vcf_multi` will only throw an error if different IUPAC are present in REF/ALT sequences (IUPACcodes = TRUE)


# BIGr 0.8.1

- Fixed `filterVCF()` discarding SNPs whose INFO values are written in scientific notation. The `OD`, `BIAS`, and `PMC` filters read INFO values with a pattern that accepted only digits and decimal points, so a value such as `PMC=4.78e-07` was read as `4.78` and failed a `filter.PMC = 0.05` threshold that it actually passed by five orders of magnitude. `updog2vcf()` writes these values with `paste0()`, so R's default formatting produces scientific notation for small numbers, and updog's `od` and `prop_mis` are routinely small for good markers - meaning the SNPs most likely to be dropped were the cleanest ones. INFO values are now parsed with `as.numeric()` on the whole field, accepting any valid numeric representation. Field names are also matched against a complete INFO entry rather than as a substring, so a field such as `XOD` is no longer mistaken for `OD`.
- Fixed `filterVCF()` writing corrupt all-`NA` variants when a filter value could not be read. A logical index containing `NA` does not drop a row in R, it inserts a row of `NA`s, so any variant with an unreadable `OD`, `BIAS` or `PMC` value, or an `NA` minor allele frequency, was written into the output with an empty `CHROM`, `POS`, `REF` and `ALT`. The `NA` frequency case was reachable through normal use, because `vcfR::maf()` returns `NA` for a variant left with no called genotypes and the `filter.DP` and `filter.MPP` masking can produce exactly that. These variants are now removed, and the number removed is reported in a warning so that they are never discarded silently.
- `filterVCF()` now removes variants when none of them have a readable value for a requested filter, instead of returning the data unfiltered. Previously the `OD`, `BIAS` and `PMC` filters skipped filtering entirely in that situation and reported only "No valid values found", so a run that filtered nothing could look like a run that succeeded. All of the filters now behave the same way, and the warning names the likely cause so it can be diagnosed.
- Fixed `filterVCF()` skipping a requested `OD`, `BIAS` or `PMC` filter when the first variant in the file did not carry that INFO field. The available INFO fields were read from the first record only, so a field that was absent from that one record disabled its filter for the entire file, with no warning and no indication in the output that filtering had not happened. A field may legally be absent from any individual record, so requested filters are now applied to every record, and records without a usable value are removed and reported. This also removes the last case where the order of records in the file could change the result of filtering.
- Corrected and expanded the documentation for `filterVCF()`. `filter.DP` was described as a total read depth filter applied to each SNP; it is applied to each genotype call using the `DP` value in the FORMAT column, setting calls below the threshold to missing rather than removing variants. `filter.MPP` works the same way and was previously undescribed. The remaining filters now state which field they read and which direction the comparison runs, `filter.SAMPLE.miss` and `filter.SNP.miss` state that they take a proportion rather than a percentage, and `filter.BIAS.min` and `filter.BIAS.max` state that neither has any effect unless both are supplied. The return value is documented as a vcfR object when `output.file` is omitted, rather than always a gzipped file.
- Updated madc2vcf_all and madc2vcf_targets. Before, it was possible for POS to be exported as scientific notation instead of integers, and for negative POS values to be present for off target SNPs. POS are corrected to be integers, and SNPs with a negative POS value are removed.
- Removed the breed composition and pedigree functions `allele_freq_poly()`, `solve_composition_poly()`, `check_ped()`, `find_parentage()`, and `validate_pedigree()` (breaking change). They are now part of the independent BIGpopA package: https://github.com/Breeding-Insight/BIGpopA
- Fixed `madc2vcf_all()` error "invalid substring arguments" that occurred with `add_others = TRUE` when an off-target ("Other") allele aligned to the reference with no mismatch positions remaining after the target SNP position was removed. The reference/alternate base lookups for off-target alleles are now guarded by the existing non-empty check, matching how the off-target Match alleles are already handled.

# BIGr 0.7.2

- Fixed manual text errors
Expand Down
Loading
Loading