seqtree 0.0.3__tar.gz → 0.2.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 (46) hide show
  1. {seqtree-0.0.3 → seqtree-0.2.0}/PKG-INFO +11 -5
  2. {seqtree-0.0.3 → seqtree-0.2.0}/README.md +10 -4
  3. {seqtree-0.0.3 → seqtree-0.2.0}/include/seqtree/seqtree.hpp +7 -6
  4. {seqtree-0.0.3 → seqtree-0.2.0}/pyproject.toml +1 -1
  5. {seqtree-0.0.3 → seqtree-0.2.0}/src/_bindings.cpp +54 -19
  6. seqtree-0.2.0/src/pam100.inc +31 -0
  7. seqtree-0.2.0/src/pam250.inc +31 -0
  8. seqtree-0.2.0/src/structural.inc +31 -0
  9. {seqtree-0.0.3 → seqtree-0.2.0}/src/substitution_matrix.cpp +13 -3
  10. seqtree-0.0.3/src/pam50.inc +0 -32
  11. {seqtree-0.0.3 → seqtree-0.2.0}/.gitattributes +0 -0
  12. {seqtree-0.0.3 → seqtree-0.2.0}/.gitignore +0 -0
  13. {seqtree-0.0.3 → seqtree-0.2.0}/CMakeLists.txt +0 -0
  14. {seqtree-0.0.3 → seqtree-0.2.0}/LICENSE +0 -0
  15. {seqtree-0.0.3 → seqtree-0.2.0}/ROADMAP.md +0 -0
  16. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/.gitignore +0 -0
  17. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/.latexmkrc +0 -0
  18. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/Makefile +0 -0
  19. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/epitope_detection.pdf +0 -0
  20. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/evalue.pdf +0 -0
  21. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/evalue.tex +0 -0
  22. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/evalue_matrix.pdf +0 -0
  23. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/mhc1_rocpr.pdf +0 -0
  24. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/mhc2_rocpr.pdf +0 -0
  25. {seqtree-0.0.3 → seqtree-0.2.0}/appendix/refs.bib +0 -0
  26. {seqtree-0.0.3 → seqtree-0.2.0}/include/seqtree/kmer_index.hpp +0 -0
  27. {seqtree-0.0.3 → seqtree-0.2.0}/include/seqtree/types.hpp +0 -0
  28. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/__init__.py +0 -0
  29. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/control.py +0 -0
  30. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/data/control_human_trb_aa.txt.gz +0 -0
  31. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/evalue.py +0 -0
  32. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/layout.py +0 -0
  33. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/pmhc.py +0 -0
  34. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/pmhc_evalue.py +0 -0
  35. {seqtree-0.0.3 → seqtree-0.2.0}/python/seqtree/py.typed +0 -0
  36. {seqtree-0.0.3 → seqtree-0.2.0}/src/blosum62.inc +0 -0
  37. {seqtree-0.0.3 → seqtree-0.2.0}/src/codec.cpp +0 -0
  38. {seqtree-0.0.3 → seqtree-0.2.0}/src/engine_seqtm.cpp +0 -0
  39. {seqtree-0.0.3 → seqtree-0.2.0}/src/engine_seqtrie.cpp +0 -0
  40. {seqtree-0.0.3 → seqtree-0.2.0}/src/engines.hpp +0 -0
  41. {seqtree-0.0.3 → seqtree-0.2.0}/src/index.cpp +0 -0
  42. {seqtree-0.0.3 → seqtree-0.2.0}/src/kmer_index.cpp +0 -0
  43. {seqtree-0.0.3 → seqtree-0.2.0}/src/positional_matrix.cpp +0 -0
  44. {seqtree-0.0.3 → seqtree-0.2.0}/src/searcher.cpp +0 -0
  45. {seqtree-0.0.3 → seqtree-0.2.0}/src/trie.cpp +0 -0
  46. {seqtree-0.0.3 → seqtree-0.2.0}/src/trie.hpp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: seqtree
3
- Version: 0.0.3
3
+ Version: 0.2.0
4
4
  Summary: Fast fuzzy search over biological sequences (C++ core, Python bindings)
5
5
  Keywords: sequence-search,fuzzy-matching,CDR3,immunology,bioinformatics,trie
6
6
  Author-Email: ISALGO laboratory <mikhail.shugay@gmail.com>
@@ -35,9 +35,9 @@ Description-Content-Type: text/markdown
35
35
 
