Skip to content

Commit 8505ea7

Browse files
Merge pull request #20 from BorchLab/windows-system-fix
handling MHCnuggets
2 parents 2bac678 + 9954c4b commit 8505ea7

4 files changed

Lines changed: 51 additions & 15 deletions

File tree

R/calculatePeptideBindingLoad.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,14 +536,21 @@ calculatePeptideBindingLoad <- function(
536536
#'
537537
#' @keywords internal
538538
.predictBindingMHCnuggets <- function(peptides, alleles) {
539+
# Windows not supported for MHCnuggets
540+
541+
if (.Platform$OS.type == "windows") {
542+
stop("MHCnuggets backend is not supported on Windows due to TensorFlow/HDF5 path limitations. ",
543+
"Please use backend='pwm' or backend='netmhcpan' instead.",
544+
call. = FALSE)
545+
}
546+
539547
results <- data.frame(
540548
peptide = character(0),
541549
hla_allele = character(0),
542550
predicted_ic50 = numeric(0),
543551
stringsAsFactors = FALSE
544552
)
545553

546-
547554
# Run predictions for each allele
548555
for (allele in alleles) {
549556
# Determine MHC class from allele name

R/mhcnuggets.R

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@
4141
#' }
4242
#'
4343
#' @examples
44-
#' res <- predictMHCnuggets(
45-
#' peptides = c("SIINFEKL","LLFGYPVYV"),
46-
#' allele = "A*02:01",
47-
#' mhc_class = "I",
48-
#' rank_output = TRUE
49-
#' )
50-
#' head(res)
44+
#' \donttest{
45+
#' # MHCnuggets requires Python/TensorFlow and is not available on Windows
46+
#' if (.Platform$OS.type != "windows") {
47+
#' res <- predictMHCnuggets(
48+
#' peptides = c("SIINFEKL","LLFGYPVYV"),
49+
#' allele = "A*02:01",
50+
#' mhc_class = "I",
51+
#' rank_output = TRUE
52+
#' )
53+
#' head(res)
54+
#' }
55+
#' }
5156
#'
5257
#' @section License and Citation:
5358
#' mhcnuggets is licensed under the GNU General Public License v3.0.
@@ -73,6 +78,13 @@ predictMHCnuggets <- function(peptides,
7378
ba_models = FALSE,
7479
rank_output = FALSE,
7580
hla_env = deepmatchrEnv()) {
81+
# ---- Windows not supported ----
82+
if (.Platform$OS.type == "windows") {
83+
stop("MHCnuggets is not supported on Windows due to TensorFlow/HDF5 path limitations. ",
84+
"Please use the 'pwm' or 'netmhcpan' backend, or run on Linux/macOS.",
85+
call. = FALSE)
86+
}
87+
7688
# ---- fast input checks ----
7789
if (!is.character(peptides)) stop("`peptides` must be character.")
7890
if (!length(peptides)) return(data.frame(peptide = character(0L)))

man/predictMHCnuggets.Rd

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-predictMHCnuggets.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ testthat::local_edition(3)
44
testthat::skip_if_not_installed("basilisk")
55
testthat::skip_if_not_installed("reticulate")
66

7+
# Test Windows error handling first (before skipping on Windows)
8+
test_that("predictMHCnuggets errors on Windows", {
9+
testthat::skip_if_not(.Platform$OS.type == "windows", "Only runs on Windows")
10+
expect_error(
11+
predictMHCnuggets(peptides = "SIINFEKL", allele = "A*02:01"),
12+
"not supported on Windows"
13+
)
14+
})
15+
16+
# Skip remaining tests on Windows since MHCnuggets is not supported
17+
testthat::skip_on_os("windows")
18+
719
# Capture arguments passed through basiliskRun for assertions
820
.observed <- new.env(parent = emptyenv())
921

0 commit comments

Comments
 (0)