weirdo 2.3.0__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {weirdo-2.3.0/weirdo.egg-info → weirdo-2.4.0}/PKG-INFO +4 -2
  2. {weirdo-2.3.0 → weirdo-2.4.0}/README.md +3 -1
  3. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_peptide_content_api.py +37 -1
  4. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_released_model.py +3 -0
  5. weirdo-2.4.0/test/test_score_policies.py +100 -0
  6. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/__init__.py +10 -1
  7. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/api.py +98 -13
  8. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/peptide_content.py +3 -7
  9. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/released.py +30 -8
  10. weirdo-2.4.0/weirdo/score_policies.py +257 -0
  11. {weirdo-2.3.0 → weirdo-2.4.0/weirdo.egg-info}/PKG-INFO +4 -2
  12. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo.egg-info/SOURCES.txt +2 -0
  13. {weirdo-2.3.0 → weirdo-2.4.0}/LICENSE +0 -0
  14. {weirdo-2.3.0 → weirdo-2.4.0}/MANIFEST.in +0 -0
  15. {weirdo-2.3.0 → weirdo-2.4.0}/pyproject.toml +0 -0
  16. {weirdo-2.3.0 → weirdo-2.4.0}/requirements.txt +0 -0
  17. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/analyze_taxonomy_buckets.py +0 -0
  18. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/audit_foreignness_definitions.py +0 -0
  19. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/category_data.py +0 -0
  20. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/category_eval.py +0 -0
  21. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/category_headroom.py +0 -0
  22. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/check_released_model.py +0 -0
  23. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/evaluate_improve_foreignness.py +0 -0
  24. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/evaluate_peptide_content_immunogenicity.py +0 -0
  25. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/evaluate_tcell_transfer.py +0 -0
  26. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/peptide_content_data.py +0 -0
  27. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/reference_proteome_data.py +0 -0
  28. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/tcell_stratified_eval.py +0 -0
  29. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/train_category_predictor.py +0 -0
  30. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/train_modal_long_run.py +0 -0
  31. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/train_peptide_content_modal.py +0 -0
  32. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/train_peptide_content_models.py +0 -0
  33. {weirdo-2.3.0 → weirdo-2.4.0}/scripts/viral_host_peptide_content_data.py +0 -0
  34. {weirdo-2.3.0 → weirdo-2.4.0}/setup.cfg +0 -0
  35. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_amino_acids.py +0 -0
  36. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_analyze_taxonomy_buckets.py +0 -0
  37. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_audit_foreignness_definitions.py +0 -0
  38. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_blosum.py +0 -0
  39. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_bundled_models.py +0 -0
  40. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_category_data.py +0 -0
  41. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_category_eval.py +0 -0
  42. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_cli_logic.py +0 -0
  43. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_data_manager.py +0 -0
  44. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_evaluate_improve_foreignness.py +0 -0
  45. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_evaluate_peptide_content_immunogenicity.py +0 -0
  46. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_evaluate_tcell_transfer.py +0 -0
  47. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_hamming.py +0 -0
  48. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_kmer_table.py +0 -0
  49. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_logic_consistency.py +0 -0
  50. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_mlp_scorers.py +0 -0
  51. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_mlp_sigmoid_head.py +0 -0
  52. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_model_downloads.py +0 -0
  53. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_ngram.py +0 -0
  54. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_peptide_content.py +0 -0
  55. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_peptide_content_data.py +0 -0
  56. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_peptide_features.py +0 -0
  57. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_pmbec.py +0 -0
  58. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_pretrained_category_model.py +0 -0
  59. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_reference_proteome_data.py +0 -0
  60. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_reference_proteome_manifest.py +0 -0
  61. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_reference_proteomes.py +0 -0
  62. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_scorers.py +0 -0
  63. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_swissprot_reference.py +0 -0
  64. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_tcell_stratified_eval.py +0 -0
  65. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_train_category_predictor.py +0 -0
  66. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_train_peptide_content_models.py +0 -0
  67. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_uniprot.py +0 -0
  68. {weirdo-2.3.0 → weirdo-2.4.0}/test/test_viral_host_peptide_content_data.py +0 -0
  69. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/amino_acid.py +0 -0
  70. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/amino_acid_alphabet.py +0 -0
  71. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/amino_acid_properties.py +0 -0
  72. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/blosum.py +0 -0
  73. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/chou_fasman.py +0 -0
  74. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/cli.py +0 -0
  75. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/common.py +0 -0
  76. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/data_manager.py +0 -0
  77. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/distances.py +0 -0
  78. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/kmer_table.py +0 -0
  79. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/BLOSUM30 +0 -0
  80. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/BLOSUM50 +0 -0
  81. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/BLOSUM62 +0 -0
  82. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/__init__.py +0 -0
  83. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/amino_acid_properties.txt +0 -0
  84. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/helix_vs_coil.txt +0 -0
  85. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/helix_vs_strand.txt +0 -0
  86. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/pmbec.mat +0 -0
  87. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/matrices/strand_vs_coil.txt +0 -0
  88. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/model_manager.py +0 -0
  89. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/peptide_vectorizer.py +0 -0
  90. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pmbec.py +0 -0
  91. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/peptide-content-v1/config.json +0 -0
  92. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/peptide-content-v1/evaluation.json +0 -0
  93. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/peptide-content-v1/metadata.json +0 -0
  94. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/peptide-content-v1/model.pt +0 -0
  95. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/swissprot-categories/config.json +0 -0
  96. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/swissprot-categories/manifest.json +0 -0
  97. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/swissprot-categories/metadata.json +0 -0
  98. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/pretrained/swissprot-categories/model.pt +0 -0
  99. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/reduced_alphabet.py +0 -0
  100. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/reference_proteome_manifests/reference-proteomes-v1.yaml +0 -0
  101. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/reference_proteomes.py +0 -0
  102. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/residue_contact_energies.py +0 -0
  103. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/__init__.py +0 -0
  104. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/base.py +0 -0
  105. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/config.py +0 -0
  106. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/mlp.py +0 -0
  107. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/peptide_features.py +0 -0
  108. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/reference.py +0 -0
  109. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/registry.py +0 -0
  110. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/similarity.py +0 -0
  111. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/swissprot.py +0 -0
  112. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/scorers/trainable.py +0 -0
  113. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/static_data.py +0 -0
  114. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo/uniprot.py +0 -0
  115. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo.egg-info/dependency_links.txt +0 -0
  116. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo.egg-info/entry_points.txt +0 -0
  117. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo.egg-info/requires.txt +0 -0
  118. {weirdo-2.3.0 → weirdo-2.4.0}/weirdo.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weirdo
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Metrics of immunological foreignness for candidate T-cell epitopes
5
5
  Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
