1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # dependencies
7 appdirs,
8 keras,
9 mhcgnomes,
10 numpy,
11 pandas,
12 pyyaml,
13 scikit-learn,
14 tensorflow,
15 tf-keras,
16 tqdm,
17
18 # tests
19 pytestCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "mhcflurry";
24 version = "2.1.5";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "openvax";
29 repo = "mhcflurry";
30 tag = "v${version}";
31 hash = "sha256-TNb3oKZvgBuXoSwsTuEJjFKEVZyHynazuPInj7wVKs8=";
32 };
33
34 # pipes has been removed in python 3.13
35 postPatch = ''
36 substituteInPlace mhcflurry/downloads.py \
37 --replace-fail \
38 "from pipes import quote" \
39 "from shlex import quote"
40 '';
41
42 # keras and tensorflow are not in the official setup.py requirements but are required for the CLI utilities to run.
43 dependencies = [
44 appdirs
45 keras
46 mhcgnomes
47 numpy
48 pandas
49 pyyaml
50 scikit-learn
51 tensorflow
52 tf-keras
53 tqdm
54 ];
55
56 nativeCheckInputs = [
57 pytestCheckHook
58 ];
59
60 disabledTests = [
61 # RuntimeError: Missing MHCflurry downloadable file: /homeless-shelter/.local...
62 "test_a1_mage_epitope_downloaded_models"
63 "test_a1_titin_epitope_downloaded_models"
64 "test_a2_hiv_epitope_downloaded_models"
65 "test_basic"
66 "test_caching"
67 "test_class1_neural_network_a0205_training_accuracy"
68 "test_commandline_sequences"
69 "test_correlation"
70 "test_csv"
71 "test_downloaded_predictor_gives_percentile_ranks"
72 "test_downloaded_predictor_invalid_peptides"
73 "test_downloaded_predictor_is_savable"
74 "test_downloaded_predictor_is_serializable"
75 "test_downloaded_predictor_small"
76 "test_downloaded_predictor"
77 "test_fasta_50nm"
78 "test_fasta_best"
79 "test_fasta"
80 "test_merge"
81 "test_no_csv"
82 "test_on_hpv"
83 "test_run_cluster_parallelism"
84 "test_run_parallel"
85 "test_run_serial"
86 "test_speed_allele_specific"
87 "test_speed_pan_allele"
88 ];
89
90 disabledTestPaths = [
91 # RuntimeError: Missing MHCflurry downloadable file: /homeless-shelter/.local...
92 "test/test_changing_allele_representations.py"
93 "test/test_class1_affinity_predictor.py"
94 "test/test_class1_pan.py"
95 ];
96
97 pythonImportsCheck = [ "mhcflurry" ];
98
99 meta = {
100 description = "Peptide-MHC I binding affinity prediction";
101 homepage = "https://github.com/openvax/mhcflurry";
102 changelog = "https://github.com/openvax/mhcflurry/releases/tag/v${version}";
103 license = lib.licenses.asl20;
104 maintainers = with lib.maintainers; [ samuela ];
105 };
106}