bonesistools 1.5.0__tar.gz → 1.7.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 (299) hide show
  1. {bonesistools-1.5.0 → bonesistools-1.7.0}/.gitignore +2 -0
  2. {bonesistools-1.5.0 → bonesistools-1.7.0}/PKG-INFO +7 -8
  3. {bonesistools-1.5.0 → bonesistools-1.7.0}/README.md +5 -3
  4. {bonesistools-1.5.0 → bonesistools-1.7.0}/pyproject.toml +1 -6
  5. bonesistools-1.7.0/src/bonesistools/_warnings.py +77 -0
  6. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_configuration.py +85 -15
  7. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_hypercube.py +122 -8
  8. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_robdd.py +200 -19
  9. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_structure.py +6 -7
  10. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/__init__.py +3 -0
  11. bonesistools-1.7.0/src/bonesistools/logic/boolean_network/_asynchronous.py +372 -0
  12. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_bdd.py +7 -6
  13. bonesistools-1.7.0/src/bonesistools/logic/boolean_network/_distances.py +883 -0
  14. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_dynamics.py +110 -8
  15. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_general.py +4 -3
  16. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_most_permissive.py +3 -3
  17. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_network.py +266 -98
  18. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_symbolic.py +316 -106
  19. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_synchronous.py +4 -3
  20. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_typing.py +15 -0
  21. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/__init__.py +10 -1
  22. bonesistools-1.7.0/src/bonesistools/logic/influence_graph/_distances.py +244 -0
  23. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_graphviz.py +81 -5
  24. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_influence_graph.py +420 -108
  25. bonesistools-1.7.0/src/bonesistools/logic/influence_graph/_parser.py +49 -0
  26. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_scoring.py +108 -66
  27. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_influence_graph.py +30 -28
  28. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/_typing.py +7 -0
  29. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/_geo.py +8 -3
  30. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/_nestorowa.py +9 -7
  31. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/_pbmc3k.py +2 -2
  32. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_graph.py +32 -3
  33. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_scatterplot.py +173 -18
  34. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_classification.py +68 -50
  35. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_duplicates.py +4 -1
  36. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_genename.py +54 -41
  37. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_hvg.py +24 -14
  38. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_transform.py +4 -1
  39. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/__init__.py +3 -3
  40. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/__init__.pyi +1 -1
  41. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_classification.py +22 -23
  42. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_embedding.py +306 -45
  43. bonesistools-1.5.0/src/bonesistools/omics/tools/_neighbors.py → bonesistools-1.7.0/src/bonesistools/omics/tools/_knnsc.py +6 -996
  44. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_markers.py +403 -76
  45. bonesistools-1.7.0/src/bonesistools/omics/tools/_neighbors.py +1489 -0
  46. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/__init__.py +2 -1
  47. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/__init__.pyi +2 -0
  48. bonesistools-1.7.0/src/bonesistools/resources/cache.py +332 -0
  49. bonesistools-1.7.0/src/bonesistools/resources/cache.pyi +25 -0
  50. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/__init__.py +4 -4
  51. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/__init__.pyi +2 -0
  52. bonesistools-1.7.0/src/bonesistools/resources/hcop/_orthologs.py +2102 -0
  53. bonesistools-1.7.0/src/bonesistools/resources/ncbi/__init__.py +27 -0
  54. bonesistools-1.7.0/src/bonesistools/resources/ncbi/__init__.pyi +7 -0
  55. bonesistools-1.7.0/src/bonesistools/resources/ncbi/_download.py +66 -0
  56. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/ncbi/_genesyn.py +687 -439
  57. bonesistools-1.7.0/src/bonesistools/resources/ncbi/_identifiers.py +1952 -0
  58. bonesistools-1.7.0/src/bonesistools/resources/ncbi/_mapping_cache.py +161 -0
  59. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/ncbi/_typing.py +9 -2
  60. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/omnipath/_archive.py +173 -98
  61. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/omnipath/_collectri.py +80 -59
  62. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/omnipath/_dorothea.py +125 -73
  63. bonesistools-1.7.0/src/bonesistools/resources/omnipath/_graph_cache.py +227 -0
  64. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/README.md +51 -1
  65. bonesistools-1.7.0/tests/golden/_fingerprints.py +157 -0
  66. bonesistools-1.7.0/tests/golden/conftest.py +51 -0
  67. bonesistools-1.7.0/tests/golden/generate_expected.py +117 -0
  68. bonesistools-1.7.0/tests/golden/logic/_graph_layout.py +49 -0
  69. bonesistools-1.7.0/tests/golden/logic/expected/aggregated_influence_graph.dot +31 -0
  70. bonesistools-1.7.0/tests/golden/logic/test_golden_graph_layout.py +11 -0
  71. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/_omics_workflow.py +49 -2
  72. bonesistools-1.7.0/tests/golden/omics/_tsne_diagnostics.py +262 -0
  73. bonesistools-1.7.0/tests/golden/omics/_umap_diagnostics.py +168 -0
  74. bonesistools-1.7.0/tests/golden/omics/expected/knnsc.npz +0 -0
  75. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/expected/neighbors.npz +0 -0
  76. bonesistools-1.7.0/tests/golden/omics/expected/tsne.npz +0 -0
  77. bonesistools-1.7.0/tests/golden/omics/expected/tsne_diagnostics/checkpoints.npz +0 -0
  78. bonesistools-1.7.0/tests/golden/omics/expected/umap.npz +0 -0
  79. bonesistools-1.7.0/tests/golden/omics/expected/umap_diagnostics/checkpoints.npz +0 -0
  80. bonesistools-1.7.0/tests/golden/omics/test_golden_omics_workflow.py +185 -0
  81. bonesistools-1.7.0/tests/golden/omics/test_golden_tsne_diagnostics.py +189 -0
  82. bonesistools-1.7.0/tests/golden/omics/test_golden_umap_diagnostics.py +90 -0
  83. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_configuration.py +47 -1
  84. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_hypercube.py +55 -0
  85. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_robdd.py +88 -0
  86. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/bn/test_boolean_network.py +66 -1
  87. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/bn/test_boolean_network_ensemble.py +257 -6
  88. bonesistools-1.7.0/tests/regression/logic/bn/test_distances.py +342 -0
  89. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/bn/test_dynamics.py +15 -0
  90. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/bn/test_most_permissive.py +7 -7
  91. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/bn/test_symbolic.py +61 -0
  92. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_aggregated_influence_graph.py +91 -0
  93. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_aggregated_visualization.py +66 -25
  94. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_collapsing.py +36 -18
  95. bonesistools-1.7.0/tests/regression/logic/ig/test_distances.py +345 -0
  96. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_influence_graph.py +119 -4
  97. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_parser.py +46 -20
  98. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/io/test_ginml.py +3 -3
  99. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/conftest.py +17 -18
  100. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/io/test_geo.py +9 -4
  101. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/io/test_nestorowa.py +8 -6
  102. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/io/test_registry.py +6 -0
  103. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_graph.py +36 -0
  104. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_scatterplot.py +103 -0
  105. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_classification.py +31 -12
  106. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_duplicates.py +23 -0
  107. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_genename.py +35 -10
  108. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_hvg.py +20 -0
  109. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/test_typing.py +3 -1
  110. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_embedding.py +227 -30
  111. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_knnsc.py +10 -11
  112. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_markers.py +124 -0
  113. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_neighbors.py +372 -67
  114. bonesistools-1.7.0/tests/regression/resources/test_cache.py +338 -0
  115. bonesistools-1.7.0/tests/regression/resources/test_hcop.py +1118 -0
  116. bonesistools-1.7.0/tests/regression/resources/test_ncbi.py +1348 -0
  117. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/resources/test_omnipath.py +432 -32
  118. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/test_import.py +2 -1
  119. bonesistools-1.7.0/tests/reproducibility/dorothea_modern_mouse_A_2025-08-13.sha256 +1 -0
  120. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/reproducibility/test_reproducibility_omnipath.py +5 -4
  121. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/reproducibility/test_reproducibility_workflow.py +2 -0
  122. bonesistools-1.5.0/src/bonesistools/_warnings.py +0 -31
  123. bonesistools-1.5.0/src/bonesistools/logic/boolean_network/_asynchronous.py +0 -150
  124. bonesistools-1.5.0/src/bonesistools/logic/influence_graph/_distances.py +0 -187
  125. bonesistools-1.5.0/src/bonesistools/logic/influence_graph/_parser.py +0 -45
  126. bonesistools-1.5.0/src/bonesistools/resources/hcop/_orthologs.py +0 -1387
  127. bonesistools-1.5.0/src/bonesistools/resources/ncbi/__init__.py +0 -25
  128. bonesistools-1.5.0/src/bonesistools/resources/ncbi/__init__.pyi +0 -5
  129. bonesistools-1.5.0/tests/.placeholder +0 -0
  130. bonesistools-1.5.0/tests/golden/conftest.py +0 -25
  131. bonesistools-1.5.0/tests/golden/generate_expected.py +0 -63
  132. bonesistools-1.5.0/tests/golden/logic/data/death_receptor_cell_fate.zginml +0 -0
  133. bonesistools-1.5.0/tests/golden/logic/data/synthetic_30_node_dynamics.zginml +0 -0
  134. bonesistools-1.5.0/tests/golden/omics/expected/knnsc.npz +0 -0
  135. bonesistools-1.5.0/tests/golden/omics/expected/tsne.npz +0 -0
  136. bonesistools-1.5.0/tests/golden/omics/expected/umap.npz +0 -0
  137. bonesistools-1.5.0/tests/golden/omics/test_golden_omics_workflow.py +0 -94
  138. bonesistools-1.5.0/tests/regression/logic/ig/test_distances.py +0 -222
  139. bonesistools-1.5.0/tests/regression/resources/test_hcop.py +0 -542
  140. bonesistools-1.5.0/tests/regression/resources/test_ncbi.py +0 -759
  141. bonesistools-1.5.0/tests/reproducibility/dorothea_current_mouse_A.sha256 +0 -1
  142. {bonesistools-1.5.0 → bonesistools-1.7.0}/LICENSE +0 -0
  143. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/__init__.py +0 -0
  144. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/__init__.pyi +0 -0
  145. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/_compat.py +0 -0
  146. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/_metadata.py +0 -0
  147. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/_typing.py +0 -0
  148. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/_validation.py +0 -0
  149. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/__init__.py +0 -0
  150. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/__init__.pyi +0 -0
  151. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/__init__.py +0 -0
  152. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/__init__.pyi +0 -0
  153. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_algebra.py +0 -0
  154. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_boolean.py +0 -0
  155. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_kleene.py +0 -0
  156. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_parser.py +0 -0
  157. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_representation.py +0 -0
  158. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_algebra/_typing.py +0 -0
  159. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/boolean_network/_parser.py +0 -0
  160. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_algorithms.py +0 -0
  161. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_styles.py +0 -0
  162. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_svg.py +0 -0
  163. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/influence_graph/_typing.py +0 -0
  164. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/__init__.py +0 -0
  165. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_boolean_network.py +0 -0
  166. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_booleanization.py +0 -0
  167. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_executable_model.py +0 -0
  168. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_ginml.py +0 -0
  169. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_hypercube.py +0 -0
  170. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_sbml.py +0 -0
  171. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/logic/input_output/_zginml.py +0 -0
  172. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/__init__.py +0 -0
  173. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/__init__.pyi +0 -0
  174. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/_dependencies.py +0 -0
  175. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/_metadata.py +0 -0
  176. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/_stats.py +0 -0
  177. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/_validation.py +0 -0
  178. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/datasets/__init__.py +0 -0
  179. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/datasets/__init__.pyi +0 -0
  180. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/__init__.py +0 -0
  181. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/__init__.pyi +0 -0
  182. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/_metadata.py +0 -0
  183. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/_registry.py +0 -0
  184. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/_write.py +0 -0
  185. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/input_output/datasets.json +0 -0
  186. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/__init__.py +0 -0
  187. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/__init__.pyi +0 -0
  188. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_barplot.py +0 -0
  189. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_colors.py +0 -0
  190. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_density.py +0 -0
  191. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_distribution.py +0 -0
  192. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_figure.py +0 -0
  193. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_typing.py +0 -0
  194. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/plotting/_utils.py +0 -0
  195. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/__init__.py +0 -0
  196. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/__init__.pyi +0 -0
  197. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_filter.py +0 -0
  198. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_qc.py +0 -0
  199. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_simple.py +0 -0
  200. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/preprocessing/_transfer.py +0 -0
  201. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_binarize.py +0 -0
  202. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_clustering.py +0 -0
  203. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_conversion.py +0 -0
  204. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_graph.py +0 -0
  205. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_maths.py +0 -0
  206. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_regress.py +0 -0
  207. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_stats.py +0 -0
  208. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_utils.py +0 -0
  209. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/omics/tools/_write.py +0 -0
  210. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/py.typed +0 -0
  211. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_anole_lizard_hcop.tsv.gz +0 -0
  212. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_c.elegans_hcop.tsv.gz +0 -0
  213. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_cat_hcop.tsv.gz +0 -0
  214. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_cattle_hcop.tsv.gz +0 -0
  215. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_chicken_hcop.tsv.gz +0 -0
  216. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_chimpanzee_hcop.tsv.gz +0 -0
  217. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_dog_hcop.tsv.gz +0 -0
  218. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_fruitfly_hcop.tsv.gz +0 -0
  219. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_horse_hcop.tsv.gz +0 -0
  220. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_macaque_hcop.tsv.gz +0 -0
  221. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_mouse_hcop.tsv.gz +0 -0
  222. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_opossum_hcop.tsv.gz +0 -0
  223. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_pig_hcop.tsv.gz +0 -0
  224. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_platypus_hcop.tsv.gz +0 -0
  225. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_rat_hcop.tsv.gz +0 -0
  226. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_s.cerevisiae_hcop.tsv.gz +0 -0
  227. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_s.pombe_hcop.tsv.gz +0 -0
  228. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_xenopus_hcop.tsv.gz +0 -0
  229. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/hcop/data/human_zebrafish_hcop.tsv.gz +0 -0
  230. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/ncbi/data/gi/escherichia_coli_gene_info.tsv.gz +0 -0
  231. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/ncbi/data/gi/homo_sapiens_gene_info.tsv.gz +0 -0
  232. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/ncbi/data/gi/mus_musculus_gene_info.tsv.gz +0 -0
  233. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/omnipath/__init__.py +0 -0
  234. {bonesistools-1.5.0 → bonesistools-1.7.0}/src/bonesistools/resources/omnipath/__init__.pyi +0 -0
  235. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/__init__.py +0 -0
  236. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/LICENSE.txt +0 -0
  237. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/__init__.py +0 -0
  238. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/__init__.py +0 -0
  239. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/_boolean_workflow.py +0 -0
  240. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/data/README.md +0 -0
  241. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/data/sea_urchin_dorsal_ventral_axis.sbml +0 -0
  242. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/expected/death_receptor_cell_fate_mp.npz +0 -0
  243. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/expected/sea_urchin_dorsal_ventral_axis.bnet +0 -0
  244. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/expected/synthetic_30_node_dynamics.npz +0 -0
  245. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/test_golden_boolean_workflow.py +0 -0
  246. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/logic/test_golden_sea_urchin.py +0 -0
  247. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/__init__.py +0 -0
  248. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/expected/hvg_binning.npz +0 -0
  249. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/expected/hvg_loess.npz +0 -0
  250. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/expected/pca.npz +0 -0
  251. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/expected/qc.npz +0 -0
  252. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/expected/spectral.npz +0 -0
  253. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/pbmc3k.h5ad +0 -0
  254. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/golden/omics/test_pbmc3k.py +0 -0
  255. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/__init__.py +0 -0
  256. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/__init__.py +0 -0
  257. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/__init__.py +0 -0
  258. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_algebra.py +0 -0
  259. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_boolean.py +0 -0
  260. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_kleene.py +0 -0
  261. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_structure.py +0 -0
  262. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ba/test_typing.py +0 -0
  263. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/bn/__init__.py +0 -0
  264. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/conftest.py +0 -0
  265. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/__init__.py +0 -0
  266. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_scoring.py +0 -0
  267. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/ig/test_styles.py +0 -0
  268. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/io/__init__.py +0 -0
  269. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/logic/io/test_sbml.py +0 -0
  270. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/__init__.py +0 -0
  271. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/io/__init__.py +0 -0
  272. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/io/test_write.py +0 -0
  273. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/__init__.py +0 -0
  274. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_barplot.py +0 -0
  275. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_colors.py +0 -0
  276. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_density.py +0 -0
  277. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_distribution.py +0 -0
  278. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_figure.py +0 -0
  279. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pl/test_utils.py +0 -0
  280. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/__init__.py +0 -0
  281. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_qc.py +0 -0
  282. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_simple.py +0 -0
  283. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_transfer_obs.py +0 -0
  284. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/pp/test_transform.py +0 -0
  285. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/__init__.py +0 -0
  286. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_binarize.py +0 -0
  287. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_clustering.py +0 -0
  288. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_conversion.py +0 -0
  289. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_maths.py +0 -0
  290. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_paga.py +0 -0
  291. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_regress.py +0 -0
  292. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_stats.py +0 -0
  293. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/tl/test_utils.py +0 -0
  294. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/omics/toy_data.py +0 -0
  295. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/regression/test_validation.py +0 -0
  296. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/reproducibility/__init__.py +0 -0
  297. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/reproducibility/dorothea_legacy_mouse.sha256 +0 -0
  298. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/reproducibility/test_reproducibility_boolean_backends.py +0 -0
  299. {bonesistools-1.5.0 → bonesistools-1.7.0}/tests/reproducibility/test_reproducibility_stats.py +0 -0