6
  Project-URL: Homepage, https://github.com/pirl-unc/weirdo
@@ -71,7 +71,7 @@ from weirdo import predict_peptide_content
71
71
 
72
72
  result = predict_peptide_content(
73
73
  ["SIINFEKL", "GILGFVFTL"],
74
- self_categories=("mammals", "human"),
74
+ score_policy="human-microbial-content-v1",
75
75
  )
76
76
  ```
77
77
 
@@ -81,6 +81,8 @@ The score is useful for ranking peptide content, but it did not add a validated
81
81
  T-cell immunogenicity signal beyond MHC presentation or affinity. See
82
82
  [docs/peptide-content.md](docs/peptide-content.md) for the split, model comparison,
83
83
  host-specific guidance, and evaluation.
84
+ [docs/score-policies.md](docs/score-policies.md) defines the versioned human,
85
+ mouse, dog, generic-mammal, and stable human-complement scoring contracts.
84
86
 
85
87
  ## Quick Start
86
88
 
@@ -29,7 +29,7 @@ from weirdo import predict_peptide_content
29
29
 
30
30
  result = predict_peptide_content(
31
31
  ["SIINFEKL", "GILGFVFTL"],
32
- self_categories=("mammals", "human"),
32
+ score_policy="human-microbial-content-v1",
33
33
  )
34
34
  ```
35
35
 
@@ -39,6 +39,8 @@ The score is useful for ranking peptide content, but it did not add a validated
39
39
  T-cell immunogenicity signal beyond MHC presentation or affinity. See
40
40
  [docs/peptide-content.md](docs/peptide-content.md) for the split, model comparison,
41
41
  host-specific guidance, and evaluation.
42
+ [docs/score-policies.md](docs/score-policies.md) defines the versioned human,
43
+ mouse, dog, generic-mammal, and stable human-complement scoring contracts.
42
44
 
43
45
  ## Quick Start
44
46
 
@@ -30,10 +30,15 @@ class FakeContentModel:
30
30
  "protists",
31
31
  "mammals",
32
32
  "human",
33
+ "mouse",
34
+ "dog",
33
35
  ]
34
36
 
35
37
  def predict_proba(self, peptides):
36
- return np.tile([0.8, 0.1, 0.1, 0.1, 0.1, 0.2, 0.9], (len(peptides), 1))
38
+ return np.tile(
39
+ [0.8, 0.1, 0.1, 0.1, 0.1, 0.2, 0.9, 0.1, 0.3],
40
+ (len(peptides), 1),
41
+ )
37
42
 
38
43
 
39
44
  def test_predict_peptide_content_returns_named_summary_columns():
@@ -41,6 +46,8 @@ def test_predict_peptide_content_returns_named_summary_columns():
41
46
  assert result.loc[0, "microbial_like"] == pytest.approx(0.8)
42
47
  assert result.loc[0, "self_like"] == pytest.approx(0.2)
43
48
  assert result.loc[0, "microbial_foreign_like"] == pytest.approx(0.64)
49
+ assert result.attrs["score_policy"] == "mammal-microbial-content-v1"
50
+ assert result.attrs["host_taxon_id"] == 40674
44
51
 
45
52
 
46
53
  def test_predict_peptide_content_supports_species_augmented_self_bundle():
@@ -51,6 +58,33 @@ def test_predict_peptide_content_supports_species_augmented_self_bundle():
51
58
  )
52
59
  assert result.loc[0, "self_like"] == pytest.approx(0.9)
53
60
  assert result.loc[0, "microbial_foreign_like"] == pytest.approx(0.08)
61
+ assert result.attrs["score_policy"] == "custom-unversioned"
62
+
63
+
64
+ def test_predict_peptide_content_supports_named_human_and_mouse_policies():
65
+ human = predict_peptide_content(
66
+ "SIINFEKL", model=FakeContentModel(), score_policy="human-microbial-content-v1"
67
+ )
68
+ mouse = predict_peptide_content(
69
+ "SIINFEKL", model=FakeContentModel(), score_policy="mouse-microbial-content-v1"
70
+ )
71
+ assert human.loc[0, "microbial_foreign_like"] == pytest.approx(0.08)
72
+ assert mouse.loc[0, "microbial_foreign_like"] == pytest.approx(0.64)
73
+ assert human.attrs["host_taxon_id"] == 9606
74
+ assert mouse.attrs["host_taxon_id"] == 10090
75
+ assert human.attrs["score_policy_definition"]["formula"] == (
76
+ "source_times_one_minus_self"
77
+ )
78
+
79
+
80
+ def test_named_policy_cannot_be_mixed_with_custom_categories():
81
+ with pytest.raises(ValueError, match="cannot be combined"):
82
+ predict_peptide_content(
83
+ "SIINFEKL",
84
+ model=FakeContentModel(),
85
+ score_policy="human-microbial-content-v1",
86
+ self_categories=("human",),
87
+ )
54
88
 
