Changelog
Source:NEWS.md
immunogenetr 1.4.0
CRAN release: 2026-07-06
Fixed
HLA_columns_to_GLstringproducing malformed GL Strings for molecular values held in serologic-named columns. A genuinely molecular value in aCwcolumn now emits a clean molecular locus name (*07:01->HLA-C*07:01) instead of the invalidHLA-Cw*07:01, and a bare leading*is once again treated as serologic (*17->HLA-Cw17), restoring the pre-1.3.0 behavior while keeping low-resolution molecular alleles such asA*01molecular. All spellings of a locus (e.g.C/Cw,DR/DRB1) are now grouped as a single locus so a locus is never split across^. (#40)Fixed
HLA_mismatch_number,HLA_mismatch_logical,HLA_mismatch_alleles, andHLA_mismatched_alleleserroring with a “missing locus” message when a locus group mixed serologic and molecular alleles (e.g.HLA-Cw7+HLA-Cw*17).HLA_mismatch_basenow derives each locus from the first allele of its group rather than slicing the rejoined group string at the first*. (#40)Added a
nomenclatureargument toHLA_columns_to_GLstringto declare the output nomenclature —"mol"(molecular) or"ser"(serologic) — either as a single value applied to every selected locus or as a named vector keyed per locus (the key may be given in either spelling). When absent, the function auto-detects per cell as before. Relabeling is structural only; no cross-nomenclature allele translation is performed. (#40)Corrected the serologic name for HLA-DPB1 from
HLA-DPto the formalizedHLA-DPBinHLA_columns_to_GLstring.Bwis now treated as an epitope and never forced to molecular. (#40)Standardized the capitalization of “GL String” throughout the package documentation, help pages, README, and vignette.
immunogenetr 1.3.0
CRAN release: 2026-05-26
Rewrote
HLA_prefix_removeto skip the GL String expand-and-reassemble round-trip. The previous implementation expanded each GL String into an ambiguity tibble, ranstr_replaceon it, and reassembled — which was the dominant cost in any pipeline that calledHLA_prefix_removeper cell. Now four direct regex passes on the GL String character vector. ~100× faster end-to-end, up to ~420× less memory allocated on 100,000-input workloads. Because many other functions in the package (includingHLA_columns_to_GLstring) callHLA_prefix_removeinternally, every downstream caller picks up the speedup for free.Rewrote
HLA_columns_to_GLstringto compute column-level decisions (locus mapping from column name, serologic-name lookup, “always molecular” flag for DQA1/DPA1/DPB1) once per column instead of once per cell, and replaced the two trailingsummarise(str_flatten(...))passes with vectorisedsplit+paste. End-to-end ~68× faster at 1000 rows (7.4 s -> 109 ms) and ~200× faster at 10,000 rows (~272 s -> ~1.3 s).Rewrote
HLA_mismatch_baseto replace the per-pairpurrr::map2_chrloop and stringr wrappers with base-R / stringi primitives, hoist invariants out of the per-pair loop, and short-circuit the null-allele regex on alleles that cannot match. ~26× faster at 100 pairs, ~11× faster at 10,000 pairs, and ~1000× less memory allocated on the large workload. Also tuned the residualunify_locus/ DRB3/4/5 classification / molecular prefix extraction hot spots exposed by the post-merge re-profile.Rewrote the four
HLA_mismatch_*derivatives (HLA_mismatch_logical,HLA_mismatch_number,HLA_mismatch_alleles,HLA_mismatched_alleles) to replace the sharedtibble -> separate_longer_delim -> separate_wider_delim -> summarisepost-processing pipeline with direct character-vector ops on an integer mismatch count matrix. 10-50× less memory; 10-15% faster per call (the underlyingHLA_mismatch_basecall now dominates).Rewrote
HLA_match_numberandHLA_match_summary_HCTto share a new internal helperhla_mismatch_count_matrix()that exposes the integer count matrixHLA_mismatch_numberalready builds, skipping the format-and-reparse round-trip through its string output. 15-20% faster end-to-end, 10-21× less memory per call.Rewrote
GLstring_expand_longerto replace the 7-leveltidyr::separate_longer_delim + row_number()chain with astringi::stri_split_fixedcascade that assembles the output tibble directly from equal-length index vectors. 20-43× faster depending on input size; up to 4× less memory.Rewrote
ambiguity_table_to_GLstringto replace six chaineddplyr::summarise(str_flatten(...))passes with a single sort-and-paste helper. Subsequent levels of the GL hierarchy skip the redundant sort since the composite index key stays sorted under prefix truncation. 2-13× faster depending on size and theremove_duplicatesflag.Rewrote
HLA_truncateto replace theGLstring_expand_longer -> 4x separate_wider_delim -> 4x unite -> ambiguity_table_to_GLstringpipeline with a vectorised per-allele truncator that flattens all fields across all alleles into a single long vector for regex processing, then collapses per allele in one pass. ~5× faster end-to-end at 1000 alleles.Rewrote
GLstring_gene_copies_combineto replace thepivot_longer -> mutate(str_extract) -> summarise(str_c) -> pivot_wider -> rename_withround-trip with a one-pass flat-vector build. ~7× faster at 1000 rows.Rewrote
GLstring_genesto replaceseparate_longer_delim -> rename -> mutate(str_extract) -> pivot_widerwith a directstringi::stri_split_fixed+ per-locus column build. 2.6-3.7× faster.Rewrote
GLstring_genes_expandedto replace thepivot_wider(values_fn = list) -> unnestpipeline with per-rowsplitandbind_rows. ~5× faster on 100 single-row calls, ~16× less memory. As a side effect, the function now handles multi-row input gracefully; the previous implementation errored onunnestwhen different rows had different allele counts per locus. Single-row semantics — including the intentional recycling of length-1 cells flagged as expected behavior in the test file — are preserved.Added
check_molecular_gl_string()internal validation helper for callers that want to enforce molecular-only GL String inputs (used at API boundaries). Opt-in; not wired into existing functions to preserve compatibility with serologic-input callers.Fixed a latent correctness bug in the “missing loci” check in
HLA_mismatch_baseintroduced during earlier optimization work. The check silently required a locus to be missing from both recipient and donor before erroring, instead of the original semantics of missing from either side. Restored the original behavior.Added a round-trip property test suite (
tests/testthat/test-round_trip.R) asserting thatambiguity_table_to_GLstring(GLstring_expand_longer(x)) == xfor a representative pool of GL Strings, and thatHLA_prefix_add/HLA_prefix_removeform an inverse pair on raw allele input. Added explicit NA-propagation regression tests forambiguity_table_to_GLstringandGLstring_genescovering bugs caught during the rewrite. Added tests forcheck_molecular_gl_string.Added
stringi(>= 1.7.0) as a directImportsdependency. It was previously a transitive dependency viastringr; this release uses it directly forstri_split_fixed,stri_startswith_fixed,stri_endswith_fixed, andstri_extract_first_regexin the rewritten functions.Removed
glueandmagrittrfromImports. No function in the package uses them directly after these rewrites (str_gluecalls were replaced withpaste0/paste;%>%is still available via@importFrom dplyr %>%).
immunogenetr 1.2.0
CRAN release: 2026-04-14
Added
scopeparameter toHLA_match_summary_HCTwith options"locus"(default) and"genotype". Whenscope = "genotype"anddirection = "bidirectional", the function calculates GvH and HvG match summaries separately and returns the maximum of the two totals, rather than taking the minimum match at each locus before summing.Simplified
HLA_match_summary_HCTinternals: replaced the tibble parsing pipeline withstr_extract_all()andmap_int()for summing per-locus match counts.
immunogenetr 1.1.0
CRAN release: 2026-04-07
Internal code quality improvements: fixed typos in internal variable names, corrected test filenames, and cleaned up
globalVariables()declarations.Standardized all error messages to use
cli_abort()for consistent, informative error reporting across the package. Bumpedclidependency to >= 3.0.0.Added input validation to all exported functions. Functions now check for NULL, wrong types, and invalid parameter values before processing, providing clear error messages instead of cryptic failures. Added internal validation helper functions (
check_gl_string,check_data_frame,check_loci,check_logical_flag,check_homozygous_count,check_fields).Added
match.arg()validation formatch_gradeanddirectionparameters inHLA_match_summary_HCT.Refactored duplicated matching logic across
HLA_match_summary_HCT,HLA_match_number,HLA_mismatch_number, andHLA_mismatch_logical. Replaced repeated direction-branching code blocks with parameterized pipelines, significantly reducing code duplication with no changes to behavior.Optimized
HLA_mismatch_base: consolidated duplicated GvH/HvG mismatch calculation into a single parameterized code path, eliminated repeatedstrsplit()calls within the mismatch loop, and extracted duplicated locus-naming logic into a shared helper function.Optimized
HLA_mismatch_numberandHLA_mismatch_logicalto only compute the requested direction(s). Previously both functions always computed GvH and HvG regardless of the requested direction; now HvG, GvH, and SOT requests only compute a single direction, cuttingHLA_mismatch_basecalls in half. Bidirectional requests still compute both as needed. Also extracted duplicated multi-locus table-building code into internal helper functions.Expanded test coverage for
HLA_mismatch_logical,HLA_match_number, andHLA_mismatched_allelesusing themismatch_table_2010andmismatch_table_2016consensus reference tables, matching the existing comprehensive table-based tests inHLA_mismatch_number.Optimized
HLA_columns_to_GLstring: replaced 16 case-insensitive regex calls for locus detection with a singletolower()plusstartsWith()lookups (~7.5x faster), replaced the serologic namecase_whenwith a named vector lookup (~37x faster), and combined multiplestr_detect()calls for molecular typing detection into single patterns.Optimized
HLA_truncate: replaced four nearly-identicalif/elseblocks for field selection with a parameterized approach using computedkeep_cols/drop_colsvectors, reducing code duplication and improving maintainability.Optimized
ambiguity_table_to_GLstring: extracted acollapse_level()helper function to replace six repetitions of the conditionaldistinct()+summarise()pattern, significantly reducing code duplication.Optimized
GLstring_genotype_ambiguity: simplified the gene-separator error detection from a multi-step pipeline to a single vectorized check, and combined two separatestr_replace()+na_if()calls into one operation.Expanded test coverage for
HLA_column_repair,GLstring_genes,GLstring_regex, andread_HMLwith comprehensive tests covering format conversions, parameter combinations, edge cases, input validation, and error handling.Fixed
read_HMLto dynamically discover the XML namespace instead of hardcoding thed1:prefix. The function now usesxml_ns()to detect the namespace from the file, improving compatibility with HML files from different sources.Fixed null allele detection regex in
HLA_mismatch_baseto support locus names longer than 4 characters (e.g.HLA-DRB345). The lookbehind now allows up to 10 alphanumeric characters afterHLA-.Added a “Getting Started” vignette covering all major workflows: tabular-to-GL String conversion, locus splitting, mismatch/match calculation, allele name utilities, and HML file reading.
Added a package-level help page (
?immunogenetr) organizing all exported functions and datasets by category.Added
inst/CITATIONfile for the package publication: Coskun & Brown (2026), “Immunogenetr: A comprehensive toolkit for clinical HLA informatics,” Human Immunology, 87(1):111619. doi:10.1016/j.humimm.2025.111619.
immunogenetr 1.0.1
CRAN release: 2025-10-22
- Added a disclaimer to the package for it being for research use only. Added a disclaimer to the help file for
HLA_truncateto warn users about the ability to make non-WHO-compliant allele names with certain settings. UpdatedHLA_mismatch_baseto better handle missing loci at the DRB3/4/5 locus.
immunogenetr 1.0.0
CRAN release: 2025-08-19
- Added
HLA_mismatch_allelesas a synonym ofHLA_mismatched_alleles. Added minimum versions in DESCRIPTION. Stable release; updated version to 1.0.0.
immunogenetr 0.3.1
CRAN release: 2025-06-25
- Updated
HLA_columns_to_GLstringto fix issues processing DRB3/4/5 alleles.
immunogenetr 0.3.0
CRAN release: 2025-06-18
- Updated
ambiguity_table_to_GLstringto remove duplicate entries from an ambiguity table as it is being processed to a GL String. Added this functionality toHLA_truncateso that truncated GL Strings could optionally remove duplicates. AddedGLstring_to_ambiguity_tableas an alias forGL_string_expand_longer.