@@ -69,6 +69,7 @@ Thumbs.db
69
69
 
70
70
  # Generated figures / graph exports
71
71
  *.dot
72
+ !tests/golden/logic/expected/*.dot
72
73
  *.dot.pdf
73
74
  *.gv
74
75
  *.gv.pdf
@@ -128,3 +129,4 @@ tests/reproducibility/*.json
128
129
  scripts/
129
130
  *.zginml
130
131
  !tests/golden/*.zginml
132
+ test_*/
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: bonesistools
3
- Version: 1.5.0
3
+ Version: 1.7.0
4
4
  Summary: Bioinformatics toolkit for upstream and downstream analyses around the BoNesis framework
5
5
  Project-URL: Repository, https://github.com/bnediction/bonesistools
6
6
  Author: Théo Roncalli
@@ -50,7 +50,6 @@ Provides-Extra: all
50
50
  Requires-Dist: graphviz>=0.20; extra == 'all'
51
51
  Requires-Dist: igraph>=0.10; extra == 'all'
52
52
  Requires-Dist: leidenalg>=0.10; extra == 'all'
53
- Requires-Dist: mpbn>=4.1; extra == 'all'
54
53
  Requires-Dist: mudata>=0.3.1; extra == 'all'
55
54
  Requires-Dist: multiprocess>=0.70.18; extra == 'all'
