Skip to content

MHCtools

Analysis of MHC Data in Non-Model Species

v1.6.0 · Feb 14, 2026 · MIT + file LICENSE

Description

Sixteen tools for bioinformatics processing and analysis of major histocompatibility complex (MHC) data. The functions are tailored for amplicon data sets that have been filtered using the dada2 method (for more information on dada2, visit <https://benjjneb.github.io/dada2/> ), but even other types of data sets can be analyzed. The ReplMatch() function matches replicates in data sets in order to evaluate genotyping success. The GetReplTable() and GetReplStats() functions perform such an evaluation. The CreateFas() function creates a fasta file with all the sequences in the data set. The CreateSamplesFas() function creates individual fasta files for each sample in the data set. The DistCalc() function calculates Grantham, Sandberg, or p-distances from pairwise comparisons of all sequences in a data set, and mean distances of all pairwise comparisons within each sample in a data set. The function additionally outputs five tables with physico-chemical z-descriptor values (based on Sandberg et al. 1998) for each amino acid position in all sequences in the data set. These tables may be useful for further downstream analyses, such as estimation of MHC supertypes. The BootKmeans() function is a wrapper for the kmeans() function of the 'stats' package, which allows for bootstrapping. Bootstrapping k-estimates may be desirable in data sets, where e.g. BIC- vs. k-values do not produce clear inflection points ("elbows"). BootKmeans() performs multiple runs of kmeans() and estimates optimal k-values based on a user-defined threshold of BIC reduction. The method is an automated and bootstrapped version of visually inspecting elbow plots of BIC- vs. k-values. The ClusterMatch() function is a tool for evaluating whether different k-means() clustering models identify similar clusters, and summarize bootstrap model stats as means for different estimated values of k. It is designed to take files produced by the BootKmeans() function as input, but other data can be analyzed if the descriptions of the required data formats are observed carefully. The SynDist() function analyses of synonymous variation among aligned protein-coding DNA sequences, that is, nucleotide substitutions that do not translate to changes in the amino acid sequences due to degeneracy of the genetic code. The SynDist() function calculates synonymous nucleotide changes per base and per codon in pairwise sequence comparisons, as well as mean synonymous variation among all pairwise comparisons of the sequences within each sample in a data set. The PapaDiv() function compares parent pairs in the data set and calculate their joint MHC diversity, taking into account sequence variants that occur in both parents. The HpltFind() function infers putative haplotypes from families in the data set. The GetHpltTable() and GetHpltStats() functions evaluate the accuracy of the haplotype inference. The CreateHpltOccTable() function creates a binary (logical) haplotype-sequence occurrence matrix from the output of HpltFind(), for easy overview of which sequences are present in which haplotypes. The HpltMatch() function compares haplotypes to help identify overlapping and potentially identical types. The NestTablesXL() function translates the output from HpltFind() to an Excel workbook, that provides a convenient overview for evaluation and curating of the inferred putative haplotypes.

Downloads

336

Last 30 days

11537th

1K

Last 90 days

3.7K

Last year

Trend: -23.8% (30d vs prior 30d)

CRAN Check Status

14 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK

Check History

OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Dependency Network

Dependencies Reverse dependencies mgcv openxlsx MHCtools

Version History

new 1.6.0 Mar 10, 2026
updated 1.6.0 ← 1.5.5 diff Feb 13, 2026
updated 1.5.5 ← 1.5.4 diff Jan 17, 2025
updated 1.5.4 ← 1.5.3 diff Jan 14, 2025
updated 1.5.3 ← 1.5.2 diff Jul 7, 2023
updated 1.5.2 ← 1.5.1 diff Jun 30, 2023
updated 1.5.1 ← 1.5.0 diff Mar 21, 2023
updated 1.5.0 ← 1.4.3 diff Oct 18, 2022
updated 1.4.3 ← 1.4.2 diff Aug 14, 2022
updated 1.4.2 ← 1.4.1 diff May 22, 2022
updated 1.4.1 ← 1.4.0 diff Oct 10, 2021
updated 1.4.0 ← 1.3.0 diff Sep 13, 2021
updated 1.3.0 ← 1.2.1 diff Sep 15, 2020
updated 1.2.1 ← 1.2.0 diff Aug 10, 2019
updated 1.2.0 ← 1.1.1 diff Aug 7, 2019
updated 1.1.1 ← 1.1.0 diff Feb 3, 2019
updated 1.1.0 ← 1.0.0 diff Oct 22, 2017
new 1.0.0 Sep 28, 2017