For this vignette, we use the same example as the MHCnuggets Python notebooks.
Get the path to the testing peptides, and show them:
if (is_mhcnuggets_installed()) {
peptides_path <- get_example_filename("test_peptides.peps")
expect_true(file.exists(peptides_path))
readLines(peptides_path, warn = FALSE)
}Pick an MHC-I haplotype:
if (is_mhcnuggets_installed()) {
mhc_1_haplotype <- "HLA-A02:01"
expect_true(mhc_1_haplotype %in% get_trained_mhc_1_haplotypes())
}Predict:
#{r mhc1_predict_ic50_from_file_no_ba_models}
if (is_mhcnuggets_installed()) {
mhcnuggets_options <- create_mhcnuggets_options(
mhc = mhc_1_haplotype
)
df <- predict_ic50_from_file(
peptides_path = peptides_path,
mhcnuggets_options = mhcnuggets_options
)
kable(df)
}
Predict:
#{r mhc1_predict_ic50_from_file_ba_models}
if (is_mhcnuggets_installed()) {
mhcnuggets_options <- create_mhcnuggets_options(
mhc = mhc_1_haplotype,
ba_models = TRUE
)
df <- predict_ic50_from_file(
peptides_path = peptides_path,
mhcnuggets_options = mhcnuggets_options
)
kable(df)
}
Use MCH-II haplotype:
if (is_mhcnuggets_installed()) {
mhc_2_haplotype <- "HLA-DRB101:01"
expect_true(mhc_2_haplotype %in% get_trained_mhc_2_haplotypes())
}Predict:
#{r mhc2_predict_ic50_from_file_no_ba_models}
if (is_mhcnuggets_installed()) {
mhcnuggets_options <- create_mhcnuggets_options(
mhc = mhc_2_haplotype
)
df <- predict_ic50_from_file(
peptides_path = peptides_path,
mhcnuggets_options = mhcnuggets_options
)
kable(df)
}
Use another MHC-I haplotype. In this case, MHCnuggets has not been trained upon it, but it is a valid supertype:
if (is_mhcnuggets_installed()) {
mhc_1_haplotype <- "HLA-A02:60"
expect_false(mhc_1_haplotype %in% get_trained_mhc_1_haplotypes())
}Predict:
#{r predict_mhc_1_haplotype_supertype}
if (is_mhcnuggets_installed()) {
mhcnuggets_options <- create_mhcnuggets_options(
mhc_class = "I",
mhc = mhc_1_haplotype
)
df <- predict_ic50_from_file(
peptides_path = peptides_path,
mhcnuggets_options = mhcnuggets_options
)
kable(df)
}
These are the MHC-I haplotypes that have a trained model.
These are the MHC-II haplotypes that have a trained model.
mhcnuggetsr_report()
#> ***************
#> * mhcnuggetsr *
#> ***************
#> OS: unix
#> **************
#> * MHCnuggets *
#> **************
#> Is MHCnuggets installed: FALSE
#> ****************
#> * session info *
#> ****************
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.6.1 (2026-06-24)
#> os Ubuntu 26.04 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Etc/UTC
#> date 2026-07-02
#> pandoc 3.8.3 @ /usr/local/bin/ (via rmarkdown)
#> quarto 1.9.37 @ /usr/local/bin/quarto
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> brio 1.1.5 2024-04-24 [2] RSPM (R 4.6.0)
#> bslib 0.11.0 2026-05-16 [2] RSPM (R 4.6.0)
#> buildtools 1.0.0 2026-07-01 [3] local (/pkg)
#> cachem 1.1.0 2024-05-16 [2] RSPM (R 4.6.0)
#> cli 3.6.6 2026-04-09 [2] RSPM (R 4.6.0)
#> devtools 2.5.2 2026-04-30 [2] RSPM (R 4.6.0)
#> digest 0.6.39 2025-11-19 [2] RSPM (R 4.6.0)
#> ellipsis 0.3.3 2026-04-04 [2] RSPM (R 4.6.0)
#> evaluate 1.0.5 2025-08-27 [2] RSPM (R 4.6.0)
#> fastmap 1.2.0 2024-05-15 [2] RSPM (R 4.6.0)
#> fs 2.1.0 2026-04-18 [2] RSPM (R 4.6.0)
#> glue 1.8.1 2026-04-17 [2] RSPM (R 4.6.0)
#> htmltools 0.5.9 2025-12-04 [2] RSPM (R 4.6.0)
#> jquerylib 0.1.4 2021-04-26 [2] RSPM (R 4.6.0)
#> jsonlite 2.0.0 2025-03-27 [2] RSPM (R 4.6.0)
#> knitr * 1.51 2025-12-20 [2] RSPM (R 4.6.0)
#> lifecycle 1.0.5 2026-01-08 [2] RSPM (R 4.6.0)
#> magrittr 2.0.5 2026-04-04 [2] RSPM (R 4.6.0)
#> maketools 1.3.2 2025-01-25 [3] RSPM (R 4.6.0)
#> memoise 2.0.1 2021-11-26 [2] RSPM (R 4.6.0)
#> mhcnuggetsr * 1.2.2 2026-07-02 [1] https://richelbilderbeek.r-universe.dev (R 4.6.1)
#> otel 0.2.0 2025-08-29 [2] RSPM (R 4.6.0)
#> pkgbuild 1.4.8 2025-05-26 [2] RSPM (R 4.6.0)
#> pkgload 1.5.3 2026-06-15 [2] RSPM (R 4.6.0)
#> purrr 1.2.2 2026-04-10 [2] RSPM (R 4.6.0)
#> R6 2.6.1 2025-02-15 [2] RSPM (R 4.6.0)
#> rappdirs 0.3.4 2026-01-17 [2] RSPM (R 4.6.0)
#> rlang 1.2.0 2026-04-06 [2] RSPM (R 4.6.0)
#> rmarkdown * 2.31 2026-03-26 [2] RSPM (R 4.6.0)
#> sass 0.4.10 2025-04-11 [2] RSPM (R 4.6.0)
#> sessioninfo 1.2.4 2026-06-04 [2] RSPM (R 4.6.0)
#> sys 3.4.3 2024-10-04 [2] RSPM (R 4.6.0)
#> testthat * 3.3.2 2026-01-11 [2] RSPM (R 4.6.0)
#> usethis 3.2.1 2025-09-06 [2] RSPM (R 4.6.0)
#> vctrs 0.7.3 2026-04-11 [2] RSPM (R 4.6.0)
#> xfun 0.59 2026-06-19 [2] RSPM (R 4.6.0)
#> yaml 2.3.12 2025-12-10 [2] RSPM (R 4.6.0)
#>
#> [1] /tmp/Rtmp8tt3ho/Rinst127646fa0d3b
#> [2] /github/workspace/pkglib
#> [3] /usr/local/lib/R/site-library
#> [4] /usr/lib/R/site-library
#> [5] /usr/lib/R/library
#> * ── Packages attached to the search path.
#>
#> ──────────────────────────────────────────────────────────────────────────────