56
55
  Requires-Dist: numba>=0.60; (python_version >= '3.10') and extra == 'all'
@@ -58,8 +57,6 @@ Requires-Dist: pydot>=3.0.2; extra == 'all'
58
57
  Requires-Dist: scikit-misc>=0.5; (python_version >= '3.10') and extra == 'all'
59
58
  Requires-Dist: seaborn>=0.11; extra == 'all'
60
59
  Requires-Dist: umap-learn>=0.5; extra == 'all'
61
- Provides-Extra: bn
62
- Requires-Dist: mpbn>=4.1; extra == 'bn'
63
60
  Provides-Extra: graphviz
64
61
  Requires-Dist: graphviz>=0.20; extra == 'graphviz'
65
62
  Provides-Extra: mudata
@@ -79,7 +76,9 @@ Description-Content-Type: text/markdown
79
76
 
80
77
  # BoNesisTools
81
78
 
82
- `BoNesisTools` provides Python-implemented toolkits for upstream and downstream analyses around the [BoNesis](https://github.com/bnediction/bonesis) ecosystem.
79
+ Python toolkit for the executable Boolean modeling stack, from omics data to symbolic analyses.
80
+
81
+ `BoNesisTools` provides Python-implemented toolkits for the executable Boolean modeling stack, from omics data to symbolic analyses.
83
82
 
84
83
  The package provides:
85
84
 
@@ -182,11 +181,11 @@ Submodules:
182
181
  Example:
183
182
 
184
183
  ```python
185
- genesyn = bt.resources.ncbi.genesyn()
184
+ gene_identifiers = bt.resources.ncbi.identifiers()
186
185
 
187
186
  grn = bt.resources.omnipath.collectri(
188
187
  organism="mouse",
189
- genesyn=genesyn,
188
+ identifiers=gene_identifiers,
190
189
  )
191
190
  ```
192
191
 
@@ -5,7 +5,9 @@
5
5
 
6
6
  # BoNesisTools
7
7
 
8
- `BoNesisTools` provides Python-implemented toolkits for upstream and downstream analyses around the [BoNesis](https://github.com/bnediction/bonesis) ecosystem.
8
+ Python toolkit for the executable Boolean modeling stack, from omics data to symbolic analyses.
9
+
10
+ `BoNesisTools` provides Python-implemented toolkits for the executable Boolean modeling stack, from omics data to symbolic analyses.
9
11
 
10
12
  The package provides:
11
13
 
@@ -108,11 +110,11 @@ Submodules:
108
110
  Example:
109
111
 
110
112
  ```python
111
- genesyn = bt.resources.ncbi.genesyn()
113
+ gene_identifiers = bt.resources.ncbi.identifiers()
112
114
 
113
115
  grn = bt.resources.omnipath.collectri(
114
116
  organism="mouse",
115
- genesyn=genesyn,
117
+ identifiers=gene_identifiers,
116
118
  )
117
119
  ```
118
120
 
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "bonesistools"
7
7
  description = "Bioinformatics toolkit for upstream and downstream analyses around the BoNesis framework"
8
- version = "1.5.0"
8
+ version = "1.7.0"
9
9
  license = "CECILL-2.1"
10
10
  credits = ["BNeDiction", "PEPR Santé Numérique 2030"]
11
11
  authors = [
@@ -85,13 +85,9 @@ all = [
85
85
  "seaborn>=0.11",
86
86
  "scikit-misc>=0.5; python_version >= '3.10'",
87
87
  "umap-learn>=0.5",
88
- "mpbn>=4.1",
89
88
  ]
90
89
  graphviz = [ "graphviz>=0.20" ]
91
90
  mudata = [ "mudata>=0.3.1" ]
92
- bn = [
93
- "mpbn>=4.1",
94
- ]
95
91
  omics = [
96
92
  "igraph>=0.10",
97
93
  "leidenalg>=0.10",
@@ -101,7 +97,6 @@ omics = [
101
97
  ]
102
98
 
103
99
  [tool.hatch.build.targets.sdist]
104
- ignore-vcs = true
105
100
  include = [
106
101
  "/LICENSE",
107
102
  "/README.md",
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env python
2
+
3
+ import warnings
4
+ from functools import wraps
5
+ from typing import Any, Callable, Optional, TypeVar, cast
6
+
7
+ _F = TypeVar("_F", bound=Callable[..., Any])
8
+
9
+
10
+ def _warn_deprecated(
11
+ name: str,
12
+ *,
13
+ replacement: Optional[str] = None,
14
+ stacklevel: int = 2,
15
+ ) -> None:
16
+
17
+ message = f"{name} is deprecated and will be removed in 2.0.0"
18
+ if replacement is not None:
19
+ message = f"{message}; use {replacement} instead"
20
+ warnings.warn(f"{message}.", FutureWarning, stacklevel=stacklevel)
21
+
22
+
23
+ def _warn_deprecated_argument(
24
+ old_name: str,
25
+ new_name: str,
26
+ *,
27
+ stacklevel: int = 2,
28
+ ) -> None:
29
+
30
+ _warn_deprecated(
31
+ f"`{old_name}`",
32
+ replacement=f"`{new_name}`",
33
+ stacklevel=stacklevel,
34
+ )
35
+
36
+
37
+ def _deprecated(*, replacement: Optional[str] = None) -> Callable[[_F], _F]:
38
+ """Mark a callable as deprecated while preserving its public signature."""
39
+
40
+ def decorator(function: _F) -> _F:
41
+ @wraps(function)
42
+ def wrapped(*args: Any, **kwargs: Any) -> Any:
43
+ _warn_deprecated(
44
+ f"`{function.__qualname__}()`",
45
+ replacement=replacement,
46
+ stacklevel=3,
47
+ )
48
+ return function(*args, **kwargs)
49
+
50
+ return cast(_F, wrapped)
51
+
52
+ return decorator
53
+
54
+
55
+ def _rename_deprecated_arguments(**replacements: str) -> Callable[[_F], _F]:
56
+ """Accept deprecated keyword names while exposing the current signature."""
57
+
58
+ def decorator(function: _F) -> _F:
59
+ @wraps(function)
60
+ def wrapped(*args: Any, **kwargs: Any) -> Any:
61
+ for old_name, new_name in replacements.items():
62
+ if old_name not in kwargs:
63
+ continue
64
+
65
+ _warn_deprecated_argument(old_name, new_name, stacklevel=4)
66
+ if new_name in kwargs:
67
+ raise TypeError(
68
+ "invalid argument combination: use either "
69
+ f"'{old_name}' or '{new_name}', not both"
70
+ )
71
+ kwargs[new_name] = kwargs.pop(old_name)
72
+
73
+ return function(*args, **kwargs)
74
+
75
+ return cast(_F, wrapped)
76
+
77
+ return decorator
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from bisect import bisect_right
5
6
  from collections.abc import Iterable, Iterator, Mapping
6
7
  from itertools import product
7
8
  from typing import List, Optional, Sequence, Tuple, Union, overload
@@ -13,15 +14,20 @@ from ._typing import Configuration, ConfigurationLike, HypercubeLike
13
14
 
14
15
  _EncodedHypercube = Tuple[int, int]
15
16
 
17
+ try:
18
+ _INT_BIT_COUNT = int.bit_count
19
+ except AttributeError: # pragma: no cover - Python < 3.8
20
+ _INT_BIT_COUNT = None
21
+
16
22
 
17
23
  class ConfigurationSet:
18
24
  """
19
25
  Exact finite set of Boolean configurations.
20
26
 
21
27
  A ConfigurationSet represents a set of complete Boolean configurations over
22
- a fixed ordered list of components. The internal representation is compact
23
- and intentionally hidden from the public API: users interact with concrete
24
- configurations through membership, iteration, counting and sampling.
28
+ a fixed ordered list of components. Users can interact with complete
29
+ configurations through membership, iteration, counting and sampling, or
30
+ recover an exact decomposition into Boolean subspaces with `hypercubes()`.
25
31
 
26
32
  The stored representation is exact and non-redundant: adding a more general
27
33
  subspace removes more specific stored subspaces that it covers. The
@@ -124,9 +130,18 @@ class ConfigurationSet:
124
130
  if not isinstance(other, ConfigurationSet):
125
131
  return NotImplemented
126
132
 
133
+ if self is other:
134
+ return True
135
+
127
136
  if set(self._components) != set(other._components):
128
137
  return False
129
138
 
139
+ if self._components == other._components:
140
+ if self._hypercubes == other._hypercubes:
141
+ return True
142
+ if set(self._hypercubes) == set(other._hypercubes):
143
+ return True
144
+
130
145
  if self.count() != other.count():
131
146
  return False
132
147
 
@@ -181,6 +196,33 @@ class ConfigurationSet:
181
196
 
182
197
  return copied
183
198
 
199
+ def hypercubes(self) -> Tuple[Hypercube, ...]:
200
+ """
201
+ Return an exact, pairwise-disjoint hypercube decomposition.
202
+
203
+ The returned hypercubes collectively represent exactly the same
204
+ complete configurations as this set. Their order is unspecified, and
205
+ the decomposition is not guaranteed to use the globally minimal number
206
+ of hypercubes.
207
+
208
+ Examples
209
+ --------
210
+ >>> states = ConfigurationSet(["A", "B"], [{"B": 0}])
211
+ >>> states.hypercubes()
212
+ (Hypercube(B=0),)
213
+
214
+ Returns
215
+ -------
216
+ tuple of Hypercube
217
+ Independent hypercubes whose disjoint union is this configuration
218
+ set.
219
+ """
220
+
221
+ return tuple(
222
+ _decode_hypercube(hypercube, self._components)
223
+ for hypercube in self._hypercubes
224
+ )
225
+
184
226
  def add(
185
227
  self,
186
228
  configuration: Union[ConfigurationLike, HypercubeLike],
@@ -370,7 +412,33 @@ class ConfigurationSet:
370
412
  return self._sample_one(rng)
371
413
 
372
414
  n = _as_positive_integer(n, "n")
373
- return tuple(self._sample_one(rng) for _ in range(n))
415
+ cumulative_sizes = []
416
+ total = 0
417
+ for hypercube in self._hypercubes:
418
+ total += _count_hypercube_configurations(
419
+ hypercube,
420
+ len(self._components),
421
+ )
422
+ cumulative_sizes.append(total)
423
+
424
+ sampled = []
425
+ for _ in range(n):
426
+ index = int(
427
+ rng.randint(total) # pyright: ignore[reportAttributeAccessIssue]
428
+ )
429
+ hypercube_index = bisect_right(cumulative_sizes, index)
430
+ previous_size = (
431
+ cumulative_sizes[hypercube_index - 1] if hypercube_index > 0 else 0
432
+ )
433
+ sampled.append(
434
+ _configuration_at_index(
435
+ self._hypercubes[hypercube_index],
436
+ self._components,
437
+ index - previous_size,
438
+ )
439
+ )
440
+
441
+ return tuple(sampled)
374
442
 
375
443
  @classmethod
376
444
  def _from_encoded_hypercubes(
@@ -445,13 +513,6 @@ class ConfigurationSet:
445
513
  for hypercube in other._hypercubes
446
514
  )
447
515
 
448
- def _as_hypercubes(self) -> Tuple[Hypercube, ...]:
449
-
450
- return tuple(
451
- _decode_hypercube(hypercube, self._components)
452
- for hypercube in self._hypercubes
453
- )
454
-
455
516
  def _iter_encoded_hypercubes(self) -> Iterator[_EncodedHypercube]:
456
517
 
457
518
  return iter(self._hypercubes)
@@ -497,12 +558,18 @@ def _coerce_components(components: Iterable[str]) -> Tuple[str, ...]:
497
558
  if not all(isinstance(component, str) for component in resolved):
498
559
  raise TypeError("components must be an iterable of strings")
499
560
 
500
- duplicated = sorted(
501
- component for component in set(resolved) if resolved.count(component) > 1
502
- )
561
+ seen = set()
562
+ duplicated = set()
563
+ for component in resolved:
564
+ if component in seen:
565
+ duplicated.add(component)
566
+ else:
567
+ seen.add(component)
568
+
503
569
  if duplicated:
504
570
  raise ValueError(
505
- f"components must be unique; duplicated components: {', '.join(duplicated)}"
571
+ "components must be unique; duplicated components: "
572
+ f"{', '.join(sorted(duplicated))}"
506
573
  )
507
574
 
508
575
  return resolved
@@ -740,4 +807,7 @@ def _component_values(
740
807
 
741
808
  def _bit_count(mask: int) -> int:
742
809
 
810
+ if _INT_BIT_COUNT is not None:
811
+ return _INT_BIT_COUNT(mask)
812
+
743
813
  return bin(mask).count("1")
@@ -174,10 +174,13 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
174
174
  return len(self._values)
175
175
 
176
176
  @overload
177
- def update(self, mapping: Mapping[str, PartialBooleanLike]) -> None: ...
177
+ def update(self, __mapping: Mapping[str, PartialBooleanLike]) -> None: ...
178
178
 
179
179
  @overload
180
- def update(self, mapping: Iterable[Tuple[str, PartialBooleanLike]]) -> None: ...
180
+ def update(
181
+ self,
182
+ __mapping: Iterable[Tuple[str, PartialBooleanLike]],
183
+ ) -> None: ...
181
184
 
182
185
  @overload
183
186
  def update(self, **kwargs: PartialBooleanLike) -> None: ...
@@ -657,11 +660,18 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
657
660
 
658
661
  return other <= self
659
662
 
660
- def identical(self, other: object) -> Set[str]:
663
+ def identical(
664
+ self,
665
+ other: object,
666
+ *,
667
+ components: Optional[Iterable[str]] = None,
668
+ ) -> Set[str]:
661
669
  """
662
670
  Return components sharing identical values.
663
671
 
664
- Missing components are interpreted as free values.
672
+ Missing components are interpreted as free values. An explicit
673
+ component domain can restrict or expand the components represented by
674
+ the two hypercubes.
665
675
 
666
676
  Examples
667
677
  --------
@@ -669,11 +679,16 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
669
679
  >>> hc2 = Hypercube({"A": 0, "C": "*"})
670
680
  >>> sorted(hc1.identical(hc2))
671
681
  ['A', 'B', 'C']
682
+ >>> sorted(hc1.identical(hc2, components={"A", "B", "C", "D"}))
683
+ ['A', 'B', 'C', 'D']
672
684
 
673
685
  Parameters
674
686
  ----------
675
687
  other: object
676
688
  Hypercube-like object to compare.
689
+ components: Iterable[str], optional
690
+ Components to compare. If `None`, use the union of components
691
+ explicitly represented by both hypercubes.
677
692
 
678
693
  Returns
679
694
  -------
@@ -689,20 +704,32 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
689
704
  """
690
705
 
691
706
  other = self._coerce_hypercube(other)
707
+ selected_components = (
708
+ self.components | other.components
709
+ if components is None
710
+ else set(components)
711
+ )
692
712
 
693
713
  identical = set()
694
714
 
695
- for component in self.components | other.components:
715
+ for component in selected_components:
696
716
  if self._get_value(component) == other._get_value(component):
697
717
  identical.add(component)
698
718
 
699
719
  return identical
700
720
 
701
- def different(self, other: object) -> Set[str]:
721
+ def different(
722
+ self,
723
+ other: object,
724
+ *,
725
+ components: Optional[Iterable[str]] = None,
726
+ ) -> Set[str]:
702
727
  """
703
728
  Return components with different values.
704
729
 
705
- Missing components are interpreted as free values.
730
+ Missing components are interpreted as free values. An explicit
731
+ component domain can restrict or expand the components represented by
732
+ the two hypercubes.
706
733
 
707
734
  Examples
708
735
  --------
@@ -710,11 +737,16 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
710
737
  >>> hc2 = Hypercube({"A": 0, "B": "*", "C": 1})
711
738
  >>> sorted(hc1.different(hc2))
712
739
  ['B', 'C']
740
+ >>> sorted(hc1.different(hc2, components={"A", "B", "D"}))
741
+ ['B']
713
742
 
714
743
  Parameters
715
744
  ----------
716
745
  other: object
717
746
  Hypercube-like object to compare.
747
+ components: Iterable[str], optional
748
+ Components to compare. If `None`, use the union of components
749
+ explicitly represented by both hypercubes.
718
750
 
719
751
  Returns
720
752
  -------
@@ -730,15 +762,97 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
730
762
  """
731
763
 
732
764
  other = self._coerce_hypercube(other)
765
+ selected_components = (
766
+ self.components | other.components
767
+ if components is None
768
+ else set(components)
769
+ )
733
770
 
734
771
  different = set()
735
772
 
736
- for component in self.components | other.components:
773
+ for component in selected_components:
737
774
  if self._get_value(component) != other._get_value(component):
738
775
  different.add(component)
739
776
 
740
777
  return different
741
778
 
779
+ def changes(
780
+ self,
781
+ other: HypercubeLike,
782
+ *,
783
+ components: Optional[Iterable[str]] = None,
784
+ ) -> Tuple[FrozenSet[str], FrozenSet[str], FrozenSet[str]]:
785
+ """
786
+ Classify component changes from this hypercube to another one.
787
+
788
+ Missing components are interpreted as free values. A change between
789
+ fixed values is a flip, a change from free to fixed is a
790
+ stabilization, and a change from fixed to free is a destabilization.
791
+
792
+ Examples
793
+ --------
794
+ >>> source = Hypercube({"A": 0, "B": "*", "C": 1})
795
+ >>> target = Hypercube({"A": 1, "B": 0, "C": "*"})
796
+ >>> flips, stabilizations, destabilizations = source.changes(target)
797
+ >>> flips
798
+ frozenset({'A'})
799
+ >>> stabilizations
800
+ frozenset({'B'})
801
+ >>> destabilizations
802
+ frozenset({'C'})
803
+
804
+ Parameters
805
+ ----------
806
+ other: HypercubeLike
807
+ Target hypercube.
808
+ components: Iterable[str], optional
809
+ Components to compare. If `None`, use the union of components
810
+ explicitly represented by both hypercubes.
811
+
812
+ Returns
813
+ -------
814
+ tuple of frozenset[str]
815
+ Flips, stabilizations and destabilizations, in that order.
816
+
817
+ Raises
818
+ ------
819
+ TypeError
820
+ If `other` cannot be interpreted as a hypercube.
821
+ ValueError
822
+ If `other` contains unsupported PartialBoolean values.
823
+ """
824
+
825
+ other_hypercube = self._coerce_hypercube(other)
826
+ selected_components = (
827
+ self.components | other_hypercube.components
828
+ if components is None
829
+ else set(components)
830
+ )
831
+
832
+ flips: Set[str] = set()
833
+ stabilizations: Set[str] = set()
834
+ destabilizations: Set[str] = set()
835
+
836
+ for component in selected_components:
837
+ source_value = self._get_value(component)
838
+ target_value = other_hypercube._get_value(component)
839
+
840
+ if source_value == target_value:
841
+ continue
842
+
843
+ if source_value.is_fixed and target_value.is_fixed:
844
+ flips.add(component)
845
+ elif source_value.is_free:
846
+ stabilizations.add(component)
847
+ else:
848
+ destabilizations.add(component)
849
+
850
+ return (
851
+ frozenset(flips),
852
+ frozenset(stabilizations),
853
+ frozenset(destabilizations),
854
+ )
855
+
742
856
  def is_smaller_than(self, other: object) -> bool:
743
857
  """
744
858
  Test whether the hypercube is included in another hypercube.