36
36
  [![PyPI](https://img.shields.io/pypi/v/seqtree.svg)](https://pypi.org/project/seqtree/)
37
37
  [![Python](https://img.shields.io/pypi/pyversions/seqtree.svg)](https://pypi.org/project/seqtree/)
38
- [![License](https://img.shields.io/pypi/l/seqtree.svg)](LICENSE)
38
+ [![License](https://img.shields.io/badge/license-GPLv3-green)](LICENSE)
39
39
  [![CI](https://github.com/antigenomics/seqtree/actions/workflows/ci.yml/badge.svg)](https://github.com/antigenomics/seqtree/actions/workflows/ci.yml)
40
- [![Docs](https://github.com/antigenomics/seqtree/actions/workflows/docs.yml/badge.svg)](https://antigenomics.github.io/seqtree/)
40
+ [![Docs](https://github.com/antigenomics/seqtree/actions/workflows/docs.yml/badge.svg?branch=dev)](https://antigenomics.github.io/seqtree/)
41
41
 
42
42
  Fast fuzzy search over biological sequences (amino-acid or nucleotide), as a C++
43
43
  core with a minimal Python binding. Build an immutable index once, then search
@@ -58,8 +58,14 @@ to their own payloads (V gene, MHC, counts) and filter.
58
58
 
59
59
  Beyond search, seqtree ships:
60
60
 
61
- - **Substitution matrices** — built-in `BLOSUM62` and `PAM50`, plus custom matrices via
62
- `SubstitutionMatrix.from_similarity` (Gram-distance penalty `s(a,a)+s(b,b)−2·s(a,b)`).
61
+ - **Substitution matrices** — built-in `identity`, `BLOSUM62`, `PAM250`, `PAM100`, and `structural`
62
+ a **Miyazawa–Jernigan interaction-strength** matrix: each residue's strength `q(a)=mean_b e(a,b)`
63
+ is read off the MJ contact potential, so substitutions between residues of like interaction strength
64
+ are cheap. It separates strong (hydrophobic `F W C L Y M I V`) from weak (polar/charged
65
+ `S Q D E K`) interactors — the strong/weak-interactor axis of TCR-recognition models
66
+ ([Košmrlj et al., *PNAS* 2008](https://doi.org/10.1073/pnas.0808081105); MJ contact energies from
67
+ Miyazawa & Jernigan, *J Mol Biol* 1996) — letting dissimilar-but-chemically-equivalent loops align.
68
+ Plus custom matrices via `SubstitutionMatrix.from_similarity` (Gram penalty `s(a,a)+s(b,b)−2·s(a,b)`).
63
69
  - **E-values / significance** — calibrate hit counts against a background control repertoire
64
70
  (`load_control` + `evalues`), the TCRNET approach on a finite-sample footing. See the
65
71
  [E-value guide](https://antigenomics.github.io/seqtree/evalue.html).
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![PyPI](https://img.shields.io/pypi/v/seqtree.svg)](https://pypi.org/project/seqtree/)
4
4
  [![Python](https://img.shields.io/pypi/pyversions/seqtree.svg)](https://pypi.org/project/seqtree/)
5
- [![License](https://img.shields.io/pypi/l/seqtree.svg)](LICENSE)
5
+ [![License](https://img.shields.io/badge/license-GPLv3-green)](LICENSE)
6
6
  [![CI](https://github.com/antigenomics/seqtree/actions/workflows/ci.yml/badge.svg)](https://github.com/antigenomics/seqtree/actions/workflows/ci.yml)
7
- [![Docs](https://github.com/antigenomics/seqtree/actions/workflows/docs.yml/badge.svg)](https://antigenomics.github.io/seqtree/)
7
+ [![Docs](https://github.com/antigenomics/seqtree/actions/workflows/docs.yml/badge.svg?branch=dev)](https://antigenomics.github.io/seqtree/)
8
8
 
9
9
  Fast fuzzy search over biological sequences (amino-acid or nucleotide), as a C++
10
10
  core with a minimal Python binding. Build an immutable index once, then search
@@ -25,8 +25,14 @@ to their own payloads (V gene, MHC, counts) and filter.
25
25
 
26
26
  Beyond search, seqtree ships:
27
27
 
28
- - **Substitution matrices** — built-in `BLOSUM62` and `PAM50`, plus custom matrices via
29
- `SubstitutionMatrix.from_similarity` (Gram-distance penalty `s(a,a)+s(b,b)−2·s(a,b)`).
28
+ - **Substitution matrices** — built-in `identity`, `BLOSUM62`, `PAM250`, `PAM100`, and `structural`
29
+ a **Miyazawa–Jernigan interaction-strength** matrix: each residue's strength `q(a)=mean_b e(a,b)`
30
+ is read off the MJ contact potential, so substitutions between residues of like interaction strength
31
+ are cheap. It separates strong (hydrophobic `F W C L Y M I V`) from weak (polar/charged
32
+ `S Q D E K`) interactors — the strong/weak-interactor axis of TCR-recognition models
33
+ ([Košmrlj et al., *PNAS* 2008](https://doi.org/10.1073/pnas.0808081105); MJ contact energies from
34
+ Miyazawa & Jernigan, *J Mol Biol* 1996) — letting dissimilar-but-chemically-equivalent loops align.
35
+ Plus custom matrices via `SubstitutionMatrix.from_similarity` (Gram penalty `s(a,a)+s(b,b)−2·s(a,b)`).
30
36
  - **E-values / significance** — calibrate hit counts against a background control repertoire
31
37
  (`load_control` + `evalues`), the TCRNET approach on a finite-sample footing. See the
32
38
  [E-value guide](https://antigenomics.github.io/seqtree/evalue.html).
@@ -33,14 +33,15 @@ private:
33
33
  // Non-negative substitution penalties indexed by alphabet code; penalty(a,a)==0.
34
34
  class SubstitutionMatrix {
35
35
  public:
36
- // Unit cost: 0 for a match, 1 for a mismatch.
36
+ // Unit cost: 0 for a match, 1 for a mismatch (this is the "identity" matrix).
37
37
  static SubstitutionMatrix unit(uint8_t size);
38
- // BLOSUM62 converted to penalties; valid only for the AminoAcid codec order.
38
+ // Built-in amino-acid matrices (valid only for the AminoAcid codec order).
39
39
  static SubstitutionMatrix blosum62();
40
- // PAM50 (EMBOSS EPAM50) converted to penalties; AminoAcid codec order.
41
- static SubstitutionMatrix pam50();
42
- // Convert a similarity matrix (row-major, size*size) to penalties via
43
- // pen[a][b] = max(sim[a][a], sim[b][b]) - sim[a][b].
40
+ static SubstitutionMatrix pam250(); // EMBOSS EPAM250 (NCBI log-odds)
41
+ static SubstitutionMatrix pam100(); // EMBOSS EPAM100 (NCBI log-odds)
42
+ static SubstitutionMatrix structural(); // Miyazawa-Jernigan interaction-strength similarity
43
+ // Convert a similarity matrix (row-major, size*size) to penalties via the Gram /
44
+ // squared-distance transform pen[a][b] = sim[a][a] + sim[b][b] - 2*sim[a][b].
44
45
  static SubstitutionMatrix from_similarity(uint8_t size, const int32_t* sim);
45
46
 
46
47
  uint8_t size() const { return size_; }
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "seqtree"
7
- version = "0.0.3"
7
+ version = "0.2.0"
8
8
  description = "Fast fuzzy search over biological sequences (C++ core, Python bindings)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -19,7 +19,7 @@ struct PyParams {
19
19
  int max_subs = 0, max_ins = 0, max_dels = 0, max_total_edits = 0;
20
20
  long max_penalty = 0;
21
21
  int gap_open = 1, gap_extend = 1;
22
- std::string matrix; // named builtin: "" (unit), "blosum62", "pam50"
22
+ std::string matrix; // named builtin: "" (unit/identity), blosum62/pam250/pam100/structural
23
23
  std::optional<SubstitutionMatrix> matrix_obj; // explicit/custom matrix (overrides name)
24
24
  std::optional<PositionalMatrix> pos_matrix_obj; // per-position penalties (Hamming path)
25
25
  std::string engine = "auto"; // auto | seqtrie | seqtm
@@ -63,6 +63,25 @@ std::string alphabet_symbols(Alphabet a) {
63
63
  return s;
64
64
  }
65
65
 
66
+ // Built-in matrix names. "identity" is the unit matrix (any alphabet); the rest are
67
+ // amino-acid only. Keep this list in sync with the SubstitutionMatrix factories.
68
+ constexpr const char* kMatrixNames = "'identity', 'BLOSUM62', 'PAM250', 'PAM100', 'structural'";
69
+
70
+ bool is_matrix_name(const std::string& l) {
71
+ return l.empty() || l == "identity" || l == "blosum62" || l == "pam250"
72
+ || l == "pam100" || l == "structural";
73
+ }
74
+
75
+ SubstitutionMatrix named_matrix(const std::string& l, Alphabet a) {
76
+ if (l == "identity") return SubstitutionMatrix::unit(Codec(a).size());
77
+ if (a != Alphabet::AminoAcid)
78
+ throw py::value_error(l + " requires the amino-acid alphabet");
79
+ if (l == "blosum62") return SubstitutionMatrix::blosum62();
80
+ if (l == "pam250") return SubstitutionMatrix::pam250();
81
+ if (l == "pam100") return SubstitutionMatrix::pam100();
82
+ return SubstitutionMatrix::structural(); // l == "structural"
83
+ }
84
+
66
85
  // Returns nullopt for unit cost; throws for an unknown name or alphabet mismatch.
67
86
  // An explicit matrix object (custom or built via SubstitutionMatrix factories) wins
68
87
  // over the named builtin; we only check that its size matches the alphabet.
@@ -74,26 +93,22 @@ std::optional<SubstitutionMatrix> make_matrix(const PyParams& pp, Alphabet a) {
74
93
  }
75
94
  if (pp.matrix.empty()) return std::nullopt;
76
95
  std::string l = lower(pp.matrix);
77
- if (l == "blosum62" || l == "pam50") {
78
- if (a != Alphabet::AminoAcid)
79
- throw py::value_error(pp.matrix + " requires the amino-acid alphabet");
80
- return l == "blosum62" ? SubstitutionMatrix::blosum62() : SubstitutionMatrix::pam50();
81
- }
82
- throw py::value_error("unknown matrix '" + pp.matrix +
83
- "' (use '', 'BLOSUM62', 'PAM50', or a SubstitutionMatrix)");
96
+ if (!is_matrix_name(l))
97
+ throw py::value_error("unknown matrix '" + pp.matrix + "' (use '', " +
98
+ kMatrixNames + ", or a SubstitutionMatrix)");
99
+ return named_matrix(l, a);
84
100
  }
85
101
 
86
- // Accept either a builtin name ("", "blosum62", "pam50") or a SubstitutionMatrix.
102
+ // Accept either a builtin name (see kMatrixNames) or a SubstitutionMatrix.
87
103
  void set_matrix(PyParams& p, const py::object& m) {
88
104
  p.matrix.clear();
89
105
  p.matrix_obj.reset();
90
106
  if (m.is_none()) return;
91
107
  if (py::isinstance<py::str>(m)) {
92
108
  std::string name = m.cast<std::string>();
93
- std::string l = lower(name);
94
- if (!(l.empty() || l == "blosum62" || l == "pam50"))
95
- throw py::value_error("unknown matrix '" + name +
96
- "' (use '', 'BLOSUM62', 'PAM50', or a SubstitutionMatrix)");
109
+ if (!is_matrix_name(lower(name)))
110
+ throw py::value_error("unknown matrix '" + name + "' (use '', " +
111
+ kMatrixNames + ", or a SubstitutionMatrix)");
97
112
  p.matrix = std::move(name);
98
113
  } else if (py::isinstance<SubstitutionMatrix>(m)) {
99
114
  p.matrix_obj = m.cast<SubstitutionMatrix>();
@@ -190,11 +205,14 @@ PYBIND11_MODULE(_core, m) {
190
205
 
191
206
  py::class_<SubstitutionMatrix>(m, "SubstitutionMatrix",
192
207
  "Non-negative substitution penalties (penalty(a,a)==0). Build a "
193
- "named builtin (``blosum62``/``pam50``) or a custom one from a "
194
- "similarity grid whose row/column order matches "
195
- "``amino_acids()`` (or ``alphabet_symbols(alphabet)``).")
208
+ "named builtin (``blosum62``/``pam250``/``pam100``/``structural``, "
209
+ "or ``unit`` for identity) or a custom one from a similarity grid "
210
+ "whose row/column order matches ``amino_acids()`` (or "
211
+ "``alphabet_symbols(alphabet)``).")
196
212
  .def_static("blosum62", &SubstitutionMatrix::blosum62)
197
- .def_static("pam50", &SubstitutionMatrix::pam50)
213
+ .def_static("pam250", &SubstitutionMatrix::pam250)
214
+ .def_static("pam100", &SubstitutionMatrix::pam100)
215
+ .def_static("structural", &SubstitutionMatrix::structural)
198
216
  .def_static("unit", &SubstitutionMatrix::unit, py::arg("size"))
199
217
  .def_static(
200
218
  "from_similarity",
@@ -214,6 +232,23 @@ PYBIND11_MODULE(_core, m) {
214
232
  "penalties via max(sim[a,a], sim[b,b]) - sim[a,b]. Row/column order must match the "
215
233
  "target alphabet's symbol order (see ``amino_acids()``).")
216
234
  .def("size", &SubstitutionMatrix::size)
235
+ .def(
236
+ "penalty",
237
+ [](const SubstitutionMatrix& self, const std::string& a, const std::string& b) {
238
+ if (a.size() != 1 || b.size() != 1)
239
+ throw py::value_error("penalty() takes two single amino-acid characters");
240
+ static const std::string aa = alphabet_symbols(Alphabet::AminoAcid);
241
+ auto ia = aa.find(a[0]), ib = aa.find(b[0]);
242
+ if (ia == std::string::npos || ib == std::string::npos)
243
+ throw py::value_error("unknown amino acid; expected one of " + aa);
244
+ if (ia >= self.size() || ib >= self.size())
245
+ throw py::value_error("residue out of range for this matrix's alphabet");
246
+ return self.penalty(uint8_t(ia), uint8_t(ib));
247
+ },
248
+ py::arg("a"), py::arg("b"),
249
+ "Gram-distance substitution penalty between two amino acids: 0 when identical, "
250
+ "larger when more dissimilar (s(a,a)+s(b,b)-2 s(a,b)). Characters use the "
251
+ "``amino_acids()`` order.")
217
252
  .def("__repr__", [](const SubstitutionMatrix& s) {
218
253
  return "SubstitutionMatrix(size=" + std::to_string(s.size()) + ")";
219
254
  });
@@ -242,12 +277,12 @@ PYBIND11_MODULE(_core, m) {
242
277
  py::arg("alphabet") = "aa",
243
278
  "Symbols in code order for an alphabet; custom matrices must follow this order.");
244
279
  m.def("amino_acids", [] { return alphabet_symbols(Alphabet::AminoAcid); },
245
- "The amino-acid symbol order used by BLOSUM62 / PAM50 and custom AA matrices.");
280
+ "The amino-acid symbol order used by the built-in matrices and custom AA matrices.");
246
281
 
247
282
  py::class_<PyParams>(m, "SearchParams",
248
283
  "Search scope and budget. Scope: max_subs/max_ins/max_dels (exact, "
249
284
  "seqtm) and max_total_edits. Budget: max_penalty with an optional "
250
- "matrix ('BLOSUM62') and gap costs. engine is 'auto'|'seqtrie'|'seqtm', "
285
+ "matrix (identity/BLOSUM62/PAM250/PAM100/structural) and gap costs. engine is 'auto'|'seqtrie'|'seqtm', "
251
286
  "mode is 'all'|'top'.")
252
287
  .def(py::init([](int max_subs, int max_ins, int max_dels, int max_total_edits,
253
288
  long max_penalty, py::object matrix, int gap_open, int gap_extend,
@@ -0,0 +1,31 @@
1
+ // PAM100 (EMBOSS EPAM100, NCBI log-odds; similarity).
2
+ // Row/column order: A R N D C Q E G H I L K M F P S T W Y V B Z X *
3
+ // Generated by bench/gen_matrices.py -- do not edit by hand.
4
+ static const int32_t kPam100Size = 24;
5
+ static const int32_t kPam100[24 * 24] = {
6
+ // A R N D C Q E G H I L K M F P S T W Y V B Z X *
7
+ 4, -3, -1, -1, -3, -2, 0, 1, -3, -2, -3, -3, -2, -5, 1, 1, 1, -7, -4, 0, -1, -1, -1, -9,
8
+ -3, 7, -2, -4, -5, 1, -3, -5, 1, -3, -5, 2, -1, -6, -1, -1, -3, 1, -6, -4, -3, -1, -2, -9,
9
+ -1, -2, 5, 3, -5, -1, 1, -1, 2, -3, -4, 1, -4, -5, -2, 1, 0, -5, -2, -3, 4, 0, -1, -9,
10
+ -1, -4, 3, 5, -7, 0, 4, -1, -1, -4, -6, -1, -5, -8, -3, -1, -2, -9, -6, -4, 4, 3, -2, -9,
11
+ -3, -5, -5, -7, 9, -8, -8, -5, -4, -3, -8, -8, -7, -7, -4, -1, -4, -9, -1, -3, -6, -8, -5, -9,
12
+ -2, 1, -1, 0, -8, 6, 2, -3, 3, -4, -2, 0, -2, -7, -1, -2, -2, -7, -6, -3, 0, 5, -2, -9,
13
+ 0, -3, 1, 4, -8, 2, 5, -1, -1, -3, -5, -1, -4, -8, -2, -1, -2, -9, -5, -3, 3, 4, -2, -9,
14
+ 1, -5, -1, -1, -5, -3, -1, 5, -4, -5, -6, -3, -4, -6, -2, 0, -2, -9, -7, -3, -1, -2, -2, -9,
15
+ -3, 1, 2, -1, -4, 3, -1, -4, 7, -4, -3, -2, -4, -3, -1, -2, -3, -4, -1, -3, 1, 1, -2, -9,
16
+ -2, -3, -3, -4, -3, -4, -3, -5, -4, 6, 1, -3, 1, 0, -4, -3, 0, -7, -3, 3, -3, -3, -2, -9,
17
+ -3, -5, -4, -6, -8, -2, -5, -6, -3, 1, 6, -4, 3, 0, -4, -4, -3, -3, -3, 0, -5, -4, -3, -9,
18
+ -3, 2, 1, -1, -8, 0, -1, -3, -2, -3, -4, 5, 0, -7, -3, -1, -1, -6, -6, -4, 0, -1, -2, -9,
19
+ -2, -1, -4, -5, -7, -2, -4, -4, -4, 1, 3, 0, 9, -1, -4, -3, -1, -6, -5, 1, -4, -2, -2, -9,
20
+ -5, -6, -5, -8, -7, -7, -8, -6, -3, 0, 0, -7, -1, 8, -6, -4, -5, -1, 4, -3, -6, -7, -4, -9,
21
+ 1, -1, -2, -3, -4, -1, -2, -2, -1, -4, -4, -3, -4, -6, 7, 0, -1, -7, -7, -3, -3, -1, -2, -9,
22
+ 1, -1, 1, -1, -1, -2, -1, 0, -2, -3, -4, -1, -3, -4, 0, 4, 2, -3, -4, -2, 0, -2, -1, -9,
23
+ 1, -3, 0, -2, -4, -2, -2, -2, -3, 0, -3, -1, -1, -5, -1, 2, 5, -7, -4, 0, -1, -2, -1, -9,
24
+ -7, 1, -5, -9, -9, -7, -9, -9, -4, -7, -3, -6, -6, -1, -7, -3, -7, 12, -2, -9, -6, -8, -6, -9,
25
+ -4, -6, -2, -6, -1, -6, -5, -7, -1, -3, -3, -6, -5, 4, -7, -4, -4, -2, 9, -4, -4, -6, -4, -9,
26
+ 0, -4, -3, -4, -3, -3, -3, -3, -3, 3, 0, -4, 1, -3, -3, -2, 0, -9, -4, 5, -4, -3, -2, -9,
27
+ -1, -3, 4, 4, -6, 0, 3, -1, 1, -3, -5, 0, -4, -6, -3, 0, -1, -6, -4, -4, 4, 2, -2, -9,
28
+ -1, -1, 0, 3, -8, 5, 4, -2, 1, -3, -4, -1, -2, -7, -1, -2, -2, -8, -6, -3, 2, 5, -2, -9,
29
+ -1, -2, -1, -2, -5, -2, -2, -2, -2, -2, -3, -2, -2, -4, -2, -1, -1, -6, -4, -2, -2, -2, -2, -9,
30
+ -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 1,
31
+ };
@@ -0,0 +1,31 @@
1
+ // PAM250 (EMBOSS EPAM250, NCBI log-odds; similarity).
2
+ // Row/column order: A R N D C Q E G H I L K M F P S T W Y V B Z X *
3
+ // Generated by bench/gen_matrices.py -- do not edit by hand.
4
+ static const int32_t kPam250Size = 24;
5
+ static const int32_t kPam250[24 * 24] = {
6
+ // A R N D C Q E G H I L K M F P S T W Y V B Z X *
7
+ 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3, 0, 0, 0, 0, -8,
8
+ -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4, -2, -1, 0, -1, -8,
9
+ 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2, 2, 1, 0, -8,
10
+ 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4, -2, 3, 3, -1, -8,
11
+ -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2, -8, 0, -2, -4, -5, -3, -8,
12
+ 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4, -2, 1, 3, -1, -8,
13
+ 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4, -2, 3, 3, -1, -8,
14
+ 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5, -1, 0, 0, -1, -8,
15
+ -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0, -2, 1, 2, -1, -8,
16
+ -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5, -1, 4, -2, -2, -1, -8,
17
+ -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2, -1, 2, -3, -3, -1, -8,
18
+ -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4, -2, 1, 0, -1, -8,
19
+ -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4, -2, 2, -2, -2, -1, -8,
20
+ -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0, 7, -1, -4, -5, -2, -8,
21
+ 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5, -1, -1, 0, -1, -8,
22
+ 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3, -1, 0, 0, 0, -8,
23
+ 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3, 0, 0, -1, 0, -8,
24
+ -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5, 17, 0, -6, -5, -6, -4, -8,
25
+ -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0, 10, -2, -3, -4, -2, -8,
26
+ 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6, -2, 4, -2, -2, -1, -8,
27
+ 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3, -2, 3, 2, -1, -8,
28
+ 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4, -2, 2, 3, -1, -8,
29
+ 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4, -2, -1, -1, -1, -1, -8,
30
+ -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, 1,
31
+ };
@@ -0,0 +1,31 @@
1
+ // Miyazawa-Jernigan interaction-strength similarity (strong/weak interactors; 0..10).
2
+ // Row/column order: A R N D C Q E G H I L K M F P S T W Y V B Z X *
3
+ // Generated by bench/gen_matrices.py -- do not edit by hand.
4
+ static const int32_t kStructuralSize = 24;
5
+ static const int32_t kStructural[24 * 24] = {
6
+ // A R N D C Q E G H I L K M F P S T W Y V B Z X *
7
+ 10, 9, 9, 7, 6, 8, 7, 10, 9, 6, 6, 5, 6, 5, 9, 8, 9, 6, 6, 7, 8, 7, 7, 0,
8
+ 9, 10, 10, 8, 4, 9, 8, 8, 8, 5, 4, 6, 5, 4, 10, 10, 9, 4, 5, 6, 9, 9, 7, 0,
9
+ 9, 10, 10, 8, 4, 9, 8, 8, 8, 5, 4, 6, 5, 4, 10, 10, 9, 4, 5, 6, 9, 9, 7, 0,
10
+ 7, 8, 8, 10, 3, 9, 10, 7, 6, 3, 3, 8, 3, 2, 8, 9, 8, 3, 3, 4, 9, 9, 6, 0,
11
+ 6, 4, 4, 3, 10, 4, 2, 6, 7, 9, 10, 1, 9, 9, 4, 4, 5, 10, 10, 8, 4, 3, 6, 0,
12
+ 8, 9, 9, 9, 4, 10, 9, 8, 7, 4, 4, 7, 4, 3, 9, 10, 9, 3, 4, 5, 9, 9, 7, 0,
13
+ 7, 8, 8, 10, 2, 9, 10, 6, 6, 3, 2, 8, 3, 2, 8, 8, 7, 2, 3, 4, 9, 9, 6, 0,
14
+ 10, 8, 8, 7, 6, 8, 6, 10, 9, 7, 6, 5, 6, 5, 8, 8, 9, 6, 6, 8, 8, 7, 7, 0,
15
+ 9, 8, 8, 6, 7, 7, 6, 9, 10, 7, 7, 4, 7, 6, 8, 7, 8, 6, 7, 8, 7, 6, 7, 0,
16
+ 6, 5, 5, 3, 9, 4, 3, 7, 7, 10, 9, 1, 10, 9, 5, 5, 6, 9, 10, 9, 4, 4, 7, 0,
17
+ 6, 4, 4, 3, 10, 4, 2, 6, 7, 9, 10, 1, 10, 9, 4, 4, 5, 10, 10, 8, 4, 3, 6, 0,
18
+ 5, 6, 6, 8, 1, 7, 8, 5, 4, 1, 1, 10, 1, 0, 6, 6, 6, 0, 1, 2, 7, 8, 4, 0,
19
+ 6, 5, 5, 3, 9, 4, 3, 6, 7, 10, 10, 1, 10, 9, 5, 5, 5, 9, 10, 9, 4, 4, 7, 0,
20
+ 5, 4, 4, 2, 9, 3, 2, 5, 6, 9, 9, 0, 9, 10, 4, 4, 4, 10, 9, 8, 3, 2, 6, 0,
21
+ 9, 10, 10, 8, 4, 9, 8, 8, 8, 5, 4, 6, 5, 4, 10, 10, 9, 4, 5, 6, 9, 9, 7, 0,
22
+ 8, 10, 10, 9, 4, 10, 8, 8, 7, 5, 4, 6, 5, 4, 10, 10, 9, 4, 4, 6, 9, 9, 7, 0,
23
+ 9, 9, 9, 8, 5, 9, 7, 9, 8, 6, 5, 6, 5, 4, 9, 9, 10, 5, 5, 7, 9, 8, 7, 0,
24
+ 6, 4, 4, 3, 10, 3, 2, 6, 6, 9, 10, 0, 9, 10, 4, 4, 5, 10, 9, 8, 3, 3, 6, 0,
25
+ 6, 5, 5, 3, 10, 4, 3, 6, 7, 10, 10, 1, 10, 9, 5, 4, 5, 9, 10, 9, 4, 3, 6, 0,
26
+ 7, 6, 6, 4, 8, 5, 4, 8, 8, 9, 8, 2, 9, 8, 6, 6, 7, 8, 9, 10, 5, 5, 7, 0,
27
+ 8, 9, 9, 9, 4, 9, 9, 8, 7, 4, 4, 7, 4, 3, 9, 9, 9, 3, 4, 5, 9, 9, 7, 0,
28
+ 7, 9, 9, 9, 3, 9, 9, 7, 6, 4, 3, 8, 4, 2, 9, 9, 8, 3, 3, 5, 9, 9, 6, 0,
29
+ 7, 7, 7, 6, 6, 7, 6, 7, 7, 7, 6, 4, 7, 6, 7, 7, 7, 6, 6, 7, 7, 6, 7, 0,
30
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
31
+ };
@@ -3,7 +3,9 @@
3
3
  namespace seqtree {
4
4
 
5
5
  #include "blosum62.inc"
6
- #include "pam50.inc"
6
+ #include "pam250.inc"
7
+ #include "pam100.inc"
8
+ #include "structural.inc"
7
9
 
8
10
  SubstitutionMatrix SubstitutionMatrix::unit(uint8_t size) {
9
11
  SubstitutionMatrix m;
@@ -34,8 +36,16 @@ SubstitutionMatrix SubstitutionMatrix::blosum62() {
34
36
  return from_similarity(static_cast<uint8_t>(kBlosum62Size), kBlosum62);
35
37
  }
36
38
 
37
- SubstitutionMatrix SubstitutionMatrix::pam50() {
38
- return from_similarity(static_cast<uint8_t>(kPam50Size), kPam50);
39
+ SubstitutionMatrix SubstitutionMatrix::pam250() {
40
+ return from_similarity(static_cast<uint8_t>(kPam250Size), kPam250);
41
+ }
42
+
43
+ SubstitutionMatrix SubstitutionMatrix::pam100() {
44
+ return from_similarity(static_cast<uint8_t>(kPam100Size), kPam100);
45
+ }
46
+
47
+ SubstitutionMatrix SubstitutionMatrix::structural() {
48
+ return from_similarity(static_cast<uint8_t>(kStructuralSize), kStructural);
39
49
  }
40
50
 
41
51
  } // namespace seqtree
@@ -1,32 +0,0 @@
1
- // PAM50 substitution scores (similarity, higher = more similar).
2
- // Row/column order: A R N D C Q E G H I L K M F P S T W Y V B Z X *
3
- // EMBOSS EPAM50 (PAM 50, scale = ln(2)/2). Converted to non-negative penalties at load.
4
- // Generated by bench/gen_pam50.py -- do not edit by hand.
5
- static const int32_t kPam50Size = 24;
6
- static const int32_t kPam50[24 * 24] = {
7
- // A R N D C Q E G H I L K M F P S T W Y V B Z X *
8
- 5, -5, -2, -2, -5, -3, -1, -1, -5, -3, -5, -5, -4, -7, 0, 0, 0, -11, -6, -1, -2, -2, -2, -13,
9
- -5, 8, -4, -7, -6, 0, -7, -7, 0, -4, -7, 1, -3, -8, -3, -2, -5, -1, -8, -6, -5, -2, -4, -13,
10
- -2, -4, 7, 2, -8, -2, -1, -2, 1, -4, -6, 0, -6, -7, -4, 1, -1, -7, -3, -6, 5, -1, -2, -13,
11
- -2, -7, 2, 7, -11, -1, 3, -2, -2, -6, -10, -3, -8, -12, -6, -2, -3, -12, -9, -6, 6, 2, -4, -13,
12
- -5, -6, -8, -11, 9, -11, -11, -7, -6, -5, -12, -11, -11, -10, -6, -2, -6, -13, -3, -5, -9, -11, -7, -13,
13
- -3, 0, -2, -1, -11, 8, 2, -5, 2, -6, -4, -2, -3, -10, -2, -4, -4, -10, -9, -5, -2, 6, -3, -13,
14
- -1, -7, -1, 3, -11, 2, 7, -3, -3, -4, -7, -3, -5, -11, -4, -3, -4, -13, -7, -5, 2, 6, -3, -13,
15
- -1, -7, -2, -2, -7, -5, -3, 6, -7, -8, -9, -6, -7, -8, -4, -1, -4, -12, -11, -4, -2, -4, -4, -13,
16
- -5, 0, 1, -2, -6, 2, -3, -7, 9, -7, -5, -4, -8, -5, -3, -4, -5, -6, -2, -5, 0, 0, -4, -13,
17
- -3, -4, -4, -6, -5, -6, -4, -8, -7, 8, 0, -5, 0, -1, -7, -5, -1, -11, -5, 3, -5, -5, -3, -13,
18
- -5, -7, -6, -10, -12, -4, -7, -9, -5, 0, 6, -6, 2, -1, -6, -7, -5, -5, -5, -1, -7, -5, -5, -13,
19
- -5, 1, 0, -3, -11, -2, -3, -6, -4, -5, -6, 6, -1, -11, -5, -3, -2, -9, -8, -7, -1, -2, -4, -13,
20
- -4, -3, -6, -8, -11, -3, -5, -7, -8, 0, 2, -1, 10, -3, -6, -4, -3, -10, -8, 0, -7, -4, -4, -13,
21
- -7, -8, -7, -12, -10, -10, -11, -8, -5, -1, -1, -11, -3, 9, -8, -5, -7, -3, 3, -6, -9, -11, -6, -13,
22
- 0, -3, -4, -6, -6, -2, -4, -4, -3, -7, -6, -5, -6, -8, 8, -1, -3, -11, -11, -4, -5, -3, -4, -13,
23
- 0, -2, 1, -2, -2, -4, -3, -1, -4, -5, -7, -3, -4, -5, -1, 6, 1, -4, -5, -4, -1, -3, -2, -13,
24
- 0, -5, -1, -3, -6, -4, -4, -4, -5, -1, -5, -2, -3, -7, -3, 1, 6, -10, -5, -2, -2, -4, -2, -13,
25
- -11, -1, -7, -12, -13, -10, -13, -12, -6, -11, -5, -9, -10, -3, -11, -4, -10, 13, -4, -12, -8, -11, -9, -13,
26
- -6, -8, -3, -9, -3, -9, -7, -11, -2, -5, -5, -8, -8, 3, -11, -5, -5, -4, 9, -6, -5, -8, -6, -13,
27
- -1, -6, -6, -6, -5, -5, -5, -4, -5, 3, -1, -7, 0, -6, -4, -4, -2, -12, -6, 7, -6, -5, -3, -13,
28
- -2, -5, 5, 6, -9, -2, 2, -2, 0, -5, -7, -1, -7, -9, -5, -1, -2, -8, -5, -6, 5, 1, -3, -13,
29
- -2, -2, -1, 2, -11, 6, 6, -4, 0, -5, -5, -2, -4, -11, -3, -3, -4, -11, -8, -5, 1, 6, -3, -13,
30
- -2, -4, -2, -4, -7, -3, -3, -4, -4, -3, -5, -4, -4, -6, -4, -2, -2, -9, -6, -3, -3, -3, -4, -13,
31
- -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, 1,
32
- };
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