pepdata 1.2.4__tar.gz → 1.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.
Files changed (58) hide show
  1. pepdata-1.3.0/PKG-INFO +102 -0
  2. pepdata-1.3.0/README.md +75 -0
  3. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/alleles.py +1 -1
  4. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/mhc.py +1 -3
  5. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/peptide_vectorizer.py +34 -3
  6. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/pmbec.py +1 -1
  7. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/version.py +1 -1
  8. pepdata-1.3.0/pepdata.egg-info/PKG-INFO +102 -0
  9. pepdata-1.3.0/pepdata.egg-info/requires.txt +4 -0
  10. {pepdata-1.2.4 → pepdata-1.3.0}/pyproject.toml +3 -0
  11. {pepdata-1.2.4 → pepdata-1.3.0}/requirements.txt +1 -5
  12. pepdata-1.3.0/tests/test_blosum.py +68 -0
  13. {pepdata-1.2.4 → pepdata-1.3.0}/tests/test_iedb_alleles.py +20 -1
  14. {pepdata-1.2.4 → pepdata-1.3.0}/tests/test_iedb_mhc.py +19 -0
  15. pepdata-1.3.0/tests/test_ngram.py +119 -0
  16. pepdata-1.3.0/tests/test_pmbec.py +31 -0
  17. pepdata-1.2.4/PKG-INFO +0 -86
  18. pepdata-1.2.4/README.md +0 -55
  19. pepdata-1.2.4/pepdata.egg-info/PKG-INFO +0 -86
  20. pepdata-1.2.4/pepdata.egg-info/requires.txt +0 -8
  21. pepdata-1.2.4/tests/test_blosum.py +0 -17
  22. pepdata-1.2.4/tests/test_ngram.py +0 -61
  23. pepdata-1.2.4/tests/test_pmbec.py +0 -7
  24. {pepdata-1.2.4 → pepdata-1.3.0}/LICENSE.txt +0 -0
  25. {pepdata-1.2.4 → pepdata-1.3.0}/MANIFEST.in +0 -0
  26. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/__init__.py +0 -0
  27. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/amino_acid.py +0 -0
  28. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/amino_acid_alphabet.py +0 -0
  29. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/amino_acid_properties.py +0 -0
  30. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/blosum.py +0 -0
  31. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/chou_fasman.py +0 -0
  32. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/common.py +0 -0
  33. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/__init__.py +0 -0
  34. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/columns.py +0 -0
  35. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/common.py +0 -0
  36. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/memoize.py +0 -0
  37. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/iedb/tcell.py +0 -0
  38. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/BLOSUM30 +0 -0
  39. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/BLOSUM50 +0 -0
  40. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/BLOSUM62 +0 -0
  41. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/__init__.py +0 -0
  42. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/amino_acid_properties.txt +0 -0
  43. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/helix_vs_coil.txt +0 -0
  44. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/helix_vs_strand.txt +0 -0
  45. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/pmbec.mat +0 -0
  46. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/matrices/strand_vs_coil.txt +0 -0
  47. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/reduced_alphabet.py +0 -0
  48. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/residue_contact_energies.py +0 -0
  49. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata/static_data.py +0 -0
  50. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata.egg-info/SOURCES.txt +0 -0
  51. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata.egg-info/dependency_links.txt +0 -0
  52. {pepdata-1.2.4 → pepdata-1.3.0}/pepdata.egg-info/top_level.txt +0 -0
  53. {pepdata-1.2.4 → pepdata-1.3.0}/scripts/check_docs_examples.py +0 -0
  54. {pepdata-1.2.4 → pepdata-1.3.0}/scripts/check_docs_links.py +0 -0
  55. {pepdata-1.2.4 → pepdata-1.3.0}/setup.cfg +0 -0
  56. {pepdata-1.2.4 → pepdata-1.3.0}/tests/conftest.py +0 -0
  57. {pepdata-1.2.4 → pepdata-1.3.0}/tests/test_amino_acids.py +0 -0
  58. {pepdata-1.2.4 → pepdata-1.3.0}/tests/test_iedb_tcell.py +0 -0
