diffbio 0.1.0__py3-none-any.whl

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 (202) hide show
  1. diffbio/__init__.py +39 -0
  2. diffbio/configs.py +75 -0
  3. diffbio/constants.py +204 -0
  4. diffbio/core/__init__.py +127 -0
  5. diffbio/core/base_operators.py +612 -0
  6. diffbio/core/data_types.py +260 -0
  7. diffbio/core/gnn_components.py +629 -0
  8. diffbio/core/graph_utils.py +149 -0
  9. diffbio/core/neural_components.py +270 -0
  10. diffbio/core/optimal_transport.py +133 -0
  11. diffbio/core/soft_ops/__init__.py +216 -0
  12. diffbio/core/soft_ops/_projections_permutahedron.py +1864 -0
  13. diffbio/core/soft_ops/_projections_simplex.py +240 -0
  14. diffbio/core/soft_ops/_projections_transport.py +508 -0
  15. diffbio/core/soft_ops/_sorting_network.py +204 -0
  16. diffbio/core/soft_ops/_types.py +15 -0
  17. diffbio/core/soft_ops/_utils.py +342 -0
  18. diffbio/core/soft_ops/autograd_safe.py +120 -0
  19. diffbio/core/soft_ops/comparison.py +235 -0
  20. diffbio/core/soft_ops/elementwise.py +309 -0
  21. diffbio/core/soft_ops/logical.py +146 -0
  22. diffbio/core/soft_ops/quantile.py +376 -0
  23. diffbio/core/soft_ops/selection.py +236 -0
  24. diffbio/core/soft_ops/sorting.py +926 -0
  25. diffbio/core/soft_ops/straight_through.py +261 -0
  26. diffbio/core/uncertainty.py +279 -0
  27. diffbio/evaluation/__init__.py +42 -0
  28. diffbio/evaluation/adapters.py +409 -0
  29. diffbio/evaluation/graders.py +223 -0
  30. diffbio/evaluation/problem.py +157 -0
  31. diffbio/evaluation/runner.py +277 -0
  32. diffbio/losses/__init__.py +59 -0
  33. diffbio/losses/alignment_losses.py +222 -0
  34. diffbio/losses/biological_regularization.py +288 -0
  35. diffbio/losses/metric_losses.py +139 -0
  36. diffbio/losses/singlecell_losses.py +387 -0
  37. diffbio/losses/statistical_losses.py +345 -0
  38. diffbio/operators/__init__.py +60 -0
  39. diffbio/operators/_count_vae.py +197 -0
  40. diffbio/operators/_loss_balancing.py +65 -0
  41. diffbio/operators/_masked_gene_transformer.py +118 -0
  42. diffbio/operators/_transformer_validation.py +50 -0
  43. diffbio/operators/alignment/__init__.py +51 -0
  44. diffbio/operators/alignment/profile_hmm.py +350 -0
  45. diffbio/operators/alignment/scoring.py +127 -0
  46. diffbio/operators/alignment/smith_waterman.py +261 -0
  47. diffbio/operators/alignment/soft_msa.py +419 -0
  48. diffbio/operators/assembly/__init__.py +27 -0
  49. diffbio/operators/assembly/gnn_assembly.py +252 -0
  50. diffbio/operators/assembly/metagenomic_binning.py +296 -0
  51. diffbio/operators/crispr/__init__.py +17 -0
  52. diffbio/operators/crispr/guide_scoring.py +269 -0
  53. diffbio/operators/drug_discovery/__init__.py +133 -0
  54. diffbio/operators/drug_discovery/_graph_utils.py +142 -0
  55. diffbio/operators/drug_discovery/admet_predictor.py +285 -0
  56. diffbio/operators/drug_discovery/attentive_fp.py +411 -0
  57. diffbio/operators/drug_discovery/dti.py +261 -0
  58. diffbio/operators/drug_discovery/fingerprint.py +490 -0
  59. diffbio/operators/drug_discovery/maccs_keys.py +267 -0
  60. diffbio/operators/drug_discovery/message_passing.py +200 -0
  61. diffbio/operators/drug_discovery/primitives.py +242 -0
  62. diffbio/operators/drug_discovery/property_predictor.py +163 -0
  63. diffbio/operators/drug_discovery/similarity.py +193 -0
  64. diffbio/operators/epigenomics/__init__.py +35 -0
  65. diffbio/operators/epigenomics/chromatin_state.py +491 -0
  66. diffbio/operators/epigenomics/contextual.py +288 -0
  67. diffbio/operators/epigenomics/fno_peak_calling.py +153 -0
  68. diffbio/operators/epigenomics/peak_calling.py +555 -0
  69. diffbio/operators/foundation_models/__init__.py +119 -0
  70. diffbio/operators/foundation_models/adapters.py +114 -0
  71. diffbio/operators/foundation_models/contracts.py +245 -0
  72. diffbio/operators/foundation_models/embedding_probe.py +83 -0
  73. diffbio/operators/foundation_models/experimental.py +128 -0
  74. diffbio/operators/foundation_models/foundation_model.py +332 -0
  75. diffbio/operators/foundation_models/frozen.py +59 -0
  76. diffbio/operators/foundation_models/precomputed.py +270 -0
  77. diffbio/operators/foundation_models/transformer_encoder.py +564 -0
  78. diffbio/operators/mapping/__init__.py +17 -0
  79. diffbio/operators/mapping/neural_mapper.py +493 -0
  80. diffbio/operators/metabolomics/__init__.py +39 -0
  81. diffbio/operators/metabolomics/spectral_similarity.py +315 -0
  82. diffbio/operators/molecular_dynamics/__init__.py +51 -0
  83. diffbio/operators/molecular_dynamics/force_field.py +265 -0
  84. diffbio/operators/molecular_dynamics/integrator.py +304 -0
  85. diffbio/operators/molecular_dynamics/primitives.py +115 -0
  86. diffbio/operators/multiomics/__init__.py +38 -0
  87. diffbio/operators/multiomics/hic_contact.py +377 -0
  88. diffbio/operators/multiomics/multiomics_vae.py +325 -0
  89. diffbio/operators/multiomics/spatial_deconvolution.py +316 -0
  90. diffbio/operators/multiomics/spatial_gene_detection.py +493 -0
  91. diffbio/operators/normalization/__init__.py +42 -0
  92. diffbio/operators/normalization/embedding.py +222 -0
  93. diffbio/operators/normalization/phate.py +400 -0
  94. diffbio/operators/normalization/umap.py +261 -0
  95. diffbio/operators/normalization/vae_normalizer.py +258 -0
  96. diffbio/operators/population/__init__.py +17 -0
  97. diffbio/operators/population/ancestry_estimation.py +274 -0
  98. diffbio/operators/preprocessing/__init__.py +76 -0
  99. diffbio/operators/preprocessing/adapter_removal.py +311 -0
  100. diffbio/operators/preprocessing/duplicate_filter.py +317 -0
  101. diffbio/operators/preprocessing/error_correction.py +287 -0
  102. diffbio/operators/protein/__init__.py +31 -0
  103. diffbio/operators/protein/secondary_structure.py +509 -0
  104. diffbio/operators/quality_filter.py +128 -0
  105. diffbio/operators/rna_structure/__init__.py +35 -0
  106. diffbio/operators/rna_structure/rna_folding.py +509 -0
  107. diffbio/operators/rnaseq/__init__.py +23 -0
  108. diffbio/operators/rnaseq/motif_discovery.py +251 -0
  109. diffbio/operators/rnaseq/splicing_psi.py +216 -0
  110. diffbio/operators/singlecell/__init__.py +193 -0
  111. diffbio/operators/singlecell/ambient_removal.py +333 -0
  112. diffbio/operators/singlecell/archetypes.py +191 -0
  113. diffbio/operators/singlecell/batch_correction.py +288 -0
  114. diffbio/operators/singlecell/cell_annotation.py +519 -0
  115. diffbio/operators/singlecell/communication.py +704 -0
  116. diffbio/operators/singlecell/differential_distribution.py +243 -0
  117. diffbio/operators/singlecell/doublet_detection.py +657 -0
  118. diffbio/operators/singlecell/downsampling.py +166 -0
  119. diffbio/operators/singlecell/enhanced_batch_correction.py +519 -0
  120. diffbio/operators/singlecell/grn_inference.py +336 -0
  121. diffbio/operators/singlecell/imputation.py +429 -0
  122. diffbio/operators/singlecell/knockdown_filter.py +176 -0
  123. diffbio/operators/singlecell/ot_trajectory.py +277 -0
  124. diffbio/operators/singlecell/simulation.py +444 -0
  125. diffbio/operators/singlecell/sindy_grn.py +247 -0
  126. diffbio/operators/singlecell/soft_clustering.py +211 -0
  127. diffbio/operators/singlecell/spatial_domains.py +677 -0
  128. diffbio/operators/singlecell/switch_de.py +184 -0
  129. diffbio/operators/singlecell/trajectory.py +447 -0
  130. diffbio/operators/singlecell/velocity.py +361 -0
  131. diffbio/operators/statistical/__init__.py +35 -0
  132. diffbio/operators/statistical/em_quantification.py +260 -0
  133. diffbio/operators/statistical/hmm.py +234 -0
  134. diffbio/operators/statistical/nb_glm.py +272 -0
  135. diffbio/operators/variant/__init__.py +64 -0
  136. diffbio/operators/variant/classifier.py +333 -0
  137. diffbio/operators/variant/cnn_classifier.py +255 -0
  138. diffbio/operators/variant/cnv_segmentation.py +678 -0
  139. diffbio/operators/variant/deepvariant_pileup.py +426 -0
  140. diffbio/operators/variant/pileup.py +240 -0
  141. diffbio/operators/variant/quality_recalibration.py +274 -0
  142. diffbio/pipelines/__init__.py +65 -0
  143. diffbio/pipelines/differential_expression.py +279 -0
  144. diffbio/pipelines/enhanced_variant_calling.py +326 -0
  145. diffbio/pipelines/perturbation.py +407 -0
  146. diffbio/pipelines/preprocessing.py +267 -0
  147. diffbio/pipelines/single_cell.py +366 -0
  148. diffbio/pipelines/variant_calling.py +490 -0
  149. diffbio/samplers/__init__.py +9 -0
  150. diffbio/samplers/perturbation_sampler.py +142 -0
  151. diffbio/sequences/__init__.py +34 -0
  152. diffbio/sequences/dna.py +239 -0
  153. diffbio/sources/__init__.py +149 -0
  154. diffbio/sources/_anndata_shared.py +89 -0
  155. diffbio/sources/_batch_iteration.py +37 -0
  156. diffbio/sources/_benchmark_source.py +152 -0
  157. diffbio/sources/_indexed_batch_source.py +38 -0
  158. diffbio/sources/_utils.py +45 -0
  159. diffbio/sources/anndata_interop.py +387 -0
  160. diffbio/sources/anndata_source.py +361 -0
  161. diffbio/sources/archive_ii.py +174 -0
  162. diffbio/sources/balifam.py +207 -0
  163. diffbio/sources/bam.py +265 -0
  164. diffbio/sources/bengrn_ground_truth.py +306 -0
  165. diffbio/sources/contextual_epigenomics.py +242 -0
  166. diffbio/sources/dti.py +359 -0
  167. diffbio/sources/embeddings.py +203 -0
  168. diffbio/sources/encode_peaks.py +223 -0
  169. diffbio/sources/fasta.py +226 -0
  170. diffbio/sources/immune_human.py +172 -0
  171. diffbio/sources/indexed_embeddings.py +128 -0
  172. diffbio/sources/indexed_view.py +191 -0
  173. diffbio/sources/molnet.py +493 -0
  174. diffbio/sources/multiomics.py +279 -0
  175. diffbio/sources/pancreas.py +108 -0
  176. diffbio/sources/perturbation/__init__.py +69 -0
  177. diffbio/sources/perturbation/_types.py +51 -0
  178. diffbio/sources/perturbation/_utils.py +125 -0
  179. diffbio/sources/perturbation/concat_source.py +115 -0
  180. diffbio/sources/perturbation/control_mapping.py +215 -0
  181. diffbio/sources/perturbation/experiment_config.py +261 -0
  182. diffbio/sources/perturbation/h5_metadata_cache.py +218 -0
  183. diffbio/sources/perturbation/output_space.py +52 -0
  184. diffbio/sources/perturbation/perturbation_source.py +513 -0
  185. diffbio/sources/seqfish.py +145 -0
  186. diffbio/sources/sequence_foundation.py +68 -0
  187. diffbio/sources/singlecell_foundation.py +68 -0
  188. diffbio/splitters/__init__.py +63 -0
  189. diffbio/splitters/base.py +251 -0
  190. diffbio/splitters/molecular.py +330 -0
  191. diffbio/splitters/perturbation.py +199 -0
  192. diffbio/splitters/random.py +217 -0
  193. diffbio/splitters/sequence.py +201 -0
  194. diffbio/utils/__init__.py +55 -0
  195. diffbio/utils/dependency_runtime.py +115 -0
  196. diffbio/utils/nn_utils.py +157 -0
  197. diffbio/utils/quality.py +45 -0
  198. diffbio/utils/training.py +585 -0
  199. diffbio-0.1.0.dist-info/METADATA +480 -0
  200. diffbio-0.1.0.dist-info/RECORD +202 -0
  201. diffbio-0.1.0.dist-info/WHEEL +4 -0
  202. diffbio-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,480 @@