55
89
 
56
90
  def test_exact_self_hit_overrides_learned_foreignness():
@@ -62,6 +96,7 @@ def test_exact_self_hit_overrides_learned_foreignness():
62
96
  assert result.loc[0, "exact_self_hit"]
63
97
  assert result.loc[0, "self_like"] == 1.0
64
98
  assert result.loc[0, "microbial_foreign_like"] == 0.0
99
+ assert result.loc[0, "self_like"] == 1.0
65
100
 
66
101
 
67
102
  def test_exact_self_hit_length_must_match_peptides():
@@ -102,3 +137,4 @@ def test_bundled_peptide_content_model_is_self_contained_and_usable():
102
137
  assert result.shape == (3, 17)
103
138
  assert result.drop(columns="peptide").to_numpy().min() >= 0.0
104
139
  assert result.drop(columns="peptide").to_numpy().max() <= 1.0
140
+ assert result.attrs["score_policy"] == "custom-unversioned"
@@ -39,6 +39,9 @@ def test_load_and_score_offline_without_user_cache(loader, monkeypatch, tmp_path
39
39
  )
40
40
  np.testing.assert_allclose(model.score(frame.peptide), 1 - frame.human)
41
41
  assert frame.attrs["prediction_identity"] == model.prediction_identity
42
+ assert frame.attrs["score_policy_definition"] == model.score_policy_definition
43
+ assert model.score_policy_definition["host_taxon_id"] == 9606
44
+ assert model.score_policy_definition["formula"] == "one_minus_self"
42
45
  assert not (tmp_path / "missing-home").exists()
43
46
 
44
47
 