pepdata-1.3.0/PKG-INFO ADDED
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: pepdata
3
+ Version: 1.3.0
4
+ Summary: Immunological peptide datasets and amino acid properties
5
+ Author-email: Alex Rubinsteyn <alex.rubinsteyn@mssm.edu>
6
+ Project-URL: Homepage, https://github.com/openvax/pepdata
7
+ Project-URL: Bug Tracker, https://github.com/openvax/pepdata/issues
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
22
+ Requires-Dist: numpy<3.0.0,>=2.0.0
23
+ Requires-Dist: pandas<4,>=3
24
+ Requires-Dist: scikit-learn>=0.14.1
25
+ Requires-Dist: datacache>=0.4.4
26
+ Dynamic: license-file
27
+
28
+ [![Tests](https://github.com/openvax/pepdata/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/openvax/pepdata/actions/workflows/tests.yml)
29
+ [![Documentation](https://github.com/openvax/pepdata/actions/workflows/documentation.yml/badge.svg?branch=master)](https://openvax.github.io/pepdata/)
30
+ [![PyPI](https://img.shields.io/pypi/v/pepdata.svg)](https://pypi.org/project/pepdata/)
31
+
32
+ # pepdata
33
+
34
+ pepdata ships amino-acid property tables and pairwise residue matrices
35
+ (BLOSUM, PMBEC, contact energies), turns peptide sequences into n-gram feature
36
+ vectors, and loads MHC-binding and T-cell assay tables from the
37
+ [IEDB](https://www.iedb.org/). It is the [OpenVax](https://github.com/openvax)
38
+ library for peptide-level reference data. It does not predict MHC binding; for
39
+ that, see [mhctools](https://github.com/openvax/mhctools) and
40
+ [mhcflurry](https://github.com/openvax/mhcflurry).
41
+
42
+ ## Install
43
+
44
+ ```sh
45
+ python -m pip install pepdata
46
+ ```
47
+
48
+ pepdata needs Python 3.11 or later. Property tables and matrices ship with the
49
+ package and work offline. The IEDB tables are downloaded on first use and
50
+ cached by [datacache](https://github.com/openvax/datacache).
51
+
52
+ ## Quick start
53
+
54
+ ```python
55
+ from pepdata.amino_acid_properties import hydropathy
56
+
57
+ peptide = "ACD"
58
+ print([hydropathy[residue] for residue in peptide])
59
+ ```
60
+
61
+ ```text
62
+ [1.8, 2.5, -3.5]
63
+ ```
64
+
65
+ Each property table is a dictionary from single-letter residue to value. Use
66
+ uppercase canonical residue letters; a missing letter raises `KeyError`.
67
+
68
+ ## Documentation
69
+
70
+ The [documentation](https://openvax.github.io/pepdata/) has two guides and an
71
+ API reference:
72
+
73
+ 1. [Residue and pairwise tables](https://openvax.github.io/pepdata/guides/properties/):
74
+ property dictionaries, BLOSUM and other matrices, alphabets.
75
+ 2. [Peptide features and IEDB tables](https://openvax.github.io/pepdata/guides/datasets/):
76
+ n-gram vectors and the MHC-binding and T-cell assay loaders.
77
+ 3. [API reference](https://openvax.github.io/pepdata/reference/).
78
+
79
+ | Task | Module or object |
80
+ | --- | --- |
81
+ | Single-residue properties | `pepdata.amino_acid_properties` |
82
+ | BLOSUM substitution matrices | `pepdata.blosum` |
83
+ | PMBEC and contact tables | `pepdata.pmbec`, `pepdata.residue_contact_energies` |
84
+ | Residue alphabets | `pepdata.amino_acid_alphabet`, `pepdata.reduced_alphabet` |
85
+ | N-gram features | `pepdata.PeptideVectorizer` |
86
+ | MHC-binding assay tables | `pepdata.iedb.mhc` |
87
+ | T-cell assay tables | `pepdata.iedb.tcell` |
88
+
89
+ ## Development
90
+
91
+ ```sh
92
+ python -m pip install -e . pytest pytest-cov ruff
93
+ ./lint.sh # ruff check
94
+ ./test.sh # pytest with coverage
95
+ python -m pip install -r requirements-docs.txt
96
+ ./docs.sh # mkdocs build --strict, then a rendered-link check
97
+ python scripts/check_docs_examples.py # run docs examples, compare output
98
+ ```
99
+
100
+ ## License
101
+
102
+ Apache 2.0; see [LICENSE.txt](https://github.com/openvax/pepdata/blob/master/LICENSE.txt).
@@ -0,0 +1,75 @@
1
+ [![Tests](https://github.com/openvax/pepdata/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/openvax/pepdata/actions/workflows/tests.yml)
2
+ [![Documentation](https://github.com/openvax/pepdata/actions/workflows/documentation.yml/badge.svg?branch=master)](https://openvax.github.io/pepdata/)
3
+ [![PyPI](https://img.shields.io/pypi/v/pepdata.svg)](https://pypi.org/project/pepdata/)
4
+
5
+ # pepdata
6
+
7
+ pepdata ships amino-acid property tables and pairwise residue matrices
8
+ (BLOSUM, PMBEC, contact energies), turns peptide sequences into n-gram feature
9
+ vectors, and loads MHC-binding and T-cell assay tables from the
10
+ [IEDB](https://www.iedb.org/). It is the [OpenVax](https://github.com/openvax)
11
+ library for peptide-level reference data. It does not predict MHC binding; for
12
+ that, see [mhctools](https://github.com/openvax/mhctools) and
13
+ [mhcflurry](https://github.com/openvax/mhcflurry).
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ python -m pip install pepdata
19
+ ```
20
+
21
+ pepdata needs Python 3.11 or later. Property tables and matrices ship with the
22
+ package and work offline. The IEDB tables are downloaded on first use and
23
+ cached by [datacache](https://github.com/openvax/datacache).
24
+
25
+ ## Quick start
26
+
27
+ ```python
28
+ from pepdata.amino_acid_properties import hydropathy
29
+
30
+ peptide = "ACD"
31
+ print([hydropathy[residue] for residue in peptide])
32
+ ```
33
+
34
+ ```text
35
+ [1.8, 2.5, -3.5]
36
+ ```
37
+
38
+ Each property table is a dictionary from single-letter residue to value. Use
39
+ uppercase canonical residue letters; a missing letter raises `KeyError`.
40
+
41
+ ## Documentation
42
+
43
+ The [documentation](https://openvax.github.io/pepdata/) has two guides and an
44
+ API reference:
45
+
46
+ 1. [Residue and pairwise tables](https://openvax.github.io/pepdata/guides/properties/):
47
+ property dictionaries, BLOSUM and other matrices, alphabets.
48
+ 2. [Peptide features and IEDB tables](https://openvax.github.io/pepdata/guides/datasets/):
49
+ n-gram vectors and the MHC-binding and T-cell assay loaders.
50
+ 3. [API reference](https://openvax.github.io/pepdata/reference/).
51
+
52
+ | Task | Module or object |
53
+ | --- | --- |
54
+ | Single-residue properties | `pepdata.amino_acid_properties` |
55
+ | BLOSUM substitution matrices | `pepdata.blosum` |
56
+ | PMBEC and contact tables | `pepdata.pmbec`, `pepdata.residue_contact_energies` |
57
+ | Residue alphabets | `pepdata.amino_acid_alphabet`, `pepdata.reduced_alphabet` |
58
+ | N-gram features | `pepdata.PeptideVectorizer` |
59
+ | MHC-binding assay tables | `pepdata.iedb.mhc` |
60
+ | T-cell assay tables | `pepdata.iedb.tcell` |
61
+
62
+ ## Development
63
+
64
+ ```sh
65
+ python -m pip install -e . pytest pytest-cov ruff
66
+ ./lint.sh # ruff check
67
+ ./test.sh # pytest with coverage
68
+ python -m pip install -r requirements-docs.txt
69
+ ./docs.sh # mkdocs build --strict, then a rendered-link check
70
+ python scripts/check_docs_examples.py # run docs examples, compare output
71
+ ```
72
+
73
+ ## License
74
+
75
+ Apache 2.0; see [LICENSE.txt](https://github.com/openvax/pepdata/blob/master/LICENSE.txt).
@@ -12,7 +12,7 @@
12
12
 
13
13
  from collections import namedtuple
14
14
  import os
15
- import xml
15
+ import xml.etree.ElementTree
16
16
 
17
17
  from .common import cache
18
18
  from .memoize import memoize
@@ -42,7 +42,7 @@ def local_path(auto_download=True):
42
42
  return download()
43
43
  raise ValueError(
44
44
  ("MHC data file %s does not exist locally,"
45
- " call pepdata.mhc.download() to get a copy from IEDB") % path)
45
+ " call pepdata.iedb.mhc.download() to get a copy from IEDB") % path)
46
46
  return path
47
47
 
48
48
  def delete():
@@ -108,8 +108,6 @@ def load_dataframe(
108
108
  # To deal with this, drop any columns which are all NaN
109
109
  df = df.dropna(axis=1, how="all")
110
110
 
111
- print(df.head())
112
-
113
111
  n = len(df)
114
112
 
115
113
  mhc_group_key = "MHC Restriction"
@@ -55,16 +55,31 @@ class PeptideVectorizer(object):
55
55
  }
56
56
 
57
57
  def fit_transform(self, amino_acid_strings):
58
+ """
59
+ Learn the n-gram vocabulary of the given sequences and vectorize them.
60
+
61
+ Parameters
62
+ ----------
63
+ amino_acid_strings : list of str
64
+ Peptide or protein sequences.
65
+
66
+ Returns
67
+ -------
68
+ numpy.ndarray
69
+ Array of shape (len(amino_acid_strings), number of distinct
70
+ n-grams) with n-gram counts, or per-row frequencies (each row
71
+ divided by its total) when normalize_row is True.
72
+ """
58
73
  self.count_vectorizer = \
59
74
  make_count_vectorizer(self.reduced_alphabet, self.max_ngram)
60
75
 
61
76
  if self.training_already_reduced:
62
77
  c = make_count_vectorizer(None, self.max_ngram)
63
- X = c.fit_transform(amino_acid_strings).todense()
78
+ X = c.fit_transform(amino_acid_strings).toarray()
64
79
  self.count_vectorizer.vocabulary_ = c.vocabulary_
65
80
  else:
66
81
  c = self.count_vectorizer
67
- X = c.fit_transform(amino_acid_strings).todense()
82
+ X = c.fit_transform(amino_acid_strings).toarray()
68
83
 
69
84
  if self.normalize_row:
70
85
  X = normalize(X, norm='l1')
@@ -74,8 +89,24 @@ class PeptideVectorizer(object):
74
89
  self.fit_transform(amino_acid_strings)
75
90
 
76
91
  def transform(self, amino_acid_strings):
92
+ """
93
+ Vectorize sequences with the vocabulary learned by fit.
94
+
95
+ n-grams that weren't seen during fitting are not counted.
96
+
97
+ Parameters
98
+ ----------
99
+ amino_acid_strings : list of str
100
+ Peptide or protein sequences.
101
+
102
+ Returns
103
+ -------
104
+ numpy.ndarray
105
+ Array of shape (len(amino_acid_strings), size of the fitted
106
+ vocabulary), normalized per row as in fit_transform.
107
+ """
77
108
  assert self.count_vectorizer, "Must call 'fit' before 'transform'"
78
- X = self.count_vectorizer.transform(amino_acid_strings).todense()
109
+ X = self.count_vectorizer.transform(amino_acid_strings).toarray()
79
110
  if self.normalize_row:
80
111
  X = normalize(X, norm='l1')
81
112
  return X
@@ -83,5 +83,5 @@ def read_pmbec_coefficients(
83
83
  return d
84
84
 
85
85
  # dictionary of PMBEC coefficient accessed like pmbec_dict["V"]["R"]
86
- pmbec_dict = read_pmbec_coefficients(key_type="row")
86
+ pmbec_dict = read_pmbec_coefficients(key_type="row", verbose=False)
87
87
  pmbec_matrix = dict_to_amino_acid_matrix(pmbec_dict)
@@ -1,4 +1,4 @@
1
- __version__ = "1.2.4"
1
+ __version__ = "1.3.0"
2
2
 
3
3
 
4
4
  def print_version():
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: pepdata
3
+ Version: 1.3.0
4
+ Summary: Immunological peptide datasets and amino acid properties
5
+ Author-email: Alex Rubinsteyn <alex.rubinsteyn@mssm.edu>
6
+ Project-URL: Homepage, https://github.com/openvax/pepdata
7
+ Project-URL: Bug Tracker, https://github.com/openvax/pepdata/issues
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
22
+ Requires-Dist: numpy<3.0.0,>=2.0.0
23
+ Requires-Dist: pandas<4,>=3
24
+ Requires-Dist: scikit-learn>=0.14.1
25
+ Requires-Dist: datacache>=0.4.4
26
+ Dynamic: license-file
27
+
28
+ [![Tests](https://github.com/openvax/pepdata/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/openvax/pepdata/actions/workflows/tests.yml)
29
+ [![Documentation](https://github.com/openvax/pepdata/actions/workflows/documentation.yml/badge.svg?branch=master)](https://openvax.github.io/pepdata/)
30
+ [![PyPI](https://img.shields.io/pypi/v/pepdata.svg)](https://pypi.org/project/pepdata/)
31
+
32
+ # pepdata
33
+
34
+ pepdata ships amino-acid property tables and pairwise residue matrices
35
+ (BLOSUM, PMBEC, contact energies), turns peptide sequences into n-gram feature
36
+ vectors, and loads MHC-binding and T-cell assay tables from the
37
+ [IEDB](https://www.iedb.org/). It is the [OpenVax](https://github.com/openvax)
38
+ library for peptide-level reference data. It does not predict MHC binding; for
39
+ that, see [mhctools](https://github.com/openvax/mhctools) and
40
+ [mhcflurry](https://github.com/openvax/mhcflurry).
41
+
42
+ ## Install
43
+
44
+ ```sh
45
+ python -m pip install pepdata
46
+ ```
47
+
48
+ pepdata needs Python 3.11 or later. Property tables and matrices ship with the
49
+ package and work offline. The IEDB tables are downloaded on first use and
50
+ cached by [datacache](https://github.com/openvax/datacache).
51
+
52
+ ## Quick start
53
+
54
+ ```python
55
+ from pepdata.amino_acid_properties import hydropathy
56
+
57
+ peptide = "ACD"
58
+ print([hydropathy[residue] for residue in peptide])
59
+ ```
60
+
61
+ ```text
62
+ [1.8, 2.5, -3.5]
63
+ ```
64
+
65
+ Each property table is a dictionary from single-letter residue to value. Use
66
+ uppercase canonical residue letters; a missing letter raises `KeyError`.
67
+
68
+ ## Documentation
69
+
70
+ The [documentation](https://openvax.github.io/pepdata/) has two guides and an
71
+ API reference:
72
+
73
+ 1. [Residue and pairwise tables](https://openvax.github.io/pepdata/guides/properties/):
74
+ property dictionaries, BLOSUM and other matrices, alphabets.
75
+ 2. [Peptide features and IEDB tables](https://openvax.github.io/pepdata/guides/datasets/):
76
+ n-gram vectors and the MHC-binding and T-cell assay loaders.
77
+ 3. [API reference](https://openvax.github.io/pepdata/reference/).
78
+
79
+ | Task | Module or object |
80
+ | --- | --- |
81
+ | Single-residue properties | `pepdata.amino_acid_properties` |
82
+ | BLOSUM substitution matrices | `pepdata.blosum` |
83
+ | PMBEC and contact tables | `pepdata.pmbec`, `pepdata.residue_contact_energies` |
84
+ | Residue alphabets | `pepdata.amino_acid_alphabet`, `pepdata.reduced_alphabet` |
85
+ | N-gram features | `pepdata.PeptideVectorizer` |
86
+ | MHC-binding assay tables | `pepdata.iedb.mhc` |
87
+ | T-cell assay tables | `pepdata.iedb.tcell` |
88
+
89
+ ## Development
90
+
91
+ ```sh
92
+ python -m pip install -e . pytest pytest-cov ruff
93
+ ./lint.sh # ruff check
94
+ ./test.sh # pytest with coverage
95
+ python -m pip install -r requirements-docs.txt
96
+ ./docs.sh # mkdocs build --strict, then a rendered-link check
97
+ python scripts/check_docs_examples.py # run docs examples, compare output
98
+ ```
99
+
100
+ ## License
101
+
102
+ Apache 2.0; see [LICENSE.txt](https://github.com/openvax/pepdata/blob/master/LICENSE.txt).
@@ -0,0 +1,4 @@
1
+ numpy<3.0.0,>=2.0.0
2
+ pandas<4,>=3
3
+ scikit-learn>=0.14.1
4
+ datacache>=0.4.4
@@ -34,6 +34,9 @@ exclude = ["test", "test.*"]
34
34
  "Homepage" = "https://github.com/openvax/pepdata"
35
35
  "Bug Tracker" = "https://github.com/openvax/pepdata/issues"
36
36
 
37
+ [tool.ruff]
38
+ target-version = "py311"
39
+
37
40
  [tool.ruff.lint]
38
41
  select = ["E", "F"]
39
42
  ignore = ["F821", "E501", "F841", "E731", "E741", "E722", "E721"]
@@ -1,8 +1,4 @@
1
1
  numpy>=2.0.0,<3.0.0
2
- scipy>=0.9
3
- pandas>=0.17
2
+ pandas>=3,<4
4
3
  scikit-learn>=0.14.1
5
- progressbar33
6
- biopython>=1.65
7
4
  datacache>=0.4.4
8
- lxml
@@ -0,0 +1,68 @@
1
+ import pytest
2
+
3
+ from pepdata.amino_acid_alphabet import canonical_amino_acid_letters
4
+ from pepdata.blosum import (
5
+ blosum30_dict,
6
+ blosum30_matrix,
7
+ blosum50_dict,
8
+ blosum50_matrix,
9
+ blosum62_dict,
10
+ blosum62_matrix,
11
+ )
12
+
13
+ BLOSUM_TABLES = {
14
+ 30: (blosum30_dict, blosum30_matrix),
15
+ 50: (blosum50_dict, blosum50_matrix),
16
+ 62: (blosum62_dict, blosum62_matrix),
17
+ }
18
+
19
+ # Published self-substitution scores for alanine, tryptophan and cysteine.
20
+ DIAGONAL_SCORES = {
21
+ 30: {"A": 4, "W": 20, "C": 17},
22
+ 50: {"A": 5, "W": 15, "C": 13},
23
+ 62: {"A": 4, "W": 11, "C": 9},
24
+ }
25
+
26
+
27
+ @pytest.mark.parametrize("number", sorted(BLOSUM_TABLES))
28
+ def test_blosum_covers_canonical_residues(number):
29
+ table, _ = BLOSUM_TABLES[number]
30
+ for row in canonical_amino_acid_letters:
31
+ assert set(canonical_amino_acid_letters) <= set(table[row])
32
+
33
+
34
+ @pytest.mark.parametrize("number", sorted(BLOSUM_TABLES))
35
+ def test_blosum_diagonal_scores(number):
36
+ table, _ = BLOSUM_TABLES[number]
37
+ for residue, score in DIAGONAL_SCORES[number].items():
38
+ assert table[residue][residue] == score
39
+ for residue in canonical_amino_acid_letters:
40
+ row = [table[residue][other] for other in canonical_amino_acid_letters]
41
+ assert table[residue][residue] == max(row)
42
+
43
+
44
+ @pytest.mark.parametrize("number", [30, 62])
45
+ def test_blosum_is_symmetric(number):
46
+ table, _ = BLOSUM_TABLES[number]
47
+ for x in canonical_amino_acid_letters:
48
+ for y in canonical_amino_acid_letters:
49
+ assert table[x][y] == table[y][x]
50
+
51
+
52
+ def test_blosum50_asymmetry_is_limited_to_shipped_w_t_entry():
53
+ # The shipped BLOSUM50 file has W->T = -4 but T->W = -3 (published value -3).
54
+ asymmetric = {
55
+ (x, y)
56
+ for x in canonical_amino_acid_letters
57
+ for y in canonical_amino_acid_letters
58
+ if blosum50_dict[x][y] != blosum50_dict[y][x]
59
+ }
60
+ assert asymmetric == {("T", "W"), ("W", "T")}
61
+
62
+
63
+ @pytest.mark.parametrize("number", sorted(BLOSUM_TABLES))
64
+ def test_blosum_matrix_matches_dict_in_canonical_order(number):
65
+ table, matrix = BLOSUM_TABLES[number]
66
+ for i, x in enumerate(canonical_amino_acid_letters):
67
+ for j, y in enumerate(canonical_amino_acid_letters):
68
+ assert matrix[i, j] == table[x][y]
@@ -10,10 +10,29 @@
10
10
  # See the License for the specific language governing permissions and
11
11
  # limitations under the License.
12
12
 
13
-
13
+ import os
14
+ import subprocess
15
+ import sys
14
16
 
15
17
  from pepdata import iedb
16
18
 
19
+ ALLELE_FIXTURE = os.path.join(os.path.dirname(__file__), "data", "alleles_test_fixture.xml")
20
+
21
+
22
+ def test_load_alleles_in_a_fresh_interpreter():
23
+ # pytest itself imports xml.etree, which hid a bare "import xml" in
24
+ # pepdata.iedb.alleles. Parse in a new interpreter so only pepdata's own
25
+ # imports are loaded.
26
+ script = (
27
+ "import pepdata.iedb.alleles as alleles\n"
28
+ "alleles.local_path = lambda force_download=False: %r\n"
29
+ "print(len(alleles.load_alleles()))\n" % ALLELE_FIXTURE
30
+ )
31
+ result = subprocess.run(
32
+ [sys.executable, "-c", script], capture_output=True, text=True)
33
+ assert result.returncode == 0, result.stderr
34
+ assert int(result.stdout) > 0
35
+
17
36
  def test_iedb_human_class1_allele():
18
37
  allele_dict = iedb.alleles.load_alleles_dict()
19
38
  allele = allele_dict["HLA-C*07:02"]
@@ -12,8 +12,13 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import pytest
16
+
15
17
  from pepdata import iedb
16
18
 
19
+ # Bound at import, before conftest's autouse fixture replaces it with a fixture path.
20
+ original_mhc_local_path = iedb.mhc.local_path
21
+
17
22
  def test_mhc_hla_a2():
18
23
  """
19
24
  IEDB MHC: Test that HLA restriction actually decreases number of results and
@@ -28,3 +33,17 @@ def test_mhc_hla_a2():
28
33
  assert len(df_a2_combined) <= len(df_a2_1) + len(df_a2_2), \
29
34
  "Expected %d <= %d + %d" % \
30
35
  (len(df_a2_combined), len(df_a2_1), len(df_a2_2))
36
+
37
+
38
+ def test_mhc_load_dataframe_prints_nothing(capsys):
39
+ # nrows=999 avoids the memoized results of the other tests.
40
+ df = iedb.mhc.load_dataframe(nrows=999)
41
+ assert len(df) > 0
42
+ assert capsys.readouterr().out == ""
43
+
44
+
45
+ def test_mhc_missing_file_error_names_the_download_function(monkeypatch, tmp_path):
46
+ monkeypatch.setattr(
47
+ iedb.mhc.cache, "local_path", lambda **kwargs: str(tmp_path / "missing.csv"))
48
+ with pytest.raises(ValueError, match=r"pepdata\.iedb\.mhc\.download\(\)"):
49
+ original_mhc_local_path(auto_download=False)
@@ -0,0 +1,119 @@
1
+ # Copyright (c) 2014. Mount Sinai School of Medicine
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import pickle
16
+
17
+ import numpy as np
18
+ import pytest
19
+
20
+ from pepdata import PeptideVectorizer
21
+ from pepdata.reduced_alphabet import hp2
22
+
23
+ # isoforms of two different proteins a, b
24
+
25
+ a1 = (
26
+ "MSPHPTALLGLVLCLAQTIHTQEEDLPRPSISAEPGTVIPLGSHVTFVCRGPVGVQTFRLERESRSTYND"
27
+ "TEDVSQASPSESEARFRIDSVSEGNAGPYRCIYYKPPKWSEQSDYLELLVKETSGGPDSPDTEPGSSAGPT"
28
+ "QRPSDNSHNEHAPASQGLKAEHLYILIGVSVVFLFCLLLLVLFCLHRQNQIKQGPPRSKDEEQKPQQRPDL"
29
+ "AVDVLERTADKATVNGLPEKDRETDTSALAAGSSQEVTYAQLDHWALTQRTARAVSPQSTKPMAESITYAA"
30
+ "VARH"
31
+ )
32
+
33
+ a2 = (
34
+ "MSLMVVSMACVGFFLLQGAWPHEGVHRKPSLLAHPGPLVKSEETVILQCWSDVRFEHFLLHREGKYKDTLH"
35
+ "LIGEHHDGVSKANFSIGPMMQDLAGTYRCYGSVTHSPYQLSAPSDPLDIVITGLYEKPSLSAQPGPTVLAG"
36
+ "ESVTLSCSSRSSYDMYHLSREGEAHERRFSAGPKVNGTFQADFPLGPATHGGTYRCFGSFRDSPYEWSNSS"
37
+ "DPLLVSVTGNPSNSWPSPTEPSSKTGNPRHLHVLIGTSVVKIPFTILLFFLLHRWCSNKKNAAVMDQEPAG"
38
+ "NRTVNSEDSDEQDHQEVSYA"
39
+ )
40
+
41
+ a3 = (
42
+ "MSLMVVSMACVGFFLLEGPWPHVGGQDKPFLSAWPGTVVSEGQHVTLQCRSRLGFNEFSLSKEDGMPVPEL"
43
+ "YNRIFRNSFLMGPVTPAHAGTYRCCSSHPHSPTGWSAPSNPVVIMVTGVHRKPSLLAHPGPLVKSEETVIL"
44
+ "QCWSDVRFEHFLLHREGKYKDTLHLIGEHHDGVSKANFSIGPMMQDLAGTYRCYGSVTHSPYQLSAPSDPL"
45
+ "DIVITGLYEKPSLSAQPGPTVLAGESVTLSCSSRSSYDMYHLSREGEAHERRFSAGPKVNGTFQADFPLGP"
46
+ "ATHGGTYRCFGSFRDSPYEWSNSSDPLLVSVTAFLSVKSSGHKYIY"
47
+ )
48
+
49
+ A = [a1, a2, a3]
50
+
51
+ b1 = (
52
+ "MPKGRAGSLPTTSIGWRFQLWFLGLTCPERHLARRLKNNSFYPFVQQEPNVFVLEYYLDTLWKGMLLFII"
53
+ "SVVLVSFSSLREVQKQETWVFLVYGVGVGLWLVISSLPRRRLVLNHTRGVYHFSIQGRTVCQGPLHLVYV"
54
+ "RLALSSDAHGRCFFHLVLGGHRLEPLVLVQLSEHYEQMEYLGRYIARKLNINYFDYLATSYRHVVRHWPP"
55
+ "PGAGTVMGKSPMGHKPSSSQSSLEV"
56
+ )
57
+
58
+ b2 = (
59
+ "MPKGRAGSLPTTSIGWRFQLWFLGLTCPERHLARRLKNNSFYPFVQQEPNVFVLEYYLDTLWKGMLLFII"
60
+ "SVVLVSFSSLREVQKQETWVFLVYGVGVGLWLVISSLPRRRLVLNHTRGVYHFSIQGRTVCQGPLHLVYV"
61
+ "RLALSSDAHGRCFFHLVLGGHRLEPLVLVQLSEHYEQMEYLGRYIARKLNINYFDYLATSYRHVVRHWPPP"
62
+ "GAGTVMGKSPMGHKPSSSQSSLEV"
63
+ )
64
+
65
+ B = [b1, b2]
66
+
67
+
68
+ @pytest.mark.parametrize("normalize_row", [True, False])
69
+ def test_fit_transform_returns_one_array_row_per_sequence(normalize_row):
70
+ vectorizer = PeptideVectorizer(max_ngram=2, normalize_row=normalize_row)
71
+ X = vectorizer.fit_transform(A + B)
72
+ assert type(X) is np.ndarray
73
+ assert X.shape == (len(A + B), len(vectorizer.count_vectorizer.vocabulary_))
74
+ Y = vectorizer.transform(A + B)
75
+ assert type(Y) is np.ndarray
76
+ np.testing.assert_allclose(Y, X)
77
+
78
+
79
+ def test_default_normalize_row_gives_row_frequencies():
80
+ # The default path raised "np.matrix is not supported" on current
81
+ # scikit-learn (#62).
82
+ vectorizer = PeptideVectorizer()
83
+ X = vectorizer.fit_transform(["SIINFEKL", "GILGFVFTL"])
84
+ assert X.shape == (2, 10)
85
+ np.testing.assert_allclose(X.sum(axis=1), [1.0, 1.0])
86
+ column_i = vectorizer.count_vectorizer.vocabulary_["i"]
87
+ np.testing.assert_allclose(X[:, column_i], [2 / 8, 1 / 9])
88
+
89
+
90
+ def test_normalize_row_false_gives_counts():
91
+ vectorizer = PeptideVectorizer(normalize_row=False)
92
+ X = vectorizer.fit_transform(["SIINFEKL", "GILGFVFTL"])
93
+ np.testing.assert_array_equal(X.sum(axis=1), [8, 9])
94
+
95
+
96
+ @pytest.mark.parametrize("normalize_row, expected_total", [(False, 13.0), (True, 1.0)])
97
+ def test_transform_counts_only_fitted_ngrams(normalize_row, expected_total):
98
+ # SIINFEKA has 15 1- and 2-grams; "A" and "KA" were not seen during fitting.
99
+ vectorizer = PeptideVectorizer(max_ngram=2, normalize_row=normalize_row)
100
+ vectorizer.fit(["SIINFEKL", "SIINFEKV"])
101
+ X = vectorizer.transform(["SIINFEKA"])
102
+ assert X.shape == (1, 16)
103
+ assert X.sum() == pytest.approx(expected_total)
104
+
105
+
106
+ def test_fit_transform_on_already_reduced_training_sequences():
107
+ reduced = ["".join(hp2[residue] for residue in sequence) for sequence in A + B]
108
+ vectorizer = PeptideVectorizer(reduced_alphabet=hp2, training_already_reduced=True)
109
+ X = vectorizer.fit_transform(reduced)
110
+ assert type(X) is np.ndarray
111
+ assert X.shape == (len(A + B), 2)
112
+ np.testing.assert_allclose(X.sum(axis=1), np.ones(len(A + B)))
113
+
114
+
115
+ def test_pickled_vectorizer_transforms_identically():
116
+ vectorizer = PeptideVectorizer(max_ngram=2)
117
+ vectorizer.fit(A)
118
+ restored = pickle.loads(pickle.dumps(vectorizer))
119
+ np.testing.assert_allclose(restored.transform(B), vectorizer.transform(B))
@@ -0,0 +1,31 @@
1
+ import numpy as np
2
+
3
+ from pepdata.amino_acid_alphabet import canonical_amino_acid_letters
4
+ from pepdata.pmbec import (
5
+ pmbec_dict,
6
+ pmbec_matrix,
7
+ )
8
+
9
+
10
+ def test_pmbec_covers_canonical_residues():
11
+ assert sorted(pmbec_dict) == sorted(canonical_amino_acid_letters)
12
+ for row in pmbec_dict.values():
13
+ assert sorted(row) == sorted(canonical_amino_acid_letters)
14
+
15
+
16
+ def test_pmbec_matrix_is_symmetric_and_matches_dict():
17
+ assert pmbec_matrix.shape == (20, 20)
18
+ assert np.allclose(pmbec_matrix, pmbec_matrix.T)
19
+ for i, x in enumerate(canonical_amino_acid_letters):
20
+ for j, y in enumerate(canonical_amino_acid_letters):
21
+ assert np.isclose(pmbec_matrix[i, j], pmbec_dict[x][y])
22
+
23
+
24
+ def test_importing_pmbec_prints_nothing():
25
+ import subprocess
26
+ import sys
27
+
28
+ result = subprocess.run(
29
+ [sys.executable, "-c", "import pepdata.pmbec"],
30
+ capture_output=True, text=True, check=True)
31
+ assert result.stdout == ""
pepdata-1.2.4/PKG-INFO DELETED
@@ -1,86 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pepdata
3
- Version: 1.2.4
4
- Summary: Immunological peptide datasets and amino acid properties
5
- Author-email: Alex Rubinsteyn <alex.rubinsteyn@mssm.edu>
6
- Project-URL: Homepage, https://github.com/openvax/pepdata
7
- Project-URL: Bug Tracker, https://github.com/openvax/pepdata/issues
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Environment :: Console
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: Apache Software License
13
- Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Programming Language :: Python :: 3.14
18
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
- Requires-Python: >=3.11
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE.txt
22
- Requires-Dist: numpy<3.0.0,>=2.0.0
23
- Requires-Dist: scipy>=0.9
24
- Requires-Dist: pandas>=0.17
25
- Requires-Dist: scikit-learn>=0.14.1
26
- Requires-Dist: progressbar33
27
- Requires-Dist: biopython>=1.65
28
- Requires-Dist: datacache>=0.4.4
29
- Requires-Dist: lxml
30
- Dynamic: license-file
31
-
32
- # PepData
33
-
34
- Look up shipped amino-acid properties and pairwise matrices, encode peptide
35
- sequences, or load peptide assay tables from IEDB. Property lookups work offline;
36
- IEDB tables require a download.
37
-
38
- ## Install
39
-
40
- ```sh
41
- python -m pip install pepdata
42
- ```
43
-
44
- Python 3.11 or later is required.
45
-
46
- ## Look up a peptide's residue properties
47
-
48
- ```python
49
- from pepdata.amino_acid_properties import hydropathy
50
-
51
- peptide = "ACD"
52
- print([hydropathy[residue] for residue in peptide])
53
- ```
54
-
55
- ```text
56
- [1.8, 2.5, -3.5]
57
- ```
58
-
59
- The values come from the shipped residue-property table. The dictionary maps
60
- single-letter residues to numeric values; it does not predict MHC binding or
61
- clinical immunogenicity. Use uppercase canonical residue letters. A missing
62
- letter raises `KeyError`.
63
-
64
- ## Find the interface you need
65
-
66
- | Task | Module or object |
67
- | --- | --- |
68
- | Single-residue properties | `pepdata.amino_acid_properties` |
69
- | BLOSUM substitution matrices | `pepdata.blosum` |
70
- | PMBEC and contact tables | `pepdata.pmbec`, `pepdata.residue_contact_energies` |
71
- | Residue alphabets | `pepdata.amino_acid_alphabet`, `pepdata.reduced_alphabet` |
72
- | N-gram features | `pepdata.PeptideVectorizer` |
73
- | MHC-binding assay tables | `pepdata.iedb.mhc` |
74
- | T-cell assay tables | `pepdata.iedb.tcell` |
75
-
76
- See [residue and pairwise tables](docs/guides/properties.md), then
77
- [peptide features and IEDB tables](docs/guides/datasets.md). The
78
- [API reference](docs/reference.md) follows those same tasks.
79
-
80
- Older pepdata documentation placed the property tables in `amino_acid` and
81
- described a `StringTransformer` interface. The property dictionaries are
82
- in `amino_acid_properties`, and there is no `StringTransformer` class.
83
-
84
- ## Documentation development
85
-
86
- Install `requirements-docs.txt`, run `./docs.sh`, then `python scripts/check_docs_examples.py`.
pepdata-1.2.4/README.md DELETED
@@ -1,55 +0,0 @@
1
- # PepData
2
-
3
- Look up shipped amino-acid properties and pairwise matrices, encode peptide
4
- sequences, or load peptide assay tables from IEDB. Property lookups work offline;
5
- IEDB tables require a download.
6
-
7
- ## Install
8
-
9
- ```sh
10
- python -m pip install pepdata
11
- ```
12
-
13
- Python 3.11 or later is required.
14
-
15
- ## Look up a peptide's residue properties
16
-
17
- ```python
18
- from pepdata.amino_acid_properties import hydropathy
19
-
20
- peptide = "ACD"
21
- print([hydropathy[residue] for residue in peptide])
22
- ```
23
-
24
- ```text
25
- [1.8, 2.5, -3.5]
26
- ```
27
-
28
- The values come from the shipped residue-property table. The dictionary maps
29
- single-letter residues to numeric values; it does not predict MHC binding or
30
- clinical immunogenicity. Use uppercase canonical residue letters. A missing
31
- letter raises `KeyError`.
32
-
33
- ## Find the interface you need
34
-
35
- | Task | Module or object |
36
- | --- | --- |
37
- | Single-residue properties | `pepdata.amino_acid_properties` |
38
- | BLOSUM substitution matrices | `pepdata.blosum` |
39
- | PMBEC and contact tables | `pepdata.pmbec`, `pepdata.residue_contact_energies` |
40
- | Residue alphabets | `pepdata.amino_acid_alphabet`, `pepdata.reduced_alphabet` |
41
- | N-gram features | `pepdata.PeptideVectorizer` |
42
- | MHC-binding assay tables | `pepdata.iedb.mhc` |
43
- | T-cell assay tables | `pepdata.iedb.tcell` |
44
-
45
- See [residue and pairwise tables](docs/guides/properties.md), then
46
- [peptide features and IEDB tables](docs/guides/datasets.md). The
47
- [API reference](docs/reference.md) follows those same tasks.
48
-
49
- Older pepdata documentation placed the property tables in `amino_acid` and
50
- described a `StringTransformer` interface. The property dictionaries are
51
- in `amino_acid_properties`, and there is no `StringTransformer` class.
52
-
53
- ## Documentation development
54
-
55
- Install `requirements-docs.txt`, run `./docs.sh`, then `python scripts/check_docs_examples.py`.
@@ -1,86 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pepdata
3
- Version: 1.2.4
4
- Summary: Immunological peptide datasets and amino acid properties
5
- Author-email: Alex Rubinsteyn <alex.rubinsteyn@mssm.edu>
6
- Project-URL: Homepage, https://github.com/openvax/pepdata
7
- Project-URL: Bug Tracker, https://github.com/openvax/pepdata/issues
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Environment :: Console
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: Apache Software License
13
- Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Programming Language :: Python :: 3.14
18
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
- Requires-Python: >=3.11
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE.txt
22
- Requires-Dist: numpy<3.0.0,>=2.0.0
23
- Requires-Dist: scipy>=0.9
24
- Requires-Dist: pandas>=0.17
25
- Requires-Dist: scikit-learn>=0.14.1
26
- Requires-Dist: progressbar33
27
- Requires-Dist: biopython>=1.65
28
- Requires-Dist: datacache>=0.4.4
29
- Requires-Dist: lxml
30
- Dynamic: license-file
31
-
32
- # PepData
33
-
34
- Look up shipped amino-acid properties and pairwise matrices, encode peptide
35
- sequences, or load peptide assay tables from IEDB. Property lookups work offline;
36
- IEDB tables require a download.
37
-
38
- ## Install
39
-
40
- ```sh
41
- python -m pip install pepdata
42
- ```
43
-
44
- Python 3.11 or later is required.
45
-
46
- ## Look up a peptide's residue properties
47
-
48
- ```python
49
- from pepdata.amino_acid_properties import hydropathy
50
-
51
- peptide = "ACD"
52
- print([hydropathy[residue] for residue in peptide])
53
- ```
54
-
55
- ```text
56
- [1.8, 2.5, -3.5]
57
- ```
58
-
59
- The values come from the shipped residue-property table. The dictionary maps
60
- single-letter residues to numeric values; it does not predict MHC binding or
61
- clinical immunogenicity. Use uppercase canonical residue letters. A missing
62
- letter raises `KeyError`.
63
-
64
- ## Find the interface you need
65
-
66
- | Task | Module or object |
67
- | --- | --- |
68
- | Single-residue properties | `pepdata.amino_acid_properties` |
69
- | BLOSUM substitution matrices | `pepdata.blosum` |
70
- | PMBEC and contact tables | `pepdata.pmbec`, `pepdata.residue_contact_energies` |
71
- | Residue alphabets | `pepdata.amino_acid_alphabet`, `pepdata.reduced_alphabet` |
72
- | N-gram features | `pepdata.PeptideVectorizer` |
73
- | MHC-binding assay tables | `pepdata.iedb.mhc` |
74
- | T-cell assay tables | `pepdata.iedb.tcell` |
75
-
76
- See [residue and pairwise tables](docs/guides/properties.md), then
77
- [peptide features and IEDB tables](docs/guides/datasets.md). The
78
- [API reference](docs/reference.md) follows those same tasks.
79
-
80
- Older pepdata documentation placed the property tables in `amino_acid` and
81
- described a `StringTransformer` interface. The property dictionaries are
82
- in `amino_acid_properties`, and there is no `StringTransformer` class.
83
-
84
- ## Documentation development
85
-
86
- Install `requirements-docs.txt`, run `./docs.sh`, then `python scripts/check_docs_examples.py`.
@@ -1,8 +0,0 @@
1
- numpy<3.0.0,>=2.0.0
2
- scipy>=0.9
3
- pandas>=0.17
4
- scikit-learn>=0.14.1
5
- progressbar33
6
- biopython>=1.65
7
- datacache>=0.4.4
8
- lxml
@@ -1,17 +0,0 @@
1
- from pepdata.blosum import (
2
- blosum30_dict,
3
- blosum30_matrix,
4
- blosum50_dict,
5
- blosum50_matrix,
6
- blosum62_dict,
7
- blosum62_matrix
8
- )
9
-
10
- def test_blosum30():
11
- pass
12
-
13
- def test_blosum50():
14
- pass
15
-
16
- def test_blosum62():
17
- pass
@@ -1,61 +0,0 @@
1
- # Copyright (c) 2014. Mount Sinai School of Medicine
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- import pickle
16
-
17
- from pepdata import PeptideVectorizer
18
-
19
- # isoforms of two different proteins a, b
20
-
21
- a1 = (
22
- "MSPHPTALLGLVLCLAQTIHTQEEDLPRPSISAEPGTVIPLGSHVTFVCRGPVGVQTFRLERESRSTYND"
23
- "TEDVSQASPSESEARFRIDSVSEGNAGPYRCIYYKPPKWSEQSDYLELLVKETSGGPDSPDTEPGSSAGPT"
24
- "QRPSDNSHNEHAPASQGLKAEHLYILIGVSVVFLFCLLLLVLFCLHRQNQIKQGPPRSKDEEQKPQQRPDL"
25
- "AVDVLERTADKATVNGLPEKDRETDTSALAAGSSQEVTYAQLDHWALTQRTARAVSPQSTKPMAESITYAA"
26
- "VARH"
27
- )
28
-
29
- a2 = (
30
- "MSLMVVSMACVGFFLLQGAWPHEGVHRKPSLLAHPGPLVKSEETVILQCWSDVRFEHFLLHREGKYKDTLH"
31
- "LIGEHHDGVSKANFSIGPMMQDLAGTYRCYGSVTHSPYQLSAPSDPLDIVITGLYEKPSLSAQPGPTVLAG"
32
- "ESVTLSCSSRSSYDMYHLSREGEAHERRFSAGPKVNGTFQADFPLGPATHGGTYRCFGSFRDSPYEWSNSS"
33
- "DPLLVSVTGNPSNSWPSPTEPSSKTGNPRHLHVLIGTSVVKIPFTILLFFLLHRWCSNKKNAAVMDQEPAG"
34
- "NRTVNSEDSDEQDHQEVSYA"
35
- )
36
-
37
- a3 = (
38
- "MSLMVVSMACVGFFLLEGPWPHVGGQDKPFLSAWPGTVVSEGQHVTLQCRSRLGFNEFSLSKEDGMPVPEL"
39
- "YNRIFRNSFLMGPVTPAHAGTYRCCSSHPHSPTGWSAPSNPVVIMVTGVHRKPSLLAHPGPLVKSEETVIL"
40
- "QCWSDVRFEHFLLHREGKYKDTLHLIGEHHDGVSKANFSIGPMMQDLAGTYRCYGSVTHSPYQLSAPSDPL"
41
- "DIVITGLYEKPSLSAQPGPTVLAGESVTLSCSSRSSYDMYHLSREGEAHERRFSAGPKVNGTFQADFPLGP"
42
- "ATHGGTYRCFGSFRDSPYEWSNSSDPLLVSVTAFLSVKSSGHKYIY"
43
- )
44
-
45
- A = [a1, a2, a3]
46
-
47
- b1 = (
48
- "MPKGRAGSLPTTSIGWRFQLWFLGLTCPERHLARRLKNNSFYPFVQQEPNVFVLEYYLDTLWKGMLLFII"
49
- "SVVLVSFSSLREVQKQETWVFLVYGVGVGLWLVISSLPRRRLVLNHTRGVYHFSIQGRTVCQGPLHLVYV"
50
- "RLALSSDAHGRCFFHLVLGGHRLEPLVLVQLSEHYEQMEYLGRYIARKLNINYFDYLATSYRHVVRHWPP"
51
- "PGAGTVMGKSPMGHKPSSSQSSLEV"
52
- )
53
-
54
- b2 = (
55
- "MPKGRAGSLPTTSIGWRFQLWFLGLTCPERHLARRLKNNSFYPFVQQEPNVFVLEYYLDTLWKGMLLFII"
56
- "SVVLVSFSSLREVQKQETWVFLVYGVGVGLWLVISSLPRRRLVLNHTRGVYHFSIQGRTVCQGPLHLVYV"
57
- "RLALSSDAHGRCFFHLVLGGHRLEPLVLVQLSEHYEQMEYLGRYIARKLNINYFDYLATSYRHVVRHWPPP"
58
- "GAGTVMGKSPMGHKPSSSQSSLEV"
59
- )
60
-
61
- B = [b1, b2]
@@ -1,7 +0,0 @@
1
- from pepdata.pmbec import (
2
- pmbec_dict,
3
- pmbec_matrix,
4
- )
5
-
6
- def test_pmbec():
7
- pass
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