Loading pkgs/development/r-modules/default.nix +37 −0 Original line number Diff line number Diff line Loading @@ -1318,6 +1318,43 @@ let buildInputs = [ cacert ] ++ attrs.buildInputs; }); immunotation = let MHC41alleleList = fetchurl { url = "https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/allele.list"; hash = "sha256-CRZ+0uHzcq5zK5eONucAChXIXO8tnq5sSEAS80Z7jhg="; }; MHCII40alleleList = fetchurl { url = "https://services.healthtech.dtu.dk/services/NetMHCIIpan-4.0/alleles_name.list"; hash = "sha256-K4Ic2NUs3P4IkvOODwZ0c4Yh8caex5Ih0uO5jXRHp40="; }; # List of valid countries, regions and ethnic groups # The original page is changing a bit every day, but the relevant # content does not. Use archive.org to get a stable snapshot. # It can be updated from time to time, or when the package becomes # deficient. This may be difficult to know. # Update the snapshot date, and add id_ after it, as described here: # https://web.archive.org/web/20130806040521/http://faq.web.archive.org/page-without-wayback-code/ validGeographics = fetchurl { url = "https://web.archive.org/web/20240418194005id_/http://www.allelefrequencies.net/hla6006a.asp"; hash = "sha256-m7Wkmh/cPxeqn94LwoznIh+fcFXskmSGErUYj6kTqak="; }; in old.immunotation.overrideAttrs (attrs: { patches = [ ./patches/immunotation.patch ]; postPatch = '' substituteInPlace "R/external_resources_input.R" --replace-fail \ "nix-NetMHCpan-4.1-allele-list" ${MHC41alleleList} substituteInPlace "R/external_resources_input.R" --replace-fail \ "nix-NETMHCIIpan-4.0-alleles-name-list" ${MHCII40alleleList} substituteInPlace "R/AFND_interface.R" --replace-fail \ "nix-valid-geographics" ${validGeographics} ''; }); rstan = old.rstan.overrideAttrs (attrs: { env = (attrs.env or { }) // { NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + " -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION"; Loading pkgs/development/r-modules/patches/immunotation.patch 0 → 100644 +47 −0 Original line number Diff line number Diff line diff --git a/R/AFND_interface.R b/R/AFND_interface.R index b62e8e0..0f22d85 100644 --- a/R/AFND_interface.R +++ b/R/AFND_interface.R @@ -244,9 +244,9 @@ check_population <- function(hla_population) { #' @return list of valid countries, regions and ethnic origin #' @keywords internal get_valid_geographics <- function() { - url <- "http://www.allelefrequencies.net/hla6006a.asp?" - html_input <- getURL(url, read_method = "html") - + # http://www.allelefrequencies.net/hla6006a.asp? + html_input <- xml2::read_html("nix-valid-geographics") + rvest_tables <- rvest::html_table(html_input, fill = TRUE) # country diff --git a/R/external_resources_input.R b/R/external_resources_input.R index c4b1dc1..8fc5881 100644 --- a/R/external_resources_input.R +++ b/R/external_resources_input.R @@ -74,16 +74,17 @@ getURL <- function(URL, N.TRIES=2L, # MHC I # netmhcI_input_template is an internal variable containing list of valid # NetMHCpan input alleles -netmhcI_input_template <- getURL( - URL="https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/allele.list", - read_method = "delim", delim = "\t", - col_names = c("netmhc_input", "hla_chain_name", "HLA_gene")) +netmhcI_input_template <- readr::read_delim( + # https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/allele.list + "nix-NetMHCpan-4.1-allele-list", + delim = "\t", + skip = 0, + col_names = c("netmhc_input", "hla_chain_name", "HLA_gene") + ) # MHC II -lines <- getURL( - URL = paste0("https://services.healthtech.dtu.dk/services/", - "NetMHCIIpan-4.0/alleles_name.list"), - read_method = "lines") +# https://services.healthtech.dtu.dk/services/NetMHCIIpan-4.0/alleles_name.list +lines <- readr::read_lines("nix-NETMHCIIpan-4.0-alleles-name-list") lines_rep <- stringr::str_replace_all(lines, "\t+|\\s\\s+", "\t") netmhcII_input_template <- suppressWarnings( suppressMessages(read.delim(textConnection(lines_rep), sep = "\t"))) Loading
pkgs/development/r-modules/default.nix +37 −0 Original line number Diff line number Diff line Loading @@ -1318,6 +1318,43 @@ let buildInputs = [ cacert ] ++ attrs.buildInputs; }); immunotation = let MHC41alleleList = fetchurl { url = "https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/allele.list"; hash = "sha256-CRZ+0uHzcq5zK5eONucAChXIXO8tnq5sSEAS80Z7jhg="; }; MHCII40alleleList = fetchurl { url = "https://services.healthtech.dtu.dk/services/NetMHCIIpan-4.0/alleles_name.list"; hash = "sha256-K4Ic2NUs3P4IkvOODwZ0c4Yh8caex5Ih0uO5jXRHp40="; }; # List of valid countries, regions and ethnic groups # The original page is changing a bit every day, but the relevant # content does not. Use archive.org to get a stable snapshot. # It can be updated from time to time, or when the package becomes # deficient. This may be difficult to know. # Update the snapshot date, and add id_ after it, as described here: # https://web.archive.org/web/20130806040521/http://faq.web.archive.org/page-without-wayback-code/ validGeographics = fetchurl { url = "https://web.archive.org/web/20240418194005id_/http://www.allelefrequencies.net/hla6006a.asp"; hash = "sha256-m7Wkmh/cPxeqn94LwoznIh+fcFXskmSGErUYj6kTqak="; }; in old.immunotation.overrideAttrs (attrs: { patches = [ ./patches/immunotation.patch ]; postPatch = '' substituteInPlace "R/external_resources_input.R" --replace-fail \ "nix-NetMHCpan-4.1-allele-list" ${MHC41alleleList} substituteInPlace "R/external_resources_input.R" --replace-fail \ "nix-NETMHCIIpan-4.0-alleles-name-list" ${MHCII40alleleList} substituteInPlace "R/AFND_interface.R" --replace-fail \ "nix-valid-geographics" ${validGeographics} ''; }); rstan = old.rstan.overrideAttrs (attrs: { env = (attrs.env or { }) // { NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + " -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION"; Loading
pkgs/development/r-modules/patches/immunotation.patch 0 → 100644 +47 −0 Original line number Diff line number Diff line diff --git a/R/AFND_interface.R b/R/AFND_interface.R index b62e8e0..0f22d85 100644 --- a/R/AFND_interface.R +++ b/R/AFND_interface.R @@ -244,9 +244,9 @@ check_population <- function(hla_population) { #' @return list of valid countries, regions and ethnic origin #' @keywords internal get_valid_geographics <- function() { - url <- "http://www.allelefrequencies.net/hla6006a.asp?" - html_input <- getURL(url, read_method = "html") - + # http://www.allelefrequencies.net/hla6006a.asp? + html_input <- xml2::read_html("nix-valid-geographics") + rvest_tables <- rvest::html_table(html_input, fill = TRUE) # country diff --git a/R/external_resources_input.R b/R/external_resources_input.R index c4b1dc1..8fc5881 100644 --- a/R/external_resources_input.R +++ b/R/external_resources_input.R @@ -74,16 +74,17 @@ getURL <- function(URL, N.TRIES=2L, # MHC I # netmhcI_input_template is an internal variable containing list of valid # NetMHCpan input alleles -netmhcI_input_template <- getURL( - URL="https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/allele.list", - read_method = "delim", delim = "\t", - col_names = c("netmhc_input", "hla_chain_name", "HLA_gene")) +netmhcI_input_template <- readr::read_delim( + # https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/allele.list + "nix-NetMHCpan-4.1-allele-list", + delim = "\t", + skip = 0, + col_names = c("netmhc_input", "hla_chain_name", "HLA_gene") + ) # MHC II -lines <- getURL( - URL = paste0("https://services.healthtech.dtu.dk/services/", - "NetMHCIIpan-4.0/alleles_name.list"), - read_method = "lines") +# https://services.healthtech.dtu.dk/services/NetMHCIIpan-4.0/alleles_name.list +lines <- readr::read_lines("nix-NETMHCIIpan-4.0-alleles-name-list") lines_rep <- stringr::str_replace_all(lines, "\t+|\\s\\s+", "\t") netmhcII_input_template <- suppressWarnings( suppressMessages(read.delim(textConnection(lines_rep), sep = "\t")))