diff-hdx 0.1.1__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diff-hdx
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Differentiable HDX-MS prediction in JAX
5
5
  Author: George Elkins
6
6
  License: MIT
@@ -26,12 +26,12 @@ Provides-Extra: dev
26
26
  Requires-Dist: pytest>=7.0.0; extra == "dev"
27
27
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
28
28
  Requires-Dist: ruff>=0.6.0; extra == "dev"
29
- Requires-Dist: mypy>=1.8.0; extra == "dev"
29
+ Requires-Dist: mypy>=1.11.0; extra == "dev"
30
30
  Dynamic: license-file
31
31
 
32
32
  # 🧪 diff-hdx: Differentiable HDX-MS Prediction in JAX
33
33
 
34
- [![Tests](https://github.com/elkins/diff-hdx/actions/workflows/test.yml/badge.svg)](https://github.com/elkins/diff-hdx/actions/workflows/test.yml)
34
+ [![Tests](https://github.com/elkins-lab/diff-hdx/actions/workflows/test.yml/badge.svg)](https://github.com/elkins-lab/diff-hdx/actions/workflows/test.yml)
35
35
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
36
36
  [![JAX](https://img.shields.io/badge/backend-JAX-9cf.svg)](https://github.com/google/jax)
37
37
 
@@ -49,6 +49,14 @@ Dynamic: license-file
49
49
 
50
50
  ---
51
51
 
52
+ ## 📚 Tutorials
53
+
54
+ Experience **diff-hdx** directly in your browser:
55
+
56
+ - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/elkins-lab/diff-hdx/blob/main/examples/interactive_tutorials/hdx_prediction_tutorial.ipynb) **HDX-MS Prediction & Kinetics** — Learn how to simulate intrinsic rates, protection factors, and deuterium uptake curves.
57
+
58
+ ---
59
+
52
60
  ## 🏗️ Technical Architecture
53
61
 
54
62
  - **Backend:** JAX (XLA-compiled) — supports CPU, GPU, and TPU.
@@ -84,10 +92,10 @@ pip install diff-hdx
84
92
 
85
93
  diff-hdx is part of the **differentiable biophysics** ecosystem:
86
94
 
87
- - [diff-biophys](https://github.com/elkins/diff-biophys) — Core differentiable biophysics engine.
88
- - [diff-fret](https://github.com/elkins/diff-fret) — Differentiable FRET modeling.
89
- - [diff-epr](https://github.com/elkins/diff-epr) — Differentiable EPR/DEER simulation.
90
- - [synth-pdb](https://github.com/elkins/synth-pdb) — Synthetic structure generation.
95
+ - [diff-biophys](https://github.com/elkins-lab/diff-biophys) — Core differentiable biophysics engine.
96
+ - [diff-fret](https://github.com/elkins-lab/diff-fret) — Differentiable FRET modeling.
97
+ - [diff-epr](https://github.com/elkins-lab/diff-epr) — Differentiable EPR/DEER simulation.
98
+ - [synth-pdb](https://github.com/elkins-lab/synth-pdb) — Synthetic structure generation.
91
99
 
92
100
  ---
93
101
 
@@ -98,8 +106,8 @@ diff-hdx is part of the **differentiable biophysics** ecosystem:
98
106
  author = {Elkins, George},
99
107
  title = {diff-hdx: Differentiable HDX-MS prediction in JAX},
100
108
  year = {2026},
101
- url = {https://github.com/elkins/diff-hdx},
102
- version = {0.1.0}
109
+ url = {https://github.com/elkins-lab/diff-hdx},
110
+ version = {0.1.2}
103
111
  }
104
112
  ```
105
113
 
@@ -1,6 +1,6 @@
1
1
  # 🧪 diff-hdx: Differentiable HDX-MS Prediction in JAX
2
2
 
3
- [![Tests](https://github.com/elkins/diff-hdx/actions/workflows/test.yml/badge.svg)](https://github.com/elkins/diff-hdx/actions/workflows/test.yml)
3
+ [![Tests](https://github.com/elkins-lab/diff-hdx/actions/workflows/test.yml/badge.svg)](https://github.com/elkins-lab/diff-hdx/actions/workflows/test.yml)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![JAX](https://img.shields.io/badge/backend-JAX-9cf.svg)](https://github.com/google/jax)
6
6
 
@@ -18,6 +18,14 @@
18
18
 
19
19
  ---
20
20
 
21
+ ## 📚 Tutorials
22
+
23
+ Experience **diff-hdx** directly in your browser:
24
+
25
+ - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/elkins-lab/diff-hdx/blob/main/examples/interactive_tutorials/hdx_prediction_tutorial.ipynb) **HDX-MS Prediction & Kinetics** — Learn how to simulate intrinsic rates, protection factors, and deuterium uptake curves.
26
+
27
+ ---
28
+
21
29
  ## 🏗️ Technical Architecture
22
30
 
23
31
  - **Backend:** JAX (XLA-compiled) — supports CPU, GPU, and TPU.
@@ -53,10 +61,10 @@ pip install diff-hdx
53
61
 
54
62
  diff-hdx is part of the **differentiable biophysics** ecosystem:
55
63
 
56
- - [diff-biophys](https://github.com/elkins/diff-biophys) — Core differentiable biophysics engine.
57
- - [diff-fret](https://github.com/elkins/diff-fret) — Differentiable FRET modeling.
58
- - [diff-epr](https://github.com/elkins/diff-epr) — Differentiable EPR/DEER simulation.
59
- - [synth-pdb](https://github.com/elkins/synth-pdb) — Synthetic structure generation.
64
+ - [diff-biophys](https://github.com/elkins-lab/diff-biophys) — Core differentiable biophysics engine.
65
+ - [diff-fret](https://github.com/elkins-lab/diff-fret) — Differentiable FRET modeling.
66
+ - [diff-epr](https://github.com/elkins-lab/diff-epr) — Differentiable EPR/DEER simulation.
67
+ - [synth-pdb](https://github.com/elkins-lab/synth-pdb) — Synthetic structure generation.
60
68
 
61
69
  ---
62
70
 
@@ -67,8 +75,8 @@ diff-hdx is part of the **differentiable biophysics** ecosystem:
67
75
  author = {Elkins, George},
68
76
  title = {diff-hdx: Differentiable HDX-MS prediction in JAX},
69
77
  year = {2026},
70
- url = {https://github.com/elkins/diff-hdx},
71
- version = {0.1.0}
78
+ url = {https://github.com/elkins-lab/diff-hdx},
79
+ version = {0.1.2}
72
80
  }
73
81
  ```
74
82
 
@@ -65,6 +65,9 @@ def intrinsic_rates(
65
65
  """
66
66
  n = len(sequence) # noqa: F841 -- kept for readability; not used in vectorised ops
67
67
 
68
+ if not sequence:
69
+ return jnp.zeros(0)
70
+
68
71
  # Encode sequence as integer indices (unknown residues → Ala)
69
72
  seq_idx = [_AA_IDX.get(aa, _ALA_IDX) for aa in sequence]
70
73
 
@@ -104,7 +107,15 @@ def intrinsic_rates(
104
107
  kb = kb_ref_t * 10.0 ** (left_corr[:, 2] + right_corr[:, 3]) # bl + br
105
108
  kw = kw_ref_t * 10.0 ** (left_corr[:, 2] + right_corr[:, 3]) # same as kb
106
109
 
107
- return jnp.asarray(ka * h_plus + kb * oh_minus + kw) # explicit Array, satisfies mypy
110
+ rates = ka * h_plus + kb * oh_minus + kw
111
+
112
+ # Proline has no amide proton, so its intrinsic rate is physically 0.0.
113
+ # Note: we use 0.0 here as the rate; downstream tools should handle this
114
+ # appropriately if a sentinel value or NaN is preferred instead.
115
+ pro_idx = _AA_IDX.get("P", -1)
116
+ pro_mask = jnp.where(jnp.array(seq_idx) == pro_idx, 0.0, 1.0)
117
+
118
+ return jnp.asarray(rates * pro_mask) # explicit Array, satisfies mypy
108
119
 
109
120
 
110
121
  def sasa_approx(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diff-hdx
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Differentiable HDX-MS prediction in JAX
5
5
  Author: George Elkins
6
6
  License: MIT
@@ -26,12 +26,12 @@ Provides-Extra: dev
26
26
  Requires-Dist: pytest>=7.0.0; extra == "dev"
27
27
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
28
28
  Requires-Dist: ruff>=0.6.0; extra == "dev"
29
- Requires-Dist: mypy>=1.8.0; extra == "dev"
29
+ Requires-Dist: mypy>=1.11.0; extra == "dev"
30
30
  Dynamic: license-file
31
31
 
32
32
  # 🧪 diff-hdx: Differentiable HDX-MS Prediction in JAX
33
33
 
34
- [![Tests](https://github.com/elkins/diff-hdx/actions/workflows/test.yml/badge.svg)](https://github.com/elkins/diff-hdx/actions/workflows/test.yml)
34
+ [![Tests](https://github.com/elkins-lab/diff-hdx/actions/workflows/test.yml/badge.svg)](https://github.com/elkins-lab/diff-hdx/actions/workflows/test.yml)
35
35
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
36
36
  [![JAX](https://img.shields.io/badge/backend-JAX-9cf.svg)](https://github.com/google/jax)
37
37
 
@@ -49,6 +49,14 @@ Dynamic: license-file
49
49
 
50
50
  ---
51
51
 
52
+ ## 📚 Tutorials
53
+
54
+ Experience **diff-hdx** directly in your browser:
55
+
56
+ - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/elkins-lab/diff-hdx/blob/main/examples/interactive_tutorials/hdx_prediction_tutorial.ipynb) **HDX-MS Prediction & Kinetics** — Learn how to simulate intrinsic rates, protection factors, and deuterium uptake curves.
57
+
58
+ ---
59
+
52
60
  ## 🏗️ Technical Architecture
53
61
 
54
62
  - **Backend:** JAX (XLA-compiled) — supports CPU, GPU, and TPU.
@@ -84,10 +92,10 @@ pip install diff-hdx
84
92
 
85
93
  diff-hdx is part of the **differentiable biophysics** ecosystem:
86
94
 
87
- - [diff-biophys](https://github.com/elkins/diff-biophys) — Core differentiable biophysics engine.
88
- - [diff-fret](https://github.com/elkins/diff-fret) — Differentiable FRET modeling.
89
- - [diff-epr](https://github.com/elkins/diff-epr) — Differentiable EPR/DEER simulation.
90
- - [synth-pdb](https://github.com/elkins/synth-pdb) — Synthetic structure generation.
95
+ - [diff-biophys](https://github.com/elkins-lab/diff-biophys) — Core differentiable biophysics engine.
96
+ - [diff-fret](https://github.com/elkins-lab/diff-fret) — Differentiable FRET modeling.
97
+ - [diff-epr](https://github.com/elkins-lab/diff-epr) — Differentiable EPR/DEER simulation.
98
+ - [synth-pdb](https://github.com/elkins-lab/synth-pdb) — Synthetic structure generation.
91
99
 
92
100
  ---
93
101
 
@@ -98,8 +106,8 @@ diff-hdx is part of the **differentiable biophysics** ecosystem:
98
106
  author = {Elkins, George},
99
107
  title = {diff-hdx: Differentiable HDX-MS prediction in JAX},
100
108
  year = {2026},
101
- url = {https://github.com/elkins/diff-hdx},
102
- version = {0.1.0}
109
+ url = {https://github.com/elkins-lab/diff-hdx},
110
+ version = {0.1.2}
103
111
  }
104
112
  ```
105
113
 
@@ -7,4 +7,4 @@ biotite
7
7
  pytest>=7.0.0
8
8
  pytest-cov>=4.0.0
9
9
  ruff>=0.6.0
10
- mypy>=1.8.0
10
+ mypy>=1.11.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "diff-hdx"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Differentiable HDX-MS prediction in JAX"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -37,7 +37,7 @@ dev = [
37
37
  "pytest>=7.0.0",
38
38
  "pytest-cov>=4.0.0",
39
39
  "ruff>=0.6.0",
40
- "mypy>=1.8.0",
40
+ "mypy>=1.11.0",
41
41
  ]
42
42
 
43
43
  [tool.setuptools.packages.find]
@@ -56,7 +56,6 @@ select = ["E", "F", "I", "N", "UP", "B"]
56
56
  ignore = ["E501", "N806", "N803", "N802"]
57
57
 
58
58
  [tool.mypy]
59
- python_version = "3.10"
60
59
  warn_return_any = true
61
60
  warn_unused_configs = true
62
61
  disallow_untyped_defs = true
@@ -155,7 +155,8 @@ def test_intrinsic_rates_jit_compatible() -> None:
155
155
  # Should compile and run without error
156
156
  rates = jit_rates("ACDEFGHIKLMNPQRSTVWY", ph=7.0, temperature=293.15)
157
157
  assert rates.shape == (20,)
158
- assert jnp.all(rates > 0)
158
+ assert jnp.all(rates >= 0)
159
+ assert jnp.sum(rates == 0) == 1 # The Proline residue should be exactly 0
159
160
 
160
161
 
161
162
  def test_intrinsic_rates_temperature_dependence() -> None:
@@ -194,3 +195,74 @@ def test_h_bond_energy_far_acceptor() -> None:
194
195
  assert count_far[0] < 0.01, (
195
196
  f"H-bond count must be ~0 for acceptor far outside cutoff, got {count_far[0]:.6f}"
196
197
  )
198
+
199
+
200
+ def test_intrinsic_rates_proline() -> None:
201
+ """
202
+ Verify that Proline (P) has an intrinsic rate of 0.0 since it lacks an amide proton.
203
+ """
204
+ rates = intrinsic_rates("APA", ph=7.0, temperature=293.15)
205
+ # The middle residue is Proline, should be exactly 0
206
+ assert rates[1] == 0.0
207
+ assert rates[0] > 0.0
208
+ assert rates[2] > 0.0
209
+
210
+
211
+ def test_intrinsic_rates_empty_sequence() -> None:
212
+ """
213
+ Verify that an empty sequence correctly returns an empty array.
214
+ """
215
+ rates = intrinsic_rates("", ph=7.0, temperature=293.15)
216
+ assert rates.shape == (0,)
217
+
218
+
219
+ def test_intrinsic_rates_ph_dependence() -> None:
220
+ """
221
+ Verify the V-shape of HDX rates across pH (minimal around pH 2.5 - 3.0).
222
+ """
223
+ rate_ph3 = intrinsic_rates("AAAA", ph=3.0, temperature=293.15)
224
+ rate_ph7 = intrinsic_rates("AAAA", ph=7.0, temperature=293.15)
225
+ rate_ph1 = intrinsic_rates("AAAA", ph=1.0, temperature=293.15)
226
+
227
+ # Rate at pH 3 should be a minimum compared to pH 1 (acid-catalyzed) and pH 7 (base-catalyzed)
228
+ assert jnp.all(rate_ph3 < rate_ph7)
229
+ assert jnp.all(rate_ph3 < rate_ph1)
230
+
231
+
232
+ def test_protection_factors_beta_scaling() -> None:
233
+ """
234
+ Verify that beta_c and beta_asa correctly scale the H-bond and SASA burial terms.
235
+ """
236
+ coords = jnp.array([[0.0, 0.0, 0.0]])
237
+ h_bonds = jnp.array([2.0])
238
+
239
+ # None active (ln(PF) = 0 -> PF = 1.0)
240
+ pf_none = protection_factors(coords, h_bonds, beta_c=0.0, beta_asa=0.0)
241
+ assert jnp.allclose(pf_none, 1.0)
242
+
243
+ # Only H-bond active
244
+ pf_hb_only = protection_factors(coords, h_bonds, beta_c=1.0, beta_asa=0.0)
245
+ assert pf_hb_only[0] > 1.0
246
+
247
+ # Only SASA active - use two atoms to create some burial (SASA < 1.0)
248
+ coords_two = jnp.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]])
249
+ h_bonds_two = jnp.array([0.0, 0.0])
250
+ pf_sasa_only_two = protection_factors(coords_two, h_bonds_two, beta_c=0.0, beta_asa=1.0)
251
+ assert pf_sasa_only_two[0] > 1.0 # Partially buried, so 1-SASA > 0 => PF > 1
252
+
253
+
254
+ def test_h_bond_energy_cutoff() -> None:
255
+ """
256
+ Verify that overriding the cutoff parameter successfully rejects acceptors
257
+ that would otherwise be included.
258
+ """
259
+ donors = jnp.array([[0.0, 0.0, 0.0]])
260
+ acceptors = jnp.array([[2.0, 0.0, 0.0]]) # At 2.0 A
261
+
262
+ # With default cutoff 3.5, it should be heavily counted (sigmoid(3) approx 0.95+)
263
+ count_default = h_bond_energy(donors, acceptors)
264
+ assert count_default[0] > 0.9
265
+
266
+ # With strict cutoff 1.0, it should be mostly rejected (sigmoid(-2) approx 0.11)
267
+ count_strict = h_bond_energy(donors, acceptors, cutoff=1.0)
268
+ assert count_strict[0] < 0.2
File without changes
File without changes
File without changes