1
+ Metadata-Version: 2.4
2
+ Name: diffbio
3
+ Version: 0.1.0
4
+ Summary: DiffBio: End-to-end differentiable bioinformatics pipelines built on Datarax, Artifex, Opifex, and Calibrax
5
+ Project-URL: Bug Tracker, https://github.com/avitai/DiffBio/issues
6
+ Project-URL: Documentation, https://diffbio.readthedocs.io
7
+ Project-URL: Source, https://github.com/avitai/DiffBio
8
+ Author: Mahdi Shafiei
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Mahdi Shafiei
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: alignment,bioinformatics,differentiable,flax,jax,machine-learning,variant-calling
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: Education
35
+ Classifier: Intended Audience :: Science/Research
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Programming Language :: Python :: 3 :: Only
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Scientific/Engineering
41
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
42
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
43
+ Classifier: Topic :: Software Development
44
+ Classifier: Topic :: Software Development :: Libraries
45
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
46
+ Requires-Python: >=3.11
47
+ Requires-Dist: anndata>=0.9.1
48
+ Requires-Dist: avitai-artifex>=0.1.0
49
+ Requires-Dist: beartype>=0.14.1
50
+ Requires-Dist: biopython>=1.81
51
+ Requires-Dist: calibrax>=0.1.1
52
+ Requires-Dist: chex>=0.1.7
53
+ Requires-Dist: datarax>=0.1.3
54
+ Requires-Dist: flax>=0.12.0
55
+ Requires-Dist: h5py>=3.7
56
+ Requires-Dist: jax-md>=0.2.27
57
+ Requires-Dist: jax>=0.6.1
58
+ Requires-Dist: jaxtyping>=0.2.20
59
+ Requires-Dist: numpy>=1.24
60
+ Requires-Dist: opifex>=0.1.0
61
+ Requires-Dist: optax>=0.1.4
62
+ Requires-Dist: orbax-checkpoint>=0.11.10
63
+ Requires-Dist: pre-commit>=4.3.0
64
+ Requires-Dist: rdkit>=2025.9.3
65
+ Requires-Dist: ruff>=0.1.5
66
+ Requires-Dist: scipy>=1.10
67
+ Provides-Extra: all
68
+ Requires-Dist: bandit[toml]>=1.8.6; extra == 'all'
69
+ Requires-Dist: beartype>=0.14.1; extra == 'all'
70
+ Requires-Dist: build>=1.0.3; extra == 'all'
71
+ Requires-Dist: coverage>=7; extra == 'all'
72
+ Requires-Dist: deepchem>=2.8.0; extra == 'all'
73
+ Requires-Dist: flake8-functions-names>=0.4; extra == 'all'
74
+ Requires-Dist: flake8>=7.0; extra == 'all'
75
+ Requires-Dist: griffe>=1.7.3; extra == 'all'
76
+ Requires-Dist: import-linter>=2.5; extra == 'all'
77
+ Requires-Dist: interrogate>=1.7.0; extra == 'all'
78
+ Requires-Dist: ipykernel>=6.29.5; extra == 'all'
79
+ Requires-Dist: jax[cuda12]>=0.6.1; extra == 'all'
80
+ Requires-Dist: jaxlib>=0.6.1; extra == 'all'
81
+ Requires-Dist: lineax>=0.0.8; extra == 'all'
82
+ Requires-Dist: matplotlib>=3.7; extra == 'all'
83
+ Requires-Dist: mkdocs-include-exclude-files>=0.1; extra == 'all'
84
+ Requires-Dist: mkdocs-material>=9.6.7; extra == 'all'
85
+ Requires-Dist: mkdocs>=1.6.1; extra == 'all'
86
+ Requires-Dist: mkdocstrings-python>=1.1.2; extra == 'all'
87
+ Requires-Dist: mkdocstrings>=0.28.3; extra == 'all'
88
+ Requires-Dist: optimistix>=0.0.9; extra == 'all'
89
+ Requires-Dist: ott-jax>=0.5.0; extra == 'all'
90
+ Requires-Dist: pandas>=2.0; extra == 'all'
91
+ Requires-Dist: pyfaidx>=0.8.0; extra == 'all'
92
+ Requires-Dist: pylint>=3.3.8; extra == 'all'
93
+ Requires-Dist: pymdown-extensions>=10.14.3; extra == 'all'
94
+ Requires-Dist: pynndescent>=0.5; extra == 'all'
95
+ Requires-Dist: pyright>=1.1.336; extra == 'all'
96
+ Requires-Dist: pysam>=0.22.0; extra == 'all'
97
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'all'
98
+ Requires-Dist: pytest-benchmark>=4; extra == 'all'
99
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'all'
100
+ Requires-Dist: pytest-env>=1.0.1; extra == 'all'
101
+ Requires-Dist: pytest-json-report>=1.5.0; extra == 'all'
102
+ Requires-Dist: pytest-randomly>=3.16.0; extra == 'all'
103
+ Requires-Dist: pytest-timeout>=2.1; extra == 'all'
104
+ Requires-Dist: pytest-xdist>=3.6; extra == 'all'
105
+ Requires-Dist: pytest>=8.3.5; extra == 'all'
106
+ Requires-Dist: python-dotenv>=1; extra == 'all'
107
+ Requires-Dist: radon>=6.0.1; extra == 'all'
108
+ Requires-Dist: ruff>=0.1.5; extra == 'all'
109
+ Requires-Dist: scib-metrics>=0.5; extra == 'all'
110
+ Requires-Dist: shellcheck-py>=0.10.0.1; extra == 'all'
111
+ Requires-Dist: squidpy>=1.4; extra == 'all'
112
+ Requires-Dist: tabulate>=0.9; extra == 'all'
113
+ Requires-Dist: torch>=1.13.0; extra == 'all'
114
+ Requires-Dist: wemake-python-styleguide>=1.0; extra == 'all'
115
+ Provides-Extra: benchmark
116
+ Requires-Dist: deepchem>=2.8.0; extra == 'benchmark'
117
+ Requires-Dist: matplotlib>=3.7; extra == 'benchmark'
118
+ Requires-Dist: pandas>=2.0; extra == 'benchmark'
119
+ Requires-Dist: pynndescent>=0.5; extra == 'benchmark'
120
+ Requires-Dist: scib-metrics>=0.5; extra == 'benchmark'
121
+ Requires-Dist: squidpy>=1.4; extra == 'benchmark'
122
+ Requires-Dist: tabulate>=0.9; extra == 'benchmark'
123
+ Provides-Extra: cuda-dev
124
+ Requires-Dist: bandit[toml]>=1.8.6; extra == 'cuda-dev'
125
+ Requires-Dist: build>=1.0.3; extra == 'cuda-dev'
126
+ Requires-Dist: coverage>=7; extra == 'cuda-dev'
127
+ Requires-Dist: flake8-functions-names>=0.4; extra == 'cuda-dev'
128
+ Requires-Dist: flake8>=7.0; extra == 'cuda-dev'
129
+ Requires-Dist: import-linter>=2.5; extra == 'cuda-dev'
130
+ Requires-Dist: interrogate>=1.7.0; extra == 'cuda-dev'
131
+ Requires-Dist: ipykernel>=6.29.5; extra == 'cuda-dev'
132
+ Requires-Dist: jax[cuda12]>=0.6.1; extra == 'cuda-dev'
133
+ Requires-Dist: jaxlib>=0.6.1; extra == 'cuda-dev'
134
+ Requires-Dist: pylint>=3.3.8; extra == 'cuda-dev'
135
+ Requires-Dist: pyright>=1.1.336; extra == 'cuda-dev'
136
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'cuda-dev'
137
+ Requires-Dist: pytest-benchmark>=4; extra == 'cuda-dev'
138
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'cuda-dev'
139
+ Requires-Dist: pytest-env>=1.0.1; extra == 'cuda-dev'
140
+ Requires-Dist: pytest-json-report>=1.5.0; extra == 'cuda-dev'
141
+ Requires-Dist: pytest-randomly>=3.16.0; extra == 'cuda-dev'
142
+ Requires-Dist: pytest-timeout>=2.1; extra == 'cuda-dev'
143
+ Requires-Dist: pytest-xdist>=3.6; extra == 'cuda-dev'
144
+ Requires-Dist: pytest>=8.3.5; extra == 'cuda-dev'
145
+ Requires-Dist: python-dotenv>=1; extra == 'cuda-dev'
146
+ Requires-Dist: radon>=6.0.1; extra == 'cuda-dev'
147
+ Requires-Dist: ruff>=0.1.5; extra == 'cuda-dev'
148
+ Requires-Dist: shellcheck-py>=0.10.0.1; extra == 'cuda-dev'
149
+ Requires-Dist: wemake-python-styleguide>=1.0; extra == 'cuda-dev'
150
+ Provides-Extra: dev
151
+ Requires-Dist: bandit[toml]>=1.8.6; extra == 'dev'
152
+ Requires-Dist: build>=1.0.3; extra == 'dev'
153
+ Requires-Dist: coverage>=7; extra == 'dev'
154
+ Requires-Dist: flake8-functions-names>=0.4; extra == 'dev'
155
+ Requires-Dist: flake8>=7.0; extra == 'dev'
156
+ Requires-Dist: import-linter>=2.5; extra == 'dev'
157
+ Requires-Dist: interrogate>=1.7.0; extra == 'dev'
158
+ Requires-Dist: ipykernel>=6.29.5; extra == 'dev'
159
+ Requires-Dist: pylint>=3.3.8; extra == 'dev'
160
+ Requires-Dist: pyright>=1.1.336; extra == 'dev'
161
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
162
+ Requires-Dist: pytest-benchmark>=4; extra == 'dev'
163
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
164
+ Requires-Dist: pytest-env>=1.0.1; extra == 'dev'
165
+ Requires-Dist: pytest-json-report>=1.5.0; extra == 'dev'
166
+ Requires-Dist: pytest-randomly>=3.16.0; extra == 'dev'
167
+ Requires-Dist: pytest-timeout>=2.1; extra == 'dev'
168
+ Requires-Dist: pytest-xdist>=3.6; extra == 'dev'
169
+ Requires-Dist: pytest>=8.3.5; extra == 'dev'
170
+ Requires-Dist: python-dotenv>=1; extra == 'dev'
171
+ Requires-Dist: radon>=6.0.1; extra == 'dev'
172
+ Requires-Dist: ruff>=0.1.5; extra == 'dev'
173
+ Requires-Dist: shellcheck-py>=0.10.0.1; extra == 'dev'
174
+ Requires-Dist: wemake-python-styleguide>=1.0; extra == 'dev'
175
+ Provides-Extra: docs
176
+ Requires-Dist: griffe>=1.7.3; extra == 'docs'
177
+ Requires-Dist: mkdocs-include-exclude-files>=0.1; extra == 'docs'
178
+ Requires-Dist: mkdocs-material>=9.6.7; extra == 'docs'
179
+ Requires-Dist: mkdocs>=1.6.1; extra == 'docs'
180
+ Requires-Dist: mkdocstrings-python>=1.1.2; extra == 'docs'
181
+ Requires-Dist: mkdocstrings>=0.28.3; extra == 'docs'
182
+ Requires-Dist: pymdown-extensions>=10.14.3; extra == 'docs'
183
+ Provides-Extra: genomics
184
+ Requires-Dist: pyfaidx>=0.8.0; extra == 'genomics'
185
+ Requires-Dist: pysam>=0.22.0; extra == 'genomics'
186
+ Provides-Extra: gpu
187
+ Requires-Dist: jax[cuda12]>=0.6.1; extra == 'gpu'
188
+ Requires-Dist: jaxlib>=0.6.1; extra == 'gpu'
189
+ Provides-Extra: soft-ops-advanced
190
+ Requires-Dist: lineax>=0.0.8; extra == 'soft-ops-advanced'
191
+ Requires-Dist: optimistix>=0.0.9; extra == 'soft-ops-advanced'
192
+ Provides-Extra: soft-ops-ot
193
+ Requires-Dist: lineax>=0.0.8; extra == 'soft-ops-ot'
194
+ Requires-Dist: optimistix>=0.0.9; extra == 'soft-ops-ot'
195
+ Requires-Dist: ott-jax>=0.5.0; extra == 'soft-ops-ot'
196
+ Provides-Extra: test
197
+ Requires-Dist: beartype>=0.14.1; extra == 'test'
198
+ Requires-Dist: coverage>=7; extra == 'test'
199
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
200
+ Requires-Dist: pytest-benchmark>=4; extra == 'test'
201
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'test'
202
+ Requires-Dist: pytest-env>=1.0.1; extra == 'test'
203
+ Requires-Dist: pytest-randomly>=3.16.0; extra == 'test'
204
+ Requires-Dist: pytest-timeout>=2.1; extra == 'test'
205
+ Requires-Dist: pytest-xdist>=3.6; extra == 'test'
206
+ Requires-Dist: pytest>=8.3.5; extra == 'test'
207
+ Provides-Extra: torch-io
208
+ Requires-Dist: torch>=1.13.0; extra == 'torch-io'
209
+ Description-Content-Type: text/markdown
210
+
211
+ # DiffBio
212
+
213
+ <p align="center">
214
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python 3.11+"></a>
215
+ <a href="https://jax.readthedocs.io/"><img src="https://img.shields.io/badge/JAX-0.6.1+-green.svg" alt="JAX"></a>
216
+ <a href="https://flax.readthedocs.io/"><img src="https://img.shields.io/badge/Flax-0.12+-orange.svg" alt="Flax"></a>
217
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
218
+ </p>
219
+
220
+ <p align="center">
221
+ <strong>End-to-End Differentiable Bioinformatics Pipelines</strong>
222
+ </p>
223
+
224
+ <p align="center">
225
+ Built on <a href="https://github.com/avitai/datarax">Datarax</a>, <a href="https://github.com/avitai/artifex">Artifex</a>, <a href="https://github.com/avitai/Opifex">Opifex</a>, and <a href="https://github.com/avitai/calibrax">Calibrax</a> | Powered by <a href="https://jax.readthedocs.io/">JAX</a> & <a href="https://flax.readthedocs.io/">Flax NNX</a>
226
+ </p>
227
+
228
+ ---
229
+
230
+ ## Overview
231
+
232
+ DiffBio is a framework for building **end-to-end differentiable bioinformatics
233
+ pipelines**. By replacing discrete operations with differentiable relaxations,
234
+ DiffBio enables gradient-based optimization through entire analysis workflows.
235
+
236
+ DiffBio is the biology-specific differentiable operator layer of a wider
237
+ JAX/NNX scientific ML ecosystem. It uses:
238
+
239
+ - **Datarax** for operator and dataflow contracts
240
+ - **Artifex** for reusable model-building and transformer components
241
+ - **Opifex** for scientific ML and advanced optimization primitives
242
+ - **Calibrax** for metrics, benchmarking, comparison, and regression control
243
+
244
+ Traditional bioinformatics pipelines use discrete operations (hard thresholds, argmax decisions) that block gradient flow. DiffBio addresses this by:
245
+
246
+ - **Soft quality filtering** using sigmoid-based weights instead of hard cutoffs
247
+ - **Differentiable pileup** with soft position assignments via temperature-controlled softmax
248
+ - **Soft alignment scoring** replacing discrete Smith-Waterman with continuous relaxations
249
+ - **End-to-end training** of complete pipelines using gradient descent
250
+
251
+ This enables learning optimal pipeline parameters directly from data, rather than manual tuning.
252
+
253
+ ## Features
254
+
255
+ - **40+ Differentiable Operators** covering alignment, variant calling, single-cell analysis, epigenomics, RNA-seq, preprocessing, normalization, multi-omics, drug discovery, and protein/RNA structure
256
+ - **6 End-to-End Pipelines** for variant calling, enhanced variant calling, single-cell analysis, differential expression, perturbation, and preprocessing
257
+ - **GPU-Accelerated** computation via JAX's XLA compilation
258
+ - **Composable Architecture** built on the Datarax, Artifex, Opifex, and Calibrax stack
259
+ - **Training Utilities** with gradient clipping, custom loss functions, and synthetic data generation
260
+
261
+ For complete operator and pipeline listings, see the [Operators Overview](https://docs.avitai.bio/diffbio/user-guide/operators/overview/) and [Pipelines Overview](https://docs.avitai.bio/diffbio/user-guide/pipelines/overview/) in the documentation.
262
+
263
+ ## Installation
264
+
265
+ ```bash
266
+ # Clone the repository
267
+ git clone https://github.com/avitai/DiffBio.git
268
+ cd DiffBio
269
+
270
+ # Install with uv
271
+ uv sync
272
+ ```
273
+
274
+ ## Quick Start
275
+
276
+ ### Using Individual Operators
277
+
278
+ ```python
279
+ import jax
280
+ import jax.numpy as jnp
281
+ from flax import nnx
282
+
283
+ from diffbio.operators import DifferentiableQualityFilter
284
+ from diffbio.operators.variant.pileup import DifferentiablePileup
285
+ from diffbio.operators.alignment.smith_waterman import SmoothSmithWaterman
286
+
287
+ # Quality filtering with learnable threshold
288
+ quality_filter = DifferentiableQualityFilter(
289
+ threshold=20.0,
290
+ temperature=1.0,
291
+ rngs=nnx.Rngs(0),
292
+ )
293
+
294
+ # Apply to reads
295
+ quality_scores = jnp.array([35.0, 15.0, 28.0, 10.0])
296
+ reads = jax.nn.one_hot(jnp.array([[0, 1, 2, 3]] * 4), 4)
297
+ data = {"reads": reads, "quality": quality_scores}
298
+
299
+ filtered_data, _, _ = quality_filter.apply(data, {}, None)
300
+ # filtered_data["weights"] contains soft weights for each read
301
+ ```
302
+
303
+ ### Using the Variant Calling Pipeline
304
+
305
+ ```python
306
+ from diffbio.pipelines import (
307
+ VariantCallingPipeline,
308
+ VariantCallingPipelineConfig,
309
+ create_variant_calling_pipeline,
310
+ )
311
+
312
+ # Create pipeline with default configuration
313
+ pipeline = create_variant_calling_pipeline(
314
+ reference_length=100,
315
+ num_classes=3, # ref, SNP, indel
316
+ hidden_dim=32,
317
+ seed=42,
318
+ )
319
+
320
+ # Process reads
321
+ batch_data = {
322
+ "reads": reads, # (num_reads, read_length, 4)
323
+ "positions": positions, # (num_reads,)
324
+ "quality": quality, # (num_reads, read_length)
325
+ }
326
+
327
+ result, _, _ = pipeline.apply(batch_data, {}, None)
328
+ # result["logits"] contains per-position variant predictions
329
+ # result["probabilities"] contains class probabilities
330
+ ```
331
+
332
+ ### Training a Pipeline
333
+
334
+ ```python
335
+ from diffbio.utils import (
336
+ Trainer,
337
+ TrainingConfig,
338
+ cross_entropy_loss,
339
+ create_synthetic_training_data,
340
+ data_iterator,
341
+ )
342
+
343
+ # Generate synthetic training data
344
+ inputs, targets = create_synthetic_training_data(
345
+ num_samples=100,
346
+ num_reads=10,
347
+ read_length=50,
348
+ reference_length=100,
349
+ variant_rate=0.1,
350
+ )
351
+
352
+ # Configure training
353
+ config = TrainingConfig(
354
+ learning_rate=1e-3,
355
+ num_epochs=50,
356
+ log_every=10,
357
+ grad_clip_norm=1.0,
358
+ )
359
+
360
+ # Create trainer
361
+ trainer = Trainer(pipeline, config)
362
+
363
+ # Define loss function
364
+ def loss_fn(predictions, targets):
365
+ return cross_entropy_loss(
366
+ predictions["logits"],
367
+ targets["labels"],
368
+ num_classes=3,
369
+ )
370
+
371
+ # Train
372
+ trainer.train(
373
+ data_iterator_fn=lambda: data_iterator(inputs, targets),
374
+ loss_fn=loss_fn,
375
+ )
376
+
377
+ # Access trained pipeline
378
+ trained_pipeline = trainer.pipeline
379
+ ```
380
+
381
+ ## Architecture
382
+
383
+ DiffBio sits on a layered ecosystem rather than standing alone:
384
+
385
+ | Layer | Library | Role In DiffBio |
386
+ |---|---|---|
387
+ | Execution contracts | [Datarax](https://github.com/avitai/datarax) | Operator, data-source, and pipeline contracts |
388
+ | Modeling substrate | [Artifex](https://github.com/avitai/artifex) | Reusable transformer and generative-model components |
389
+ | Scientific ML substrate | [Opifex](https://github.com/avitai/Opifex) | Scientific optimization, operator learning, and advanced training methods |
390
+ | Evaluation substrate | [Calibrax](https://github.com/avitai/calibrax) | Metrics, benchmarking, comparison, profiling, and regression checks |
391
+ | Biology-specific layer | DiffBio | Differentiable biological operators and domain compositions |
392
+
393
+ Each DiffBio operator inherits from Datarax's `OperatorModule` and implements:
394
+
395
+ ```
396
+ apply(data, state, metadata) -> (output_data, output_state, output_metadata)
397
+ ```
398
+
399
+ This enables:
400
+ - **Composition**: Chain operators into pipelines
401
+ - **Batch processing**: Automatic vectorization via `apply_batch()`
402
+ - **Gradient flow**: End-to-end differentiability through the pipeline
403
+
404
+ ### Operator Composition
405
+
406
+ Operators are chained by threading the `(data, state, metadata)` triple
407
+ returned by `apply()` into the next operator:
408
+
409
+ ```python
410
+ data, state, metadata = quality_filter.apply(batch_data, {}, None)
411
+ data, state, metadata = pileup.apply(data, state, metadata)
412
+ data, state, metadata = classifier.apply(data, state, metadata)
413
+
414
+ # `data` is a dict of JAX arrays — read out the per-position predictions
415
+ predictions = data["logits"]
416
+ ```
417
+
418
+ ## Testing
419
+
420
+ ```bash
421
+ # Run all tests
422
+ uv run pytest -vv
423
+
424
+ # Run with coverage
425
+ uv run pytest -vv --cov=src/ --cov-report=term-missing
426
+
427
+ # Run specific test modules
428
+ uv run pytest tests/operators/ -vv
429
+ uv run pytest tests/pipelines/ -vv
430
+ uv run pytest tests/integration/ -vv
431
+ ```
432
+
433
+ ## Project Structure
434
+
435
+ ```
436
+ DiffBio/
437
+ ├── src/diffbio/
438
+ │ ├── core/ # Base operators, graph utils, soft ops
439
+ │ ├── operators/ # 35+ differentiable operators
440
+ │ │ ├── alignment/ # Smith-Waterman, profile HMM, soft MSA
441
+ │ │ ├── variant/ # Pileup, classifiers, CNV segmentation
442
+ │ │ ├── singlecell/ # Clustering, trajectory, velocity, GRN, ...
443
+ │ │ ├── drug_discovery/ # Fingerprints, property prediction, ADMET
444
+ │ │ ├── epigenomics/ # Peak calling, chromatin state
445
+ │ │ ├── normalization/ # VAE normalizer, UMAP, PHATE
446
+ │ │ ├── statistical/ # HMM, NB GLM, EM quantification
447
+ │ │ ├── multiomics/ # Hi-C, spatial deconvolution
448
+ │ │ └── ... # preprocessing, protein, RNA, assembly, ...
449
+ │ ├── pipelines/ # End-to-end pipelines
450
+ │ ├── losses/ # Alignment, single-cell, statistical losses
451
+ │ ├── sources/ # Data loaders (FASTA, BAM, MolNet, ...)
452
+ │ ├── splitters/ # Dataset splitting strategies
453
+ │ └── utils/ # Training utilities
454
+ ├── tests/ # Unit, integration, and benchmark tests
455
+ ├── benchmarks/ # Domain benchmarks with training + baselines
456
+ └── docs/ # MkDocs documentation
457
+ ```
458
+
459
+ ## Requirements
460
+
461
+ - Python 3.11+
462
+ - JAX 0.6.1+
463
+ - Flax 0.12+
464
+ - Optax 0.1.4+
465
+ - jaxtyping 0.2.20+
466
+ - Datarax, Artifex, Opifex, and Calibrax (installed automatically from PyPI)
467
+
468
+ ## License
469
+
470
+ MIT License. See [LICENSE](LICENSE) for details.
471
+
472
+ ## Acknowledgments
473
+
474
+ DiffBio builds on ideas from:
475
+ - [SMURF](https://www.biorxiv.org/content/10.1101/2021.10.23.465204): Differentiable Smith-Waterman for end-to-end MSA learning
476
+ - [Datarax](https://github.com/avitai/datarax): Composable data processing framework
477
+ - [Artifex](https://github.com/avitai/artifex): Generative-model and transformer substrate
478
+ - [Opifex](https://github.com/avitai/Opifex): Scientific ML and advanced optimization substrate
479
+ - [Calibrax](https://github.com/avitai/calibrax): Benchmarking, comparison, and regression substrate
480
+ - [Flax NNX](https://flax.readthedocs.io/): Neural network library for JAX