@@ -0,0 +1,100 @@
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from weirdo import (
5
+ DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY,
6
+ DEFAULT_SCORE_POLICY,
7
+ apply_score_policy,
8
+ get_score_policy,
9
+ list_score_policies,
10
+ )
11
+
12
+
13
+ CATEGORIES = [
14
+ "viruses",
15
+ "bacteria",
16
+ "archaea",
17
+ "fungi",
18
+ "protists",
19
+ "mammals",
20
+ "human",
21
+ "mouse",
22
+ "dog",
23
+ ]
24
+
25
+
26
+ def test_registry_exposes_complete_json_compatible_definitions():
27
+ policies = list_score_policies()
28
+ names = {policy["policy_id"] for policy in policies}
29
+ assert DEFAULT_SCORE_POLICY in names
30
+ assert DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY in names
31
+ assert "human-microbial-content-v1" in names
32
+ assert "mouse-microbial-content-v1" in names
33
+ assert {policy["model_id"] for policy in list_score_policies("peptide-content-v1")} == {
34
+ "peptide-content-v1"
35
+ }
36
+ policies[0]["self_categories"].append("changed")
37
+ assert "changed" not in get_score_policy(policies[0]["policy_id"]).self_categories
38
+
39
+
40
+ def test_human_and_mouse_policies_apply_different_self_bundles():
41
+ values = np.asarray([[0.8, 0.2, 0.1, 0.1, 0.1, 0.3, 0.9, 0.1, 0.2]])
42
+ human = apply_score_policy(values, CATEGORIES, "human-microbial-content-v1")
43
+ mouse = apply_score_policy(values, CATEGORIES, "mouse-microbial-content-v1")
44
+ assert human["source_like"] == pytest.approx([0.8])
45
+ assert human["self_like"] == pytest.approx([0.9])
46
+ assert human["score"] == pytest.approx([0.08])
47
+ assert mouse["self_like"] == pytest.approx([0.3])
48
+ assert mouse["score"] == pytest.approx([0.56])
49
+
50
+
51
+ def test_exact_self_override_is_part_of_content_policy():
52
+ values = np.asarray(
53
+ [
54
+ [0.8, 0.2, 0.1, 0.1, 0.1, 0.3, 0.9, 0.1, 0.2],
55
+ [0.7, 0.2, 0.1, 0.1, 0.1, 0.4, 0.2, 0.1, 0.2],
56
+ ]
57
+ )
58
+ result = apply_score_policy(
59
+ values,
60
+ CATEGORIES,
61
+ "human-microbial-content-v1",
62
+ exact_self_hits=[True, False],
63
+ )
64
+ assert result["exact_self_hit"].tolist() == [True, False]
65
+ assert result["self_like"] == pytest.approx([1.0, 0.4])
66
+ assert result["score"] == pytest.approx([0.0, 0.42])
67
+
68
+
69
+ def test_released_human_complement_policy_has_no_pathogen_numerator():
70
+ values = np.asarray([[0.8, 0.25]])
71
+ result = apply_score_policy(
72
+ values,
73
+ ["viruses", "human"],
74
+ DEFAULT_SCORE_POLICY,
75
+ )
76
+ assert "source_like" not in result
77
+ assert result["score"] == pytest.approx([0.75])
78
+ with pytest.raises(ValueError, match="does not define an exact-self override"):
79
+ apply_score_policy(
80
+ values,
81
+ ["viruses", "human"],
82
+ DEFAULT_SCORE_POLICY,
83
+ exact_self_hits=[True],
84
+ )
85
+
86
+
87
+ def test_unknown_or_incompatible_policy_inputs_fail_clearly():
88
+ with pytest.raises(ValueError, match="Unknown score policy"):
89
+ get_score_policy("unknown")
90
+ with pytest.raises(ValueError, match="missing self categories"):
91
+ apply_score_policy(
92
+ np.asarray([[0.5]]), ["viruses"], "human-microbial-content-v1"
93
+ )
94
+ with pytest.raises(ValueError, match="one value per peptide"):
95
+ apply_score_policy(
96
+ np.zeros((1, len(CATEGORIES))),
97
+ CATEGORIES,
98
+ "human-microbial-content-v1",
99
+ exact_self_hits=[],
100
+ )
@@ -10,6 +10,13 @@ from .amino_acid_alphabet import (
10
10
  from .peptide_vectorizer import PeptideVectorizer
11
11
  from .distances import hamming
12
12
  from .peptide_content import MICROBIAL_CATEGORIES, summarize_peptide_content
13
+ from .score_policies import (
14
+ DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY,
15
+ ScorePolicy,
16
+ apply_score_policy,
17
+ get_score_policy,
18
+ list_score_policies,
19
+ )
13
20
  from .reference_proteomes import (
14
21
  REFERENCE_PROTEOMES,
15
22
  DownloadedReferenceProteome,
@@ -83,10 +90,12 @@ from .scorers import (
83
90
  # ML scorer
84
91
  from .scorers import MLPScorer
85
92
 
86
- __version__ = "2.3.0"
93
+ __version__ = "2.4.0"
87
94
 
88
95
  __all__ = [
89
96
  "DEFAULT_PRETRAINED_MODEL", "DEFAULT_SCORE_POLICY", "PretrainedModel",
97
+ "DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY", "ScorePolicy",
98
+ "apply_score_policy", "get_score_policy", "list_score_policies",
90
99
  "get_model_manifest", "load_pretrained_model",
91
100
  # Amino acid data
92
101
  "AminoAcid",
@@ -19,6 +19,12 @@ import numpy as np
19
19
 
20
20
  from .scorers import ScorerConfig, BaseScorer, TrainableScorer
21
21
  from .peptide_content import MICROBIAL_CATEGORIES, summarize_peptide_content
22
+ from .score_policies import (
23
+ DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY,
24
+ ScorePolicy,
25
+ apply_score_policy,
26
+ get_score_policy,
27
+ )
22
28
 
23
29
 
24
30
  # Cache for scorer instances by preset
@@ -328,16 +334,26 @@ def predict_peptide_content(
328
334
  peptides: Union[str, Sequence[str]],
329
335
  model: Optional[Union[str, BaseScorer]] = None,
330
336
  model_dir: Optional[str] = None,
331
- self_categories: Sequence[str] = ("mammals",),
332
- microbial_categories: Sequence[str] = MICROBIAL_CATEGORIES,
337
+ self_categories: Optional[Sequence[str]] = None,
338
+ microbial_categories: Optional[Sequence[str]] = None,
333
339
  exact_self_hits: Optional[Sequence[bool]] = None,
340
+ score_policy: Optional[Union[str, ScorePolicy]] = None,
334
341
  ):
335
- """Score complete 8--15mers with independent taxonomy outputs.
342
+ """Score complete 8--15mers under an explicit content-score policy.
336
343
 
337
344
  The returned ``microbial_foreign_like`` value is
338
345
  ``max(microbial categories) * (1 - max(self categories))``. It is a
339
346
  bounded ranking score, not a posterior probability of foreignness.
340
347
 
348
+ With no category overrides, the versioned
349
+ ``mammal-microbial-content-v1`` policy preserves the original numeric
350
+ default and records its full definition in ``DataFrame.attrs``. Select
351
+ ``human-microbial-content-v1``, ``mouse-microbial-content-v1``, or
352
+ ``dog-microbial-content-v1`` for a species-aware learned self bundle.
353
+ Explicit category arguments remain available for backward compatibility
354
+ and are labeled ``custom-unversioned``; they cannot be mixed with a named
355
+ policy.
356
+
341
357
  ``exact_self_hits`` may be supplied by a caller that has searched a
342
358
  pinned host reference proteome. Those exact matches are marked explicitly
343
359
  and override the learned summary (``self_like=1`` and
@@ -348,6 +364,27 @@ def predict_peptide_content(
348
364
 
349
365
  from .model_manager import DEFAULT_PEPTIDE_CONTENT_MODEL
350
366
 
367
+ custom_categories = self_categories is not None or microbial_categories is not None
368
+ if score_policy is not None and custom_categories:
369
+ raise ValueError(
370
+ "score_policy cannot be combined with self_categories or microbial_categories"
371
+ )
372
+ resolved_policy = None
373
+ if not custom_categories:
374
+ resolved_policy = get_score_policy(
375
+ score_policy or DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY
376
+ )
377
+ if resolved_policy.model_id != DEFAULT_PEPTIDE_CONTENT_MODEL:
378
+ raise ValueError(
379
+ f"Score policy {resolved_policy.policy_id!r} is for "
380
+ f"{resolved_policy.model_id!r}, not {DEFAULT_PEPTIDE_CONTENT_MODEL!r}"
381
+ )
382
+ else:
383
+ if self_categories is None:
384
+ self_categories = ("mammals",)
385
+ if microbial_categories is None:
386
+ microbial_categories = MICROBIAL_CATEGORIES
387
+
351
388
  if isinstance(peptides, str):
352
389
  peptides = [peptides]
353
390
  peptides = list(peptides)
@@ -372,24 +409,72 @@ def predict_peptide_content(
372
409
  )
373
410
 
374
411
  probabilities = np.asarray(scorer.predict_proba(peptides), dtype=float)
375
- summary = summarize_peptide_content(
376
- probabilities,
377
- categories,
378
- self_categories=self_categories,
379
- microbial_categories=microbial_categories,
380
- )
412
+ if resolved_policy is not None:
413
+ summary = apply_score_policy(
414
+ probabilities,
415
+ categories,
416
+ resolved_policy,
417
+ exact_self_hits=exact_self_hits,
418
+ )
419
+ microbial_like = summary["source_like"]
420
+ self_like = summary["self_like"]
421
+ microbial_foreign_like = summary["score"]
422
+ policy_definition = resolved_policy.to_dict()
423
+ else:
424
+ summary = summarize_peptide_content(
425
+ probabilities,
426
+ categories,
427
+ self_categories=self_categories,
428
+ microbial_categories=microbial_categories,
429
+ )
430
+ microbial_like = summary["microbial_like"]
431
+ self_like = summary["self_like"]
432
+ microbial_foreign_like = summary["microbial_foreign_like"]
433
+ policy_definition = {
434
+ "schema_version": None,
435
+ "policy_id": "custom-unversioned",
436
+ "model_id": DEFAULT_PEPTIDE_CONTENT_MODEL,
437
+ "host_taxon_id": None,
438
+ "host_name": "Unspecified custom host",
439
+ "source_categories": list(microbial_categories),
440
+ "self_categories": list(self_categories),
441
+ "category_combiner": "max",
442
+ "formula": "source_times_one_minus_self",
443
+ "output_name": "microbial_foreign_like",
444
+ "exact_self_override": True,
445
+ "overlap_handling": (
446
+ "Independent multi-label outputs may overlap; max selects the strongest "
447
+ "source and self heads, and an exact supplied self hit overrides the score."
448
+ ),
449
+ "direction": (
450
+ "Higher means more source-like and less self-like under the model; "
451
+ "not a biological probability."
452
+ ),
453
+ "interpretation": "Unversioned caller-selected sequence-content contrast.",
454
+ "content_validation": "Not established for this custom category selection.",
455
+ "immune_response_validation": (
456
+ "No independently confirmed incremental T-cell-response benefit."
457
+ ),
458
+ }
381
459
  frame = pd.DataFrame(probabilities, columns=list(categories))
382
460
  frame.insert(0, "peptide", peptides)
383
- frame["microbial_like"] = summary["microbial_like"]
384
- frame["self_like"] = summary["self_like"]
385
- frame["microbial_foreign_like"] = summary["microbial_foreign_like"]
386
- if exact_self_hits is not None:
461
+ frame["microbial_like"] = microbial_like
462
+ frame["self_like"] = self_like
463
+ frame["microbial_foreign_like"] = microbial_foreign_like
464
+ if resolved_policy is not None and "exact_self_hit" in summary:
465
+ frame["exact_self_hit"] = summary["exact_self_hit"]
466
+ elif exact_self_hits is not None:
387
467
  exact = np.asarray(list(exact_self_hits), dtype=bool)
388
468
  if len(exact) != len(peptides):
389
469
  raise ValueError("exact_self_hits must have one value per peptide")
390
470
  frame["exact_self_hit"] = exact
391
471
  frame.loc[exact, "self_like"] = 1.0
392
472
  frame.loc[exact, "microbial_foreign_like"] = 0.0
473
+ frame.attrs.update(
474
+ score_policy=policy_definition["policy_id"],
475
+ score_policy_definition=policy_definition,
476
+ host_taxon_id=policy_definition["host_taxon_id"],
477
+ )
393
478
  return frame
394
479
 
395
480
 
@@ -6,14 +6,10 @@ from collections.abc import Sequence
6
6
 
7
7
  import numpy as np
8
8
 
9
+ from .score_policies import MICROBIAL_CONTENT_CATEGORIES
9
10
 
10
- MICROBIAL_CATEGORIES = (
11
- "viruses",
12
- "bacteria",
13
- "archaea",
14
- "fungi",
15
- "protists",
16
- )
11
+
12
+ MICROBIAL_CATEGORIES = MICROBIAL_CONTENT_CATEGORIES
17
13
 
18
14
 
19
15
  def summarize_peptide_content(
@@ -11,10 +11,14 @@ import numpy as np
11
11
  import pandas as pd
12
12
 
13
13
  from .scorers.mlp import MLPScorer
14
+ from .score_policies import (
15
+ DEFAULT_SCORE_POLICY,
16
+ apply_score_policy,
17
+ get_score_policy,
18
+ )
14
19
 
15
20
 
16
21
  DEFAULT_PRETRAINED_MODEL = "swissprot-categories-v1"
17
- DEFAULT_SCORE_POLICY = "human-self-complement-v1"
18
22
  MODEL_DIRECTORY = Path(__file__).parent / "pretrained" / "swissprot-categories"
19
23
  MANIFEST_SHA256 = "716e931ecb88ab6f042e01c886ac4e929bccf1c8d8c762e3f20ee0b9623fd5f9"
20
24
  CANONICAL_RESIDUES = frozenset("ACDEFGHIKLMNPQRSTVWY")
@@ -68,10 +72,16 @@ class PretrainedModel:
68
72
 
69
73
  def __init__(self, model=DEFAULT_PRETRAINED_MODEL, *, model_dir=None,
70
74
  score_policy=DEFAULT_SCORE_POLICY, host_taxon_id=9606):
71
- if score_policy != DEFAULT_SCORE_POLICY:
72
- raise ValueError(f"Unsupported score policy: {score_policy!r}")
73
- if type(host_taxon_id) is not int or host_taxon_id != 9606:
74
- raise ValueError("Only human host_taxon_id=9606 is supported by this score policy")
75
+ policy = get_score_policy(score_policy)
76
+ if policy.model_id != model:
77
+ raise ValueError(
78
+ f"Score policy {policy.policy_id!r} is for {policy.model_id!r}, not {model!r}"
79
+ )
80
+ if type(host_taxon_id) is not int or host_taxon_id != policy.host_taxon_id:
81
+ raise ValueError(
82
+ f"Score policy {policy.policy_id!r} requires "
83
+ f"host_taxon_id={policy.host_taxon_id}"
84
+ )
75
85
  manifest = get_model_manifest(model, model_dir)
76
86
  directory = Path(model_dir) if model_dir is not None else MODEL_DIRECTORY
77
87
  expected = {"config.json", "model.pt", "metadata.json"}
@@ -96,8 +106,9 @@ class PretrainedModel:
96
106
  raise ValueError("Released model smoke prediction does not match its manifest")
97
107
  self._scorer = scorer
98
108
  self._manifest = copy.deepcopy(manifest)
99
- self._score_policy = score_policy
100
- self._host_taxon_id = 9606
109
+ self._policy = policy
110
+ self._score_policy = policy.policy_id
111
+ self._host_taxon_id = policy.host_taxon_id
101
112
  self._package_version = version("weirdo")
102
113
 
103
114
  @property
@@ -110,6 +121,11 @@ class PretrainedModel:
110
121
  """Versioned definition of the scalar score."""
111
122
  return self._score_policy
112
123
 
124
+ @property
125
+ def score_policy_definition(self):
126
+ """Return the complete JSON-compatible scoring contract."""
127
+ return self._policy.to_dict()
128
+
113
129
  @property
114
130
  def host_taxon_id(self):
115
131
  """NCBI taxonomy identifier of the supported reference host."""
@@ -178,6 +194,7 @@ class PretrainedModel:
178
194
  model_id=self._manifest["model_id"],
179
195
  artifact_id=self._manifest["artifact_id"],
180
196
  score_policy=self._score_policy,
197
+ score_policy_definition=self.score_policy_definition,
181
198
  host_taxon_id=self._host_taxon_id,
182
199
  )
183
200
  return frame
@@ -200,7 +217,12 @@ class PretrainedModel:
200
217
  retained so adapters need not repeat normalization or score logic.
201
218
  """
202
219
  frame = self.predict_categories(peptides, batch_size)
203
- frame["foreignness"] = 1.0 - frame["human"]
220
+ summary = apply_score_policy(
221
+ frame[self._manifest["categories"]].to_numpy(),
222
+ self._manifest["categories"],
223
+ self._policy,
224
+ )
225
+ frame["foreignness"] = summary["score"]
204
226
  return frame
205
227
 
206
228
  def score(self, peptides, batch_size=1024):
@@ -0,0 +1,257 @@
1
+ """Versioned, inspectable definitions for category-derived scores."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from typing import Optional, Sequence, Union
7
+
8
+ import numpy as np
9
+
10
+
11
+ MICROBIAL_CONTENT_CATEGORIES = (
12
+ "viruses",
13
+ "bacteria",
14
+ "archaea",
15
+ "fungi",
16
+ "protists",
17
+ )
18
+ DEFAULT_SCORE_POLICY = "human-self-complement-v1"
19
+ DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY = "mammal-microbial-content-v1"
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class ScorePolicy:
24
+ """Complete versioned definition of a scalar category-derived score.
25
+
26
+ A policy describes interpretation and mechanics; it does not make a score
27
+ an immune-response probability. Category outputs remain independent and a
28
+ peptide may be high in both the source and self groups.
29
+ """
30
+
31
+ policy_id: str
32
+ model_id: str
33
+ host_taxon_id: int
34
+ host_name: str
35
+ source_categories: tuple[str, ...]
36
+ self_categories: tuple[str, ...]
37
+ category_combiner: str
38
+ formula: str
39
+ output_name: str
40
+ exact_self_override: bool
41
+ overlap_handling: str
42
+ direction: str
43
+ interpretation: str
44
+ content_validation: str
45
+ immune_response_validation: str
46
+ schema_version: int = 1
47
+
48
+ def __post_init__(self) -> None:
49
+ object.__setattr__(self, "source_categories", tuple(self.source_categories))
50
+ object.__setattr__(self, "self_categories", tuple(self.self_categories))
51
+ if self.schema_version != 1:
52
+ raise ValueError("Unsupported score-policy schema version")
53
+ if not self.policy_id or not self.model_id or not self.output_name:
54
+ raise ValueError("Policy, model, and output names cannot be empty")
55
+ if (
56
+ isinstance(self.host_taxon_id, bool)
57
+ or not isinstance(self.host_taxon_id, int)
58
+ or self.host_taxon_id < 1
59
+ ):
60
+ raise ValueError("host_taxon_id must be a positive integer")
61
+ if self.category_combiner != "max":
62
+ raise ValueError("Version 1 score policies support only the max combiner")
63
+ if self.formula not in {"one_minus_self", "source_times_one_minus_self"}:
64
+ raise ValueError(f"Unsupported score formula: {self.formula!r}")
65
+ if not self.self_categories or len(set(self.self_categories)) != len(self.self_categories):
66
+ raise ValueError("self_categories must be non-empty and unique")
67
+ if len(set(self.source_categories)) != len(self.source_categories):
68
+ raise ValueError("source_categories must be unique")
69
+ if self.formula == "source_times_one_minus_self" and not self.source_categories:
70
+ raise ValueError("source_times_one_minus_self requires source categories")
71
+ if set(self.source_categories) & set(self.self_categories):
72
+ raise ValueError("source and self categories must not overlap by name")
73
+
74
+ def to_dict(self) -> dict:
75
+ """Return a JSON-compatible definition for provenance and caching."""
76
+ return {
77
+ "schema_version": self.schema_version,
78
+ "policy_id": self.policy_id,
79
+ "model_id": self.model_id,
80
+ "host_taxon_id": self.host_taxon_id,
81
+ "host_name": self.host_name,
82
+ "source_categories": list(self.source_categories),
83
+ "self_categories": list(self.self_categories),
84
+ "category_combiner": self.category_combiner,
85
+ "formula": self.formula,
86
+ "output_name": self.output_name,
87
+ "exact_self_override": self.exact_self_override,
88
+ "overlap_handling": self.overlap_handling,
89
+ "direction": self.direction,
90
+ "interpretation": self.interpretation,
91
+ "content_validation": self.content_validation,
92
+ "immune_response_validation": self.immune_response_validation,
93
+ }
94
+
95
+
96
+ _INDEPENDENT_OVERLAP = (
97
+ "Independent multi-label category outputs may overlap. Max selects the "
98
+ "strongest source and self heads; self does not erase a source label."
99
+ )
100
+ _CONTENT_VALIDATION = (
101
+ "Held-out protein-family taxonomy/content evaluation is recorded with the model."
102
+ )
103
+ _NO_IMMUNE_VALIDATION = (
104
+ "No independently confirmed incremental T-cell-response benefit beyond MHC baselines."
105
+ )
106
+
107
+
108
+ def _content_policy(
109
+ policy_id: str,
110
+ host_taxon_id: int,
111
+ host_name: str,
112
+ self_categories: tuple[str, ...],
113
+ ) -> ScorePolicy:
114
+ return ScorePolicy(
115
+ policy_id=policy_id,
116
+ model_id="peptide-content-v1",
117
+ host_taxon_id=host_taxon_id,
118
+ host_name=host_name,
119
+ source_categories=MICROBIAL_CONTENT_CATEGORIES,
120
+ self_categories=self_categories,
121
+ category_combiner="max",
122
+ formula="source_times_one_minus_self",
123
+ output_name="microbial_foreign_like",
124
+ exact_self_override=True,
125
+ overlap_handling=(
126
+ f"{_INDEPENDENT_OVERLAP} An exact selected-host proteome hit "
127
+ "overrides the learned score to zero when supplied."
128
+ ),
129
+ direction=(
130
+ "Higher means more microbial-like and less self-like under the model; "
131
+ "the bounded 0--1 value is a ranking score, not a biological probability."
132
+ ),
133
+ interpretation=(
134
+ "Descriptive sequence-content contrast under the balanced training distribution."
135
+ ),
136
+ content_validation=_CONTENT_VALIDATION,
137
+ immune_response_validation=_NO_IMMUNE_VALIDATION,
138
+ )
139
+
140
+
141
+ _POLICIES = {
142
+ DEFAULT_SCORE_POLICY: ScorePolicy(
143
+ policy_id=DEFAULT_SCORE_POLICY,
144
+ model_id="swissprot-categories-v1",
145
+ host_taxon_id=9606,
146
+ host_name="Homo sapiens",
147
+ source_categories=(),
148
+ self_categories=("human",),
149
+ category_combiner="max",
150
+ formula="one_minus_self",
151
+ output_name="foreignness",
152
+ exact_self_override=False,
153
+ overlap_handling=(
154
+ "The score uses only the independent human head; other category "
155
+ "memberships are returned separately and do not change it."
156
+ ),
157
+ direction=(
158
+ "Higher means less human-like under the model; the bounded 0--1 "
159
+ "value is not a biological or immune-response probability."
160
+ ),
161
+ interpretation="Complement of the SwissProt human-category output.",
162
+ content_validation=(
163
+ "Human-category discrimination and calibration were measured on held-out "
164
+ "protein-mnemonic families."
165
+ ),
166
+ immune_response_validation=_NO_IMMUNE_VALIDATION,
167
+ ),
168
+ DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY: _content_policy(
169
+ DEFAULT_PEPTIDE_CONTENT_SCORE_POLICY,
170
+ 40674,
171
+ "Mammalia (generic clade; not species-specific)",
172
+ ("mammals",),
173
+ ),
174
+ "human-microbial-content-v1": _content_policy(
175
+ "human-microbial-content-v1", 9606, "Homo sapiens", ("mammals", "human")
176
+ ),
177
+ "mouse-microbial-content-v1": _content_policy(
178
+ "mouse-microbial-content-v1", 10090, "Mus musculus", ("mammals", "mouse")
179
+ ),
180
+ "dog-microbial-content-v1": _content_policy(
181
+ "dog-microbial-content-v1", 9615, "Canis lupus familiaris", ("mammals", "dog")
182
+ ),
183
+ }
184
+
185
+
186
+ def get_score_policy(policy: Union[str, ScorePolicy]) -> ScorePolicy:
187
+ """Resolve a built-in policy name or validate a supplied policy object."""
188
+ if isinstance(policy, ScorePolicy):
189
+ return policy
190
+ if not isinstance(policy, str) or policy not in _POLICIES:
191
+ available = ", ".join(sorted(_POLICIES))
192
+ raise ValueError(f"Unknown score policy {policy!r}; available: {available}")
193
+ return _POLICIES[policy]
194
+
195
+
196
+ def list_score_policies(model_id: Optional[str] = None) -> list[dict]:
197
+ """Return JSON-compatible definitions, optionally filtered by model ID."""
198
+ policies = sorted(_POLICIES.values(), key=lambda item: item.policy_id)
199
+ if model_id is not None:
200
+ policies = [policy for policy in policies if policy.model_id == model_id]
201
+ return [policy.to_dict() for policy in policies]
202
+
203
+
204
+ def apply_score_policy(
205
+ probabilities: np.ndarray,
206
+ categories: Sequence[str],
207
+ policy: Union[str, ScorePolicy],
208
+ *,
209
+ exact_self_hits: Optional[Sequence[bool]] = None,
210
+ ) -> dict[str, np.ndarray]:
211
+ """Apply a policy to independent category probabilities."""
212
+ resolved = get_score_policy(policy)
213
+ values = np.asarray(probabilities, dtype=float)
214
+ if values.ndim == 1:
215
+ values = values[None, :]
216
+ category_names = tuple(categories)
217
+ if values.ndim != 2 or values.shape[1] != len(category_names):
218
+ raise ValueError("probability columns must match the one-dimensional categories")
219
+ if len(set(category_names)) != len(category_names):
220
+ raise ValueError("categories must be unique")
221
+ if not np.isfinite(values).all() or ((values < 0) | (values > 1)).any():
222
+ raise ValueError("probabilities must be finite values in [0, 1]")
223
+
224
+ index = {name: position for position, name in enumerate(category_names)}
225
+
226
+ def maximum(names: Sequence[str], label: str) -> np.ndarray:
227
+ missing = [name for name in names if name not in index]
228
+ if missing:
229
+ raise ValueError(f"Policy {resolved.policy_id!r} needs missing {label}: {missing}")
230
+ return values[:, [index[name] for name in names]].max(axis=1)
231
+
232
+ self_like = maximum(resolved.self_categories, "self categories")
233
+ result = {"self_like": self_like}
234
+ if resolved.formula == "one_minus_self":
235
+ score = 1.0 - self_like
236
+ else:
237
+ source_like = maximum(resolved.source_categories, "source categories")
238
+ result["source_like"] = source_like
239
+ score = source_like * (1.0 - self_like)
240
+
241
+ if exact_self_hits is not None:
242
+ if not resolved.exact_self_override:
243
+ raise ValueError(
244
+ f"Policy {resolved.policy_id!r} does not define an exact-self override"
245
+ )
246
+ exact = np.asarray(list(exact_self_hits), dtype=bool)
247
+ if exact.ndim != 1 or len(exact) != len(values):
248
+ raise ValueError("exact_self_hits must have one value per peptide")
249
+ self_like = self_like.copy()
250
+ score = score.copy()
251
+ self_like[exact] = 1.0
252
+ score[exact] = 0.0
253
+ result["self_like"] = self_like
254
+ result["exact_self_hit"] = exact
255
+
256
+ result["score"] = score
257
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weirdo
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Metrics of immunological foreignness for candidate T-cell epitopes
5
5
  Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
6
  Project-URL: Homepage, https://github.com/pirl-unc/weirdo
@@ -71,7 +71,7 @@ from weirdo import predict_peptide_content
71
71
 
72
72
  result = predict_peptide_content(
73
73
  ["SIINFEKL", "GILGFVFTL"],
74
- self_categories=("mammals", "human"),
74
+ score_policy="human-microbial-content-v1",
75
75
  )
76
76
  ```
77
77
 
@@ -81,6 +81,8 @@ The score is useful for ranking peptide content, but it did not add a validated
81
81
  T-cell immunogenicity signal beyond MHC presentation or affinity. See
82
82
  [docs/peptide-content.md](docs/peptide-content.md) for the split, model comparison,
83
83
  host-specific guidance, and evaluation.
84
+ [docs/score-policies.md](docs/score-policies.md) defines the versioned human,
85
+ mouse, dog, generic-mammal, and stable human-complement scoring contracts.
84
86
 
85
87
  ## Quick Start
86
88
 
@@ -49,6 +49,7 @@ test/test_reference_proteome_data.py
49
49
  test/test_reference_proteome_manifest.py
50
50
  test/test_reference_proteomes.py
51
51
  test/test_released_model.py
52
+ test/test_score_policies.py
52
53
  test/test_scorers.py
53
54
  test/test_swissprot_reference.py
54
55
  test/test_tcell_stratified_eval.py
@@ -76,6 +77,7 @@ weirdo/reduced_alphabet.py
76
77
  weirdo/reference_proteomes.py
77
78
  weirdo/released.py
78
79
  weirdo/residue_contact_energies.py
80
+ weirdo/score_policies.py
79
81
  weirdo/static_data.py
80
82
  weirdo/uniprot.py
81
83
  weirdo.egg-info/PKG-INFO
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes