weirdo 2.1.4__tar.gz → 2.3.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.
- weirdo-2.3.0/MANIFEST.in +3 -0
- {weirdo-2.1.4/weirdo.egg-info → weirdo-2.3.0}/PKG-INFO +107 -34
- weirdo-2.3.0/README.md +355 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/pyproject.toml +8 -2
- weirdo-2.3.0/requirements.txt +6 -0
- weirdo-2.3.0/scripts/analyze_taxonomy_buckets.py +210 -0
- weirdo-2.3.0/scripts/audit_foreignness_definitions.py +178 -0
- weirdo-2.3.0/scripts/category_data.py +346 -0
- weirdo-2.3.0/scripts/category_eval.py +291 -0
- weirdo-2.3.0/scripts/category_headroom.py +231 -0
- weirdo-2.3.0/scripts/check_released_model.py +36 -0
- weirdo-2.3.0/scripts/evaluate_improve_foreignness.py +817 -0
- weirdo-2.3.0/scripts/evaluate_peptide_content_immunogenicity.py +630 -0
- weirdo-2.3.0/scripts/evaluate_tcell_transfer.py +408 -0
- weirdo-2.3.0/scripts/peptide_content_data.py +452 -0
- weirdo-2.3.0/scripts/reference_proteome_data.py +409 -0
- weirdo-2.3.0/scripts/tcell_stratified_eval.py +862 -0
- weirdo-2.3.0/scripts/train_category_predictor.py +398 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/scripts/train_modal_long_run.py +0 -8
- weirdo-2.3.0/scripts/train_peptide_content_modal.py +892 -0
- weirdo-2.3.0/scripts/train_peptide_content_models.py +718 -0
- weirdo-2.3.0/scripts/viral_host_peptide_content_data.py +269 -0
- weirdo-2.3.0/test/test_analyze_taxonomy_buckets.py +38 -0
- weirdo-2.3.0/test/test_audit_foreignness_definitions.py +29 -0
- weirdo-2.3.0/test/test_bundled_models.py +187 -0
- weirdo-2.3.0/test/test_category_data.py +299 -0
- weirdo-2.3.0/test/test_category_eval.py +191 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_cli_logic.py +17 -2
- weirdo-2.3.0/test/test_data_manager.py +239 -0
- weirdo-2.3.0/test/test_evaluate_improve_foreignness.py +124 -0
- weirdo-2.3.0/test/test_evaluate_peptide_content_immunogenicity.py +99 -0
- weirdo-2.3.0/test/test_evaluate_tcell_transfer.py +81 -0
- weirdo-2.3.0/test/test_kmer_table.py +169 -0
- weirdo-2.3.0/test/test_mlp_sigmoid_head.py +370 -0
- weirdo-2.3.0/test/test_model_downloads.py +127 -0
- weirdo-2.3.0/test/test_peptide_content.py +37 -0
- weirdo-2.3.0/test/test_peptide_content_api.py +104 -0
- weirdo-2.3.0/test/test_peptide_content_data.py +66 -0
- weirdo-2.3.0/test/test_peptide_features.py +224 -0
- weirdo-2.3.0/test/test_pretrained_category_model.py +96 -0
- weirdo-2.3.0/test/test_reference_proteome_data.py +72 -0
- weirdo-2.3.0/test/test_reference_proteome_manifest.py +51 -0
- weirdo-2.3.0/test/test_reference_proteomes.py +121 -0
- weirdo-2.3.0/test/test_released_model.py +144 -0
- weirdo-2.3.0/test/test_tcell_stratified_eval.py +140 -0
- weirdo-2.3.0/test/test_train_category_predictor.py +135 -0
- weirdo-2.3.0/test/test_train_peptide_content_models.py +107 -0
- weirdo-2.3.0/test/test_uniprot.py +261 -0
- weirdo-2.3.0/test/test_viral_host_peptide_content_data.py +67 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/__init__.py +47 -1
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/api.py +159 -1
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/cli.py +198 -26
- weirdo-2.3.0/weirdo/data_manager.py +700 -0
- weirdo-2.3.0/weirdo/kmer_table.py +285 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/model_manager.py +79 -33
- weirdo-2.3.0/weirdo/peptide_content.py +72 -0
- weirdo-2.3.0/weirdo/pretrained/peptide-content-v1/config.json +22 -0
- weirdo-2.3.0/weirdo/pretrained/peptide-content-v1/evaluation.json +170 -0
- weirdo-2.3.0/weirdo/pretrained/peptide-content-v1/metadata.json +48 -0
- weirdo-2.3.0/weirdo/pretrained/peptide-content-v1/model.pt +0 -0
- weirdo-2.3.0/weirdo/pretrained/swissprot-categories/config.json +20 -0
- weirdo-2.3.0/weirdo/pretrained/swissprot-categories/manifest.json +104 -0
- weirdo-2.3.0/weirdo/pretrained/swissprot-categories/metadata.json +1424 -0
- weirdo-2.3.0/weirdo/pretrained/swissprot-categories/model.pt +0 -0
- weirdo-2.3.0/weirdo/reference_proteome_manifests/reference-proteomes-v1.yaml +744 -0
- weirdo-2.3.0/weirdo/reference_proteomes.py +476 -0
- weirdo-2.3.0/weirdo/released.py +251 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/mlp.py +780 -859
- weirdo-2.3.0/weirdo/scorers/peptide_features.py +871 -0
- weirdo-2.3.0/weirdo/uniprot.py +397 -0
- {weirdo-2.1.4 → weirdo-2.3.0/weirdo.egg-info}/PKG-INFO +107 -34
- weirdo-2.3.0/weirdo.egg-info/SOURCES.txt +114 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo.egg-info/requires.txt +4 -2
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo.egg-info/top_level.txt +0 -1
- weirdo-2.1.4/MANIFEST.in +0 -1
- weirdo-2.1.4/README.md +0 -290
- weirdo-2.1.4/requirements.txt +0 -4
- weirdo-2.1.4/test/test_data_manager.py +0 -39
- weirdo-2.1.4/test/test_model_downloads.py +0 -96
- weirdo-2.1.4/weirdo/data_manager.py +0 -489
- weirdo-2.1.4/weirdo.egg-info/SOURCES.txt +0 -59
- {weirdo-2.1.4 → weirdo-2.3.0}/LICENSE +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/setup.cfg +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_amino_acids.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_blosum.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_hamming.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_logic_consistency.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_mlp_scorers.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_ngram.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_pmbec.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_scorers.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/test/test_swissprot_reference.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/amino_acid.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/amino_acid_alphabet.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/amino_acid_properties.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/blosum.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/chou_fasman.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/common.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/distances.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/BLOSUM30 +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/BLOSUM50 +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/BLOSUM62 +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/__init__.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/amino_acid_properties.txt +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/helix_vs_coil.txt +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/helix_vs_strand.txt +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/pmbec.mat +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/matrices/strand_vs_coil.txt +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/peptide_vectorizer.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/pmbec.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/reduced_alphabet.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/residue_contact_energies.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/__init__.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/base.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/config.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/reference.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/registry.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/similarity.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/swissprot.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/scorers/trainable.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo/static_data.py +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo.egg-info/dependency_links.txt +0 -0
- {weirdo-2.1.4 → weirdo-2.3.0}/weirdo.egg-info/entry_points.txt +0 -0
weirdo-2.3.0/MANIFEST.in
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weirdo
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.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
|
|
@@ -11,13 +11,21 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Intended Audience :: Science/Research
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
20
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
15
|
-
Requires-Python: >=3.
|
|
21
|
+
Requires-Python: >=3.10
|
|
16
22
|
Description-Content-Type: text/markdown
|
|
17
23
|
License-File: LICENSE
|
|
18
24
|
Requires-Dist: numpy<3.0.0,>=2.0.0
|
|
19
|
-
Requires-Dist: pandas>=
|
|
20
|
-
Requires-Dist: scikit-learn<2.0.0,>=1.
|
|
25
|
+
Requires-Dist: pandas>=2.2.0
|
|
26
|
+
Requires-Dist: scikit-learn<2.0.0,>=1.7.0
|
|
27
|
+
Requires-Dist: statsmodels>=0.14.0
|
|
28
|
+
Requires-Dist: datacache>=1.24.0
|
|
21
29
|
Provides-Extra: dev
|
|
22
30
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
23
31
|
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
@@ -41,17 +49,64 @@ Dynamic: license-file
|
|
|
41
49
|
|
|
42
50
|
**W**idely **E**stimated **I**mmunological **R**ecognition and **D**etection of **O**utliers
|
|
43
51
|
|
|
44
|
-
A Python library for
|
|
52
|
+
A Python library that predicts, for any peptide, the probability that it occurs in proteins of each of ten species categories, and summarizes them as a pathogen-versus-mammalian foreignness score.
|
|
45
53
|
|
|
46
54
|
## Overview
|
|
47
55
|
|
|
48
|
-
WEIRDO trains a multi-layer perceptron (MLP) on k-mer presence data from SwissProt to predict organism category membership
|
|
56
|
+
WEIRDO trains a multi-layer perceptron (MLP) on k-mer presence data from SwissProt to predict organism category membership, and ships a trained model, `swissprot-categories`. Given any peptide of 8 residues or more, it outputs:
|
|
49
57
|
|
|
50
|
-
- **Category probabilities**:
|
|
51
|
-
- **
|
|
58
|
+
- **Category probabilities**: one independent sigmoid output for each of ten categories (archaea, bacteria, fungi, human, invertebrates, mammals, plants, rodents, vertebrates, viruses), the probability that the peptide occurs in SwissProt proteins of that category. The outputs are close to calibrated but only weakly informative: on protein families not seen in training the mean AUC is about 0.6.
|
|
59
|
+
- **Pathogen and self values**: the largest probability among the pathogen categories (bacteria, viruses) and among the mammalian categories (human, rodents, mammals).
|
|
60
|
+
- **Foreignness score**: `max(pathogen) / (max(pathogen) + max(self))`. The combination is a parameter: `combine="sum"` compares the summed probabilities instead (the expected number of categories in each group that contain the peptide), and `combine` also accepts your own function. Five categories (archaea, fungi, invertebrates, plants, vertebrates) are in neither default group; pass `pathogen_categories` / `self_categories` to change the groups.
|
|
61
|
+
|
|
62
|
+
[docs/category-predictor.md](docs/category-predictor.md) explains what the numbers mean, how the model was evaluated and what its limits are. A typical peptide scores about 0.81 on the foreignness scale (peptides found only in mammalian proteins: median 0.76; only in bacteria/viruses: 0.84), so compare a score with those reference distributions rather than with 0.5. Nothing here has been shown to predict T-cell immunogenicity. The bundled weights derive from UniProtKB/Swiss-Prot sequences (CC BY 4.0).
|
|
63
|
+
|
|
64
|
+
For complete MHC-length peptides, the experimental `peptide-content-v1` model is
|
|
65
|
+
the better entry point. It was trained directly on variable-length 8--15mers and
|
|
66
|
+
uses independent heads for viruses, bacteria, archaea, fungi, plants, protists,
|
|
67
|
+
invertebrates, fish, non-mammalian tetrapods, mammals, human, mouse, and dog:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from weirdo import predict_peptide_content
|
|
71
|
+
|
|
72
|
+
result = predict_peptide_content(
|
|
73
|
+
["SIINFEKL", "GILGFVFTL"],
|
|
74
|
+
self_categories=("mammals", "human"),
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Its primary summary is
|
|
79
|
+
`microbial_foreign_like = max(microbial heads) * (1 - max(selected self heads))`.
|
|
80
|
+
The score is useful for ranking peptide content, but it did not add a validated
|
|
81
|
+
T-cell immunogenicity signal beyond MHC presentation or affinity. See
|
|
82
|
+
[docs/peptide-content.md](docs/peptide-content.md) for the split, model comparison,
|
|
83
|
+
host-specific guidance, and evaluation.
|
|
52
84
|
|
|
53
85
|
## Quick Start
|
|
54
86
|
|
|
87
|
+
```python
|
|
88
|
+
from weirdo import predict_categories
|
|
89
|
+
|
|
90
|
+
predict_categories(['SIINFEKL', 'NLVPMVATV', 'GILGFVFTL'])
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
peptide archaea bacteria fungi human invertebrates mammals plants rodents vertebrates viruses pathogen_max self_max foreignness
|
|
95
|
+
SIINFEKL 0.077 0.389 0.141 0.044 0.158 0.025 0.102 0.048 0.026 0.057 0.389 0.048 0.891
|
|
96
|
+
NLVPMVATV 0.026 0.461 0.100 0.092 0.069 0.047 0.116 0.106 0.040 0.027 0.461 0.106 0.813
|
|
97
|
+
GILGFVFTL 0.045 0.435 0.118 0.083 0.076 0.041 0.112 0.093 0.038 0.031 0.435 0.093 0.823
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`predict_categories(peptides, combine="sum")` gives `pathogen_sum` and `self_sum` columns instead.
|
|
101
|
+
|
|
102
|
+
Individual outputs stay close to the base rates (the two viral epitopes get a virus probability of about 0.03); see [docs/category-predictor.md](docs/category-predictor.md).
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
weirdo score SIINFEKL NLVPMVATV GILGFVFTL
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Training your own model
|
|
109
|
+
|
|
55
110
|
```python
|
|
56
111
|
from weirdo.scorers import SwissProtReference, MLPScorer
|
|
57
112
|
|
|
@@ -71,22 +126,16 @@ peptides, labels = ref.get_training_data(
|
|
|
71
126
|
max_samples=200000 # Optional: sample for faster training
|
|
72
127
|
)
|
|
73
128
|
|
|
74
|
-
# Train the MLP
|
|
129
|
+
# Train the MLP: binary multi-label targets use one sigmoid per category and
|
|
130
|
+
# binary cross-entropy, so predict_proba returns probabilities.
|
|
75
131
|
scorer = MLPScorer(k=8, hidden_layer_sizes=(256, 128, 64))
|
|
76
132
|
scorer.train(peptides, labels, target_categories=categories, epochs=200)
|
|
77
133
|
|
|
78
134
|
# Score new peptides (any length)
|
|
79
135
|
df = scorer.predict_dataframe(['MTMDKSEL', 'SIINFEKL', 'NLVPMVATV'])
|
|
80
|
-
print(df)
|
|
81
136
|
```
|
|
82
137
|
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
peptide human viruses bacteria mammals ... foreignness
|
|
86
|
-
MTMDKSEL 0.82 0.12 0.08 0.79 ... 0.127
|
|
87
|
-
SIINFEKL 0.15 0.73 0.21 0.18 ... 0.802
|
|
88
|
-
NLVPMVATV 0.31 0.68 0.15 0.35 ... 0.660
|
|
89
|
-
```
|
|
138
|
+
Early stopping needs validation peptides that are not near-duplicates of the training ones (overlapping 8-mers of one protein share 7 residues); pass `val_peptides` / `val_labels` built from different protein families. `scripts/train_category_predictor.py` does this and was used to train the bundled model.
|
|
90
139
|
|
|
91
140
|
## Installation
|
|
92
141
|
|
|
@@ -94,14 +143,29 @@ print(df)
|
|
|
94
143
|
pip install weirdo
|
|
95
144
|
```
|
|
96
145
|
|
|
97
|
-
|
|
146
|
+
The bundled model needs no extra data. To train your own model or use the SwissProt reference
|
|
147
|
+
scorers, build the reference data from UniProt:
|
|
98
148
|
```bash
|
|
99
|
-
weirdo data download
|
|
149
|
+
weirdo data download swissprot-sequences # ~670 MB from UniProt, builds a ~230 MB table
|
|
150
|
+
weirdo data download # also builds the 8-mer table (several GB, some minutes)
|
|
151
|
+
weirdo data reference-proteome dog # complete dog proteome for exact self lookup
|
|
152
|
+
weirdo data reference-proteome cattle # Bos taurus / UP000009136
|
|
153
|
+
weirdo data reference-proteome --proteome UP000009136 # any UniProt reference proteome
|
|
154
|
+
weirdo data reference-proteome --manifest --dry-run # inspect the 544-proteome frozen corpus
|
|
155
|
+
weirdo data reference-proteome --manifest --group mammals # resumably fetch its 32 mammals
|
|
100
156
|
```
|
|
157
|
+
The files are fetched with [datacache](https://github.com/openvax/datacache) from UniProt's FTP site
|
|
158
|
+
(`WEIRDO_UNIPROT_URL` selects a mirror), checked against the sizes and MD5s UniProt lists and kept
|
|
159
|
+
in `~/.weirdo/downloads/uniprot/release-<version>/`, so they are downloaded once per UniProt release.
|
|
160
|
+
Complete host references (`human`, `dog`, `cat`, `mouse`, `rat`, and `cattle`) are separately fetched as pinned
|
|
161
|
+
UniProt reference-proteome FASTAs, with a local SHA-256/content summary.
|
|
162
|
+
The same command also handles frozen multi-proteome selections. `--manifest`
|
|
163
|
+
downloads every selected FASTA through datacache, skips verified local files on
|
|
164
|
+
re-run, and supports `--group mammals`, `--group viruses`, or a specific leaf.
|
|
101
165
|
|
|
102
166
|
## Training Data
|
|
103
167
|
|
|
104
|
-
WEIRDO
|
|
168
|
+
WEIRDO builds its 8-mer data from UniProtKB/Swiss-Prot (~100M unique k-mers) with `weirdo data download`:
|
|
105
169
|
|
|
106
170
|
| Category | Description |
|
|
107
171
|
|----------|-------------|
|
|
@@ -188,7 +252,7 @@ scorer.train(
|
|
|
188
252
|
### Prediction
|
|
189
253
|
|
|
190
254
|
```python
|
|
191
|
-
# Category probabilities
|
|
255
|
+
# Category probabilities, one independent sigmoid per category
|
|
192
256
|
probs = scorer.predict_proba(['MTMDKSEL'])
|
|
193
257
|
# Shape: (1, n_categories)
|
|
194
258
|
|
|
@@ -196,9 +260,9 @@ probs = scorer.predict_proba(['MTMDKSEL'])
|
|
|
196
260
|
foreign = scorer.foreignness(
|
|
197
261
|
['MTMDKSEL'],
|
|
198
262
|
pathogen_categories=['bacteria', 'viruses'],
|
|
199
|
-
self_categories=['human', 'mammals', 'rodents']
|
|
263
|
+
self_categories=['human', 'mammals', 'rodents'],
|
|
264
|
+
combine='max', # default: max(pathogens) / (max(pathogens) + max(self)); 'sum' adds the probabilities
|
|
200
265
|
)
|
|
201
|
-
# Returns: max(pathogens) / (max(pathogens) + max(self))
|
|
202
266
|
|
|
203
267
|
# Full DataFrame output (handles variable-length peptides)
|
|
204
268
|
df = scorer.predict_dataframe(['MTMDKSEL', 'SIINFEKL', 'NLVPMVATV'])
|
|
@@ -236,7 +300,9 @@ scorer = load_model('my-foreignness-model')
|
|
|
236
300
|
|
|
237
301
|
```bash
|
|
238
302
|
# Data management
|
|
239
|
-
weirdo data download # Download SwissProt reference
|
|
303
|
+
weirdo data download # Download SwissProt from UniProt and build the reference data
|
|
304
|
+
weirdo data reference-proteome dog # Complete host proteome for exact self lookup
|
|
305
|
+
weirdo data reference-proteome cattle # Bos taurus; `cow` is also accepted
|
|
240
306
|
weirdo data list # Show data status
|
|
241
307
|
|
|
242
308
|
# Model management
|
|
@@ -248,7 +314,9 @@ weirdo models download NAME # Download pretrained weights by name
|
|
|
248
314
|
weirdo models download --url https://.../model.tar.gz --save-as my-model
|
|
249
315
|
|
|
250
316
|
# Scoring
|
|
251
|
-
weirdo score
|
|
317
|
+
weirdo score MTMDKSEL SIINFEKL # bundled swissprot-categories model
|
|
318
|
+
weirdo score --combine sum MTMDKSEL # compare summed instead of maximal probabilities
|
|
319
|
+
weirdo score --model my-model MTMDKSEL # a model you trained
|
|
252
320
|
```
|
|
253
321
|
|
|
254
322
|
## Long-Run Training on Modal
|
|
@@ -257,8 +325,8 @@ Use `scripts/train_modal_long_run.py` to run long remote training and export
|
|
|
257
325
|
weights as a `.tar.gz` archive:
|
|
258
326
|
|
|
259
327
|
```bash
|
|
260
|
-
# One-time setup: seed
|
|
261
|
-
modal volume put weirdo-data-cache
|
|
328
|
+
# One-time setup: seed the SwissProt CSV (built by `weirdo data download`) into the Modal data volume
|
|
329
|
+
modal volume put weirdo-data-cache ~/.weirdo/downloads/swissprot-8mers.csv downloads/swissprot-8mers.csv --force
|
|
262
330
|
```
|
|
263
331
|
|
|
264
332
|
```bash
|
|
@@ -299,14 +367,19 @@ new package version.
|
|
|
299
367
|
```
|
|
300
368
|
weirdo/
|
|
301
369
|
├── scorers/
|
|
302
|
-
│ ├── mlp.py
|
|
303
|
-
│ ├──
|
|
304
|
-
│ ├──
|
|
305
|
-
│ ├──
|
|
306
|
-
│
|
|
307
|
-
|
|
370
|
+
│ ├── mlp.py # MLPScorer (sigmoid heads, foreignness)
|
|
371
|
+
│ ├── peptide_features.py # The 592 peptide features (vectorised)
|
|
372
|
+
│ ├── swissprot.py # SwissProtReference (training data)
|
|
373
|
+
│ ├── config.py # Presets and configuration
|
|
374
|
+
│ ├── registry.py # Scorer registry
|
|
375
|
+
│ └── trainable.py # TrainableScorer base class
|
|
376
|
+
├── pretrained/ # Models that ship in the package (weights up to 5 MB)
|
|
377
|
+
├── uniprot.py # Download SwissProt from UniProt (datacache), build sequences
|
|
378
|
+
├── kmer_table.py # Build the SwissProt k-mer reference table
|
|
379
|
+
├── data_manager.py # ~/.weirdo reference data
|
|
380
|
+
├── model_manager.py # Save/load trained models
|
|
308
381
|
├── amino_acid_properties.py # 12 AA property dictionaries
|
|
309
|
-
└── api.py
|
|
382
|
+
└── api.py # High-level functions
|
|
310
383
|
```
|
|
311
384
|
|
|
312
385
|
## Citation
|
weirdo-2.3.0/README.md
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
[](https://github.com/pirl-unc/weirdo/actions/workflows/tests.yml)
|
|
2
|
+
[](https://github.com/pirl-unc/weirdo/actions/workflows/docs.yml)
|
|
3
|
+
[](https://pypi.python.org/pypi/weirdo/)
|
|
4
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
|
+
|
|
6
|
+
# WEIRDO
|
|
7
|
+
|
|
8
|
+
**W**idely **E**stimated **I**mmunological **R**ecognition and **D**etection of **O**utliers
|
|
9
|
+
|
|
10
|
+
A Python library that predicts, for any peptide, the probability that it occurs in proteins of each of ten species categories, and summarizes them as a pathogen-versus-mammalian foreignness score.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
WEIRDO trains a multi-layer perceptron (MLP) on k-mer presence data from SwissProt to predict organism category membership, and ships a trained model, `swissprot-categories`. Given any peptide of 8 residues or more, it outputs:
|
|
15
|
+
|
|
16
|
+
- **Category probabilities**: one independent sigmoid output for each of ten categories (archaea, bacteria, fungi, human, invertebrates, mammals, plants, rodents, vertebrates, viruses), the probability that the peptide occurs in SwissProt proteins of that category. The outputs are close to calibrated but only weakly informative: on protein families not seen in training the mean AUC is about 0.6.
|
|
17
|
+
- **Pathogen and self values**: the largest probability among the pathogen categories (bacteria, viruses) and among the mammalian categories (human, rodents, mammals).
|
|
18
|
+
- **Foreignness score**: `max(pathogen) / (max(pathogen) + max(self))`. The combination is a parameter: `combine="sum"` compares the summed probabilities instead (the expected number of categories in each group that contain the peptide), and `combine` also accepts your own function. Five categories (archaea, fungi, invertebrates, plants, vertebrates) are in neither default group; pass `pathogen_categories` / `self_categories` to change the groups.
|
|
19
|
+
|
|
20
|
+
[docs/category-predictor.md](docs/category-predictor.md) explains what the numbers mean, how the model was evaluated and what its limits are. A typical peptide scores about 0.81 on the foreignness scale (peptides found only in mammalian proteins: median 0.76; only in bacteria/viruses: 0.84), so compare a score with those reference distributions rather than with 0.5. Nothing here has been shown to predict T-cell immunogenicity. The bundled weights derive from UniProtKB/Swiss-Prot sequences (CC BY 4.0).
|
|
21
|
+
|
|
22
|
+
For complete MHC-length peptides, the experimental `peptide-content-v1` model is
|
|
23
|
+
the better entry point. It was trained directly on variable-length 8--15mers and
|
|
24
|
+
uses independent heads for viruses, bacteria, archaea, fungi, plants, protists,
|
|
25
|
+
invertebrates, fish, non-mammalian tetrapods, mammals, human, mouse, and dog:
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from weirdo import predict_peptide_content
|
|
29
|
+
|
|
30
|
+
result = predict_peptide_content(
|
|
31
|
+
["SIINFEKL", "GILGFVFTL"],
|
|
32
|
+
self_categories=("mammals", "human"),
|
|
33
|
+
)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Its primary summary is
|
|
37
|
+
`microbial_foreign_like = max(microbial heads) * (1 - max(selected self heads))`.
|
|
38
|
+
The score is useful for ranking peptide content, but it did not add a validated
|
|
39
|
+
T-cell immunogenicity signal beyond MHC presentation or affinity. See
|
|
40
|
+
[docs/peptide-content.md](docs/peptide-content.md) for the split, model comparison,
|
|
41
|
+
host-specific guidance, and evaluation.
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from weirdo import predict_categories
|
|
47
|
+
|
|
48
|
+
predict_categories(['SIINFEKL', 'NLVPMVATV', 'GILGFVFTL'])
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
peptide archaea bacteria fungi human invertebrates mammals plants rodents vertebrates viruses pathogen_max self_max foreignness
|
|
53
|
+
SIINFEKL 0.077 0.389 0.141 0.044 0.158 0.025 0.102 0.048 0.026 0.057 0.389 0.048 0.891
|
|
54
|
+
NLVPMVATV 0.026 0.461 0.100 0.092 0.069 0.047 0.116 0.106 0.040 0.027 0.461 0.106 0.813
|
|
55
|
+
GILGFVFTL 0.045 0.435 0.118 0.083 0.076 0.041 0.112 0.093 0.038 0.031 0.435 0.093 0.823
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`predict_categories(peptides, combine="sum")` gives `pathogen_sum` and `self_sum` columns instead.
|
|
59
|
+
|
|
60
|
+
Individual outputs stay close to the base rates (the two viral epitopes get a virus probability of about 0.03); see [docs/category-predictor.md](docs/category-predictor.md).
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
weirdo score SIINFEKL NLVPMVATV GILGFVFTL
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Training your own model
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from weirdo.scorers import SwissProtReference, MLPScorer
|
|
70
|
+
|
|
71
|
+
# Load reference data (SwissProt 8-mers with organism labels)
|
|
72
|
+
ref = SwissProtReference().load()
|
|
73
|
+
|
|
74
|
+
# Define organism categories
|
|
75
|
+
categories = [
|
|
76
|
+
'archaea', 'bacteria', 'fungi', 'human', 'invertebrates',
|
|
77
|
+
'mammals', 'plants', 'rodents', 'vertebrates', 'viruses'
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
# Get training data: each 8-mer labeled with organism presence
|
|
81
|
+
peptides, labels = ref.get_training_data(
|
|
82
|
+
target_categories=categories,
|
|
83
|
+
multi_label=True,
|
|
84
|
+
max_samples=200000 # Optional: sample for faster training
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
# Train the MLP: binary multi-label targets use one sigmoid per category and
|
|
88
|
+
# binary cross-entropy, so predict_proba returns probabilities.
|
|
89
|
+
scorer = MLPScorer(k=8, hidden_layer_sizes=(256, 128, 64))
|
|
90
|
+
scorer.train(peptides, labels, target_categories=categories, epochs=200)
|
|
91
|
+
|
|
92
|
+
# Score new peptides (any length)
|
|
93
|
+
df = scorer.predict_dataframe(['MTMDKSEL', 'SIINFEKL', 'NLVPMVATV'])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Early stopping needs validation peptides that are not near-duplicates of the training ones (overlapping 8-mers of one protein share 7 residues); pass `val_peptides` / `val_labels` built from different protein families. `scripts/train_category_predictor.py` does this and was used to train the bundled model.
|
|
97
|
+
|
|
98
|
+
## Installation
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install weirdo
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The bundled model needs no extra data. To train your own model or use the SwissProt reference
|
|
105
|
+
scorers, build the reference data from UniProt:
|
|
106
|
+
```bash
|
|
107
|
+
weirdo data download swissprot-sequences # ~670 MB from UniProt, builds a ~230 MB table
|
|
108
|
+
weirdo data download # also builds the 8-mer table (several GB, some minutes)
|
|
109
|
+
weirdo data reference-proteome dog # complete dog proteome for exact self lookup
|
|
110
|
+
weirdo data reference-proteome cattle # Bos taurus / UP000009136
|
|
111
|
+
weirdo data reference-proteome --proteome UP000009136 # any UniProt reference proteome
|
|
112
|
+
weirdo data reference-proteome --manifest --dry-run # inspect the 544-proteome frozen corpus
|
|
113
|
+
weirdo data reference-proteome --manifest --group mammals # resumably fetch its 32 mammals
|
|
114
|
+
```
|
|
115
|
+
The files are fetched with [datacache](https://github.com/openvax/datacache) from UniProt's FTP site
|
|
116
|
+
(`WEIRDO_UNIPROT_URL` selects a mirror), checked against the sizes and MD5s UniProt lists and kept
|
|
117
|
+
in `~/.weirdo/downloads/uniprot/release-<version>/`, so they are downloaded once per UniProt release.
|
|
118
|
+
Complete host references (`human`, `dog`, `cat`, `mouse`, `rat`, and `cattle`) are separately fetched as pinned
|
|
119
|
+
UniProt reference-proteome FASTAs, with a local SHA-256/content summary.
|
|
120
|
+
The same command also handles frozen multi-proteome selections. `--manifest`
|
|
121
|
+
downloads every selected FASTA through datacache, skips verified local files on
|
|
122
|
+
re-run, and supports `--group mammals`, `--group viruses`, or a specific leaf.
|
|
123
|
+
|
|
124
|
+
## Training Data
|
|
125
|
+
|
|
126
|
+
WEIRDO builds its 8-mer data from UniProtKB/Swiss-Prot (~100M unique k-mers) with `weirdo data download`:
|
|
127
|
+
|
|
128
|
+
| Category | Description |
|
|
129
|
+
|----------|-------------|
|
|
130
|
+
| human | Homo sapiens proteins |
|
|
131
|
+
| rodents | Mouse, rat proteins |
|
|
132
|
+
| mammals | Other mammals (dog, cow, primates, etc.) |
|
|
133
|
+
| vertebrates | Fish, birds, reptiles, amphibians |
|
|
134
|
+
| invertebrates | Insects, worms, mollusks |
|
|
135
|
+
| bacteria | Bacterial proteins |
|
|
136
|
+
| viruses | Viral proteins |
|
|
137
|
+
| archaea | Archaeal proteins |
|
|
138
|
+
| fungi | Fungal proteins |
|
|
139
|
+
| plants | Plant proteins |
|
|
140
|
+
|
|
141
|
+
Each 8-mer has True/False labels for each category, indicating whether it appears in proteins from that organism group.
|
|
142
|
+
|
|
143
|
+
## Feature Extraction
|
|
144
|
+
|
|
145
|
+
The MLP uses **592 features** extracted from each peptide:
|
|
146
|
+
|
|
147
|
+
### Amino Acid Properties (48 features)
|
|
148
|
+
12 physicochemical properties × 4 statistics (mean, std, min, max):
|
|
149
|
+
- Hydropathy, hydrophilicity
|
|
150
|
+
- Mass, volume
|
|
151
|
+
- Polarity, pK side chain
|
|
152
|
+
- Accessible surface area (folded/unfolded)
|
|
153
|
+
- Local flexibility, refractivity
|
|
154
|
+
- Solvent exposed area, % exposed residues
|
|
155
|
+
|
|
156
|
+
### Structural Features (27 features)
|
|
157
|
+
- **Secondary structure propensities** (12): helix, sheet, turn × 4 stats
|
|
158
|
+
- **Category fractions** (9): positive/negative charged, hydrophobic, aromatic, aliphatic, polar, tiny, small, cysteine
|
|
159
|
+
- **Charge features** (4): net charge, charge transitions, max cluster, R/(R+K) ratio
|
|
160
|
+
- **Disorder features** (2): disorder/order promoting fractions
|
|
161
|
+
|
|
162
|
+
### Composition Features (420 features)
|
|
163
|
+
- **Amino acid frequencies** (20): fraction of each amino acid
|
|
164
|
+
- **Dipeptide frequencies** (400): fraction of each amino acid pair
|
|
165
|
+
|
|
166
|
+
### Sequence Statistics (12 features)
|
|
167
|
+
- Length, log-length, sqrt-length
|
|
168
|
+
- Unknown fraction, unique AA fraction
|
|
169
|
+
- Max run length, repeat fraction
|
|
170
|
+
- Entropy/complexity (entropy, effective AAs, Gini, top-2/maximum frequency)
|
|
171
|
+
|
|
172
|
+
### Reduced Alphabet Frequencies (80 features)
|
|
173
|
+
- Composition across common reduced alphabets (Murphy, GBMR, SDM, etc.)
|
|
174
|
+
|
|
175
|
+
### Dipeptide Summary (5 features)
|
|
176
|
+
- Entropy, Gini, max/top2 frequency, homodipeptide fraction
|
|
177
|
+
|
|
178
|
+
## API Reference
|
|
179
|
+
|
|
180
|
+
### Training
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
from weirdo.scorers import SwissProtReference, MLPScorer
|
|
184
|
+
|
|
185
|
+
# Load reference
|
|
186
|
+
ref = SwissProtReference().load()
|
|
187
|
+
|
|
188
|
+
# Get training data
|
|
189
|
+
peptides, labels = ref.get_training_data(
|
|
190
|
+
target_categories=['human', 'viruses', 'bacteria', 'mammals'],
|
|
191
|
+
multi_label=True,
|
|
192
|
+
max_samples=100000 # Optional: limit for memory
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
# Train
|
|
196
|
+
scorer = MLPScorer(
|
|
197
|
+
k=8,
|
|
198
|
+
hidden_layer_sizes=(256, 128, 64),
|
|
199
|
+
activation='relu',
|
|
200
|
+
alpha=0.0001, # L2 regularization
|
|
201
|
+
)
|
|
202
|
+
scorer.train(
|
|
203
|
+
peptides, labels,
|
|
204
|
+
target_categories=['human', 'viruses', 'bacteria', 'mammals'],
|
|
205
|
+
epochs=200,
|
|
206
|
+
learning_rate=0.001
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Prediction
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
# Category probabilities, one independent sigmoid per category
|
|
214
|
+
probs = scorer.predict_proba(['MTMDKSEL'])
|
|
215
|
+
# Shape: (1, n_categories)
|
|
216
|
+
|
|
217
|
+
# Foreignness score
|
|
218
|
+
foreign = scorer.foreignness(
|
|
219
|
+
['MTMDKSEL'],
|
|
220
|
+
pathogen_categories=['bacteria', 'viruses'],
|
|
221
|
+
self_categories=['human', 'mammals', 'rodents'],
|
|
222
|
+
combine='max', # default: max(pathogens) / (max(pathogens) + max(self)); 'sum' adds the probabilities
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
# Full DataFrame output (handles variable-length peptides)
|
|
226
|
+
df = scorer.predict_dataframe(['MTMDKSEL', 'SIINFEKL', 'NLVPMVATV'])
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Feature Extraction
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
# Extract features as DataFrame
|
|
233
|
+
df = scorer.features_dataframe(['MTMDKSEL', 'SIINFEKL'])
|
|
234
|
+
# Shape: (2, 593) - 592 features + peptide column
|
|
235
|
+
|
|
236
|
+
# Feature names
|
|
237
|
+
names = scorer.get_feature_names()
|
|
238
|
+
# ['hydropathy_mean', 'hydropathy_std', ..., 'dipep_YY']
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Model Persistence
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
from weirdo import save_model, load_model, list_models
|
|
245
|
+
|
|
246
|
+
# Save trained model
|
|
247
|
+
save_model(scorer, 'my-foreignness-model')
|
|
248
|
+
|
|
249
|
+
# List saved models
|
|
250
|
+
for model in list_models():
|
|
251
|
+
print(f"{model.name}: {model.scorer_type}")
|
|
252
|
+
|
|
253
|
+
# Load model
|
|
254
|
+
scorer = load_model('my-foreignness-model')
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### CLI
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Data management
|
|
261
|
+
weirdo data download # Download SwissProt from UniProt and build the reference data
|
|
262
|
+
weirdo data reference-proteome dog # Complete host proteome for exact self lookup
|
|
263
|
+
weirdo data reference-proteome cattle # Bos taurus; `cow` is also accepted
|
|
264
|
+
weirdo data list # Show data status
|
|
265
|
+
|
|
266
|
+
# Model management
|
|
267
|
+
weirdo models list # List trained models
|
|
268
|
+
weirdo models train --data train.csv --name my-model
|
|
269
|
+
weirdo models info my-model # Show model details
|
|
270
|
+
weirdo models available # List built-in downloadable pretrained models
|
|
271
|
+
weirdo models download NAME # Download pretrained weights by name
|
|
272
|
+
weirdo models download --url https://.../model.tar.gz --save-as my-model
|
|
273
|
+
|
|
274
|
+
# Scoring
|
|
275
|
+
weirdo score MTMDKSEL SIINFEKL # bundled swissprot-categories model
|
|
276
|
+
weirdo score --combine sum MTMDKSEL # compare summed instead of maximal probabilities
|
|
277
|
+
weirdo score --model my-model MTMDKSEL # a model you trained
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Long-Run Training on Modal
|
|
281
|
+
|
|
282
|
+
Use `scripts/train_modal_long_run.py` to run long remote training and export
|
|
283
|
+
weights as a `.tar.gz` archive:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# One-time setup: seed the SwissProt CSV (built by `weirdo data download`) into the Modal data volume
|
|
287
|
+
modal volume put weirdo-data-cache ~/.weirdo/downloads/swissprot-8mers.csv downloads/swissprot-8mers.csv --force
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
modal run scripts/train_modal_long_run.py \
|
|
292
|
+
--model-name swissprot-mlp-modal \
|
|
293
|
+
--epochs 1000 \
|
|
294
|
+
--max-samples 2000000 \
|
|
295
|
+
--output-archive ./swissprot-mlp-modal.tar.gz
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
The script:
|
|
299
|
+
- trains `MLPScorer` remotely
|
|
300
|
+
- saves model files to a Modal volume
|
|
301
|
+
- packages weights into `MODEL_NAME.tar.gz`
|
|
302
|
+
- can return archive bytes to your local machine (`--output-archive`)
|
|
303
|
+
- reads SwissProt from `--swissprot-path` (default: `/root/.weirdo/downloads/swissprot-8mers.csv`)
|
|
304
|
+
- treats `--max-samples 0` (default) as "use all available rows"
|
|
305
|
+
|
|
306
|
+
## Distributing Model Weights
|
|
307
|
+
|
|
308
|
+
Recommended flow:
|
|
309
|
+
|
|
310
|
+
1. Train and export `MODEL_NAME.tar.gz` (Modal script above).
|
|
311
|
+
2. Upload archive to a GitHub Release asset (or other HTTPS hosting).
|
|
312
|
+
3. Download after install via CLI:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# Direct URL (no code change needed)
|
|
316
|
+
weirdo models download --url https://github.com/ORG/REPO/releases/download/vX.Y.Z/MODEL_NAME.tar.gz --save-as MODEL_NAME
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
If you want named built-in downloads (`weirdo models download MODEL_NAME`),
|
|
320
|
+
add an entry to `PRETRAINED_MODELS` in `weirdo/model_manager.py` and release a
|
|
321
|
+
new package version.
|
|
322
|
+
|
|
323
|
+
## Architecture
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
weirdo/
|
|
327
|
+
├── scorers/
|
|
328
|
+
│ ├── mlp.py # MLPScorer (sigmoid heads, foreignness)
|
|
329
|
+
│ ├── peptide_features.py # The 592 peptide features (vectorised)
|
|
330
|
+
│ ├── swissprot.py # SwissProtReference (training data)
|
|
331
|
+
│ ├── config.py # Presets and configuration
|
|
332
|
+
│ ├── registry.py # Scorer registry
|
|
333
|
+
│ └── trainable.py # TrainableScorer base class
|
|
334
|
+
├── pretrained/ # Models that ship in the package (weights up to 5 MB)
|
|
335
|
+
├── uniprot.py # Download SwissProt from UniProt (datacache), build sequences
|
|
336
|
+
├── kmer_table.py # Build the SwissProt k-mer reference table
|
|
337
|
+
├── data_manager.py # ~/.weirdo reference data
|
|
338
|
+
├── model_manager.py # Save/load trained models
|
|
339
|
+
├── amino_acid_properties.py # 12 AA property dictionaries
|
|
340
|
+
└── api.py # High-level functions
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Citation
|
|
344
|
+
|
|
345
|
+
```bibtex
|
|
346
|
+
@software{weirdo,
|
|
347
|
+
title = {WEIRDO: Widely Estimated Immunological Recognition and Detection of Outliers},
|
|
348
|
+
author = {PIRL-UNC},
|
|
349
|
+
url = {https://github.com/pirl-unc/weirdo}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## License
|
|
354
|
+
|
|
355
|
+
Apache License 2.0. See [LICENSE](LICENSE) for details.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "weirdo"
|
|
7
|
-
requires-python = ">=3.
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
8
|
authors = [{name="Alex Rubinsteyn", email="alex.rubinsteyn@unc.edu"}]
|
|
9
9
|
description = "Metrics of immunological foreignness for candidate T-cell epitopes"
|
|
10
10
|
classifiers = [
|
|
@@ -14,6 +14,12 @@ classifiers = [
|
|
|
14
14
|
"Intended Audience :: Science/Research",
|
|
15
15
|
"License :: OSI Approved :: Apache Software License",
|
|
16
16
|
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
17
23
|
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
18
24
|
]
|
|
19
25
|
readme = "README.md"
|
|
@@ -27,7 +33,7 @@ dependencies = {file = ["requirements.txt"]}
|
|
|
27
33
|
exclude = ["test", "test.*", "examples"]
|
|
28
34
|
|
|
29
35
|
[tool.setuptools.package-data]
|
|
30
|
-
weirdo = ["logging.conf", "matrices/*"]
|
|
36
|
+
weirdo = ["logging.conf", "matrices/*", "pretrained/*/*", "reference_proteome_manifests/*.yaml"]
|
|
31
37
|
|
|
32
38
|
[project.urls]
|
|
33
39
|
"Homepage" = "https://github.com/pirl-unc/weirdo"
|