bonesistools 1.2.4__tar.gz → 1.2.5__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 (154) hide show
  1. {bonesistools-1.2.4 → bonesistools-1.2.5}/.gitignore +1 -0
  2. {bonesistools-1.2.4 → bonesistools-1.2.5}/PKG-INFO +9 -4
  3. {bonesistools-1.2.4 → bonesistools-1.2.5}/README.md +1 -1
  4. {bonesistools-1.2.4 → bonesistools-1.2.5}/pyproject.toml +13 -3
  5. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/__init__.py +4 -8
  6. bonesistools-1.2.5/src/bonesistools/_typing.py +13 -0
  7. bonesistools-1.2.5/src/bonesistools/_validation.py +388 -0
  8. bonesistools-1.2.5/src/bonesistools/_warnings.py +31 -0
  9. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/__init__.py +4 -5
  10. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_algebra.py +1 -0
  11. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_hypercube.py +41 -0
  12. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_parser.py +20 -17
  13. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_structure.py +10 -5
  14. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_typing.py +1 -0
  15. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_network/__init__.py +4 -6
  16. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_network/_network.py +43 -21
  17. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/influence_graph/__init__.py +3 -0
  18. bonesistools-1.2.5/src/bonesistools/boolpy/influence_graph/_distances.py +192 -0
  19. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/influence_graph/_influence_graph.py +50 -49
  20. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/influence_graph/_parser.py +1 -4
  21. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/influence_graph/_scoring.py +13 -15
  22. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/plotting/_graphviz.py +3 -0
  23. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/_orthologs.py +70 -55
  24. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/ncbi/_genesyn.py +24 -42
  25. bonesistools-1.2.5/src/bonesistools/databases/ncbi/_typing.py +18 -0
  26. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/omnipath/_archive.py +24 -0
  27. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/omnipath/_collectri.py +23 -37
  28. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/omnipath/_dorothea.py +30 -27
  29. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/_dependencies.py +0 -35
  30. bonesistools-1.2.5/src/bonesistools/sctools/_metadata.py +21 -0
  31. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/_typing.py +39 -15
  32. bonesistools-1.2.5/src/bonesistools/sctools/_validation.py +130 -0
  33. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_barplot.py +94 -5
  34. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_colors.py +12 -27
  35. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_density.py +125 -21
  36. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_distribution.py +136 -12
  37. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_figure.py +2 -1
  38. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_graph.py +78 -19
  39. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_scatterplot.py +91 -49
  40. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/preprocessing/__init__.py +4 -5
  41. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/preprocessing/_duplicates.py +86 -12
  42. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/preprocessing/_genename.py +91 -24
  43. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/preprocessing/_simple.py +32 -57
  44. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/preprocessing/_transfer.py +176 -36
  45. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/__init__.py +17 -10
  46. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/_classification.py +100 -40
  47. bonesistools-1.2.5/src/bonesistools/sctools/tools/_clustering.py +264 -0
  48. bonesistools-1.2.5/src/bonesistools/sctools/tools/_embedding.py +719 -0
  49. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/_graph.py +9 -21
  50. bonesistools-1.2.5/src/bonesistools/sctools/tools/_markers.py +625 -0
  51. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/_maths.py +52 -9
  52. bonesistools-1.2.5/src/bonesistools/sctools/tools/_neighbors.py +1915 -0
  53. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/_regress.py +44 -4
  54. bonesistools-1.2.5/src/bonesistools/sctools/tools/_stats.py +494 -0
  55. bonesistools-1.2.5/src/bonesistools/sctools/tools/_utils.py +442 -0
  56. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/_write.py +2 -0
  57. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_aggregated_influence_graph.py +26 -18
  58. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_boolean_algebra.py +5 -4
  59. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_boolean_network.py +41 -27
  60. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_boolean_network_ensemble.py +23 -11
  61. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_hypercube.py +8 -6
  62. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_hypercube_collection.py +4 -3
  63. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_influence_graph.py +34 -18
  64. bonesistools-1.2.5/tests/bpy/test_influence_graph_distances.py +219 -0
  65. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_influence_graph_parser.py +11 -6
  66. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/dbs/test_hcop.py +107 -2
  67. bonesistools-1.2.5/tests/dbs/test_hcop_orthologs.py +217 -0
  68. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/dbs/test_ncbi.py +162 -8
  69. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/dbs/test_omnipath.py +15 -13
  70. bonesistools-1.2.4/tests/dbs/test_omnipath_reproducibility.py → bonesistools-1.2.5/tests/reproducibility/test_reproducibility_omnipath.py +6 -9
  71. bonesistools-1.2.5/tests/reproducibility/test_reproducibility_stats.py +35 -0
  72. bonesistools-1.2.5/tests/reproducibility/test_reproducibility_workflow.py +243 -0
  73. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/conftest.py +3 -2
  74. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_barplot.py +34 -7
  75. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_colors.py +3 -2
  76. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_density.py +1 -1
  77. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_distribution.py +44 -16
  78. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_figure.py +2 -0
  79. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_graph.py +2 -2
  80. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/plotting/test_scatterplot.py +33 -5
  81. bonesistools-1.2.5/tests/sct/preprocessing/test_duplicates.py +201 -0
  82. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/preprocessing/test_genename.py +42 -32
  83. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/preprocessing/test_simple.py +14 -12
  84. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/preprocessing/test_transfer_obs.py +7 -2
  85. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/test_typing.py +7 -4
  86. bonesistools-1.2.5/tests/sct/tools/test_clustering.py +101 -0
  87. bonesistools-1.2.5/tests/sct/tools/test_conversion.py +48 -0
  88. bonesistools-1.2.5/tests/sct/tools/test_embedding.py +464 -0
  89. bonesistools-1.2.5/tests/sct/tools/test_graph_neighbors_classification.py +517 -0
  90. bonesistools-1.2.4/tests/sct/tools/test_knnbs.py → bonesistools-1.2.5/tests/sct/tools/test_knnsc.py +276 -73
  91. bonesistools-1.2.5/tests/sct/tools/test_markers.py +492 -0
  92. bonesistools-1.2.5/tests/sct/tools/test_maths.py +47 -0
  93. bonesistools-1.2.5/tests/sct/tools/test_stats.py +550 -0
  94. bonesistools-1.2.5/tests/sct/tools/test_utils.py +207 -0
  95. bonesistools-1.2.5/tests/test_validation.py +39 -0
  96. bonesistools-1.2.4/src/bonesistools/databases/ncbi/_typing.py +0 -6
  97. bonesistools-1.2.4/src/bonesistools/sctools/tools/_markers.py +0 -375
  98. bonesistools-1.2.4/src/bonesistools/sctools/tools/_neighbors.py +0 -993
  99. bonesistools-1.2.4/src/bonesistools/sctools/tools/_utils.py +0 -232
  100. bonesistools-1.2.4/tests/dbs/test_hcop_orthologs.py +0 -105
  101. bonesistools-1.2.4/tests/sct/tools/test_graph_neighbors_classification.py +0 -186
  102. bonesistools-1.2.4/tests/sct/tools/test_utils_conversion_maths.py +0 -533
  103. {bonesistools-1.2.4 → bonesistools-1.2.5}/LICENSE +0 -0
  104. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/_compat.py +0 -0
  105. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/__init__.py +0 -0
  106. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_boolean.py +0 -0
  107. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_algebra/_representation.py +0 -0
  108. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_network/_parser.py +0 -0
  109. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/boolean_network/_typing.py +0 -0
  110. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/influence_graph/_algorithms.py +0 -0
  111. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/influence_graph/_typing.py +0 -0
  112. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/plotting/__init__.py +0 -0
  113. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/plotting/_styles.py +0 -0
  114. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/boolpy/plotting/_svg.py +0 -0
  115. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/__init__.py +0 -0
  116. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/__init__.py +0 -0
  117. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_anole_lizard_hcop.tsv.gz +0 -0
  118. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_c.elegans_hcop.tsv.gz +0 -0
  119. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_cat_hcop.tsv.gz +0 -0
  120. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_cattle_hcop.tsv.gz +0 -0
  121. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_chicken_hcop.tsv.gz +0 -0
  122. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_chimpanzee_hcop.tsv.gz +0 -0
  123. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_dog_hcop.tsv.gz +0 -0
  124. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_fruitfly_hcop.tsv.gz +0 -0
  125. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_horse_hcop.tsv.gz +0 -0
  126. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_macaque_hcop.tsv.gz +0 -0
  127. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_mouse_hcop.tsv.gz +0 -0
  128. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_opossum_hcop.tsv.gz +0 -0
  129. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_pig_hcop.tsv.gz +0 -0
  130. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_platypus_hcop.tsv.gz +0 -0
  131. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_rat_hcop.tsv.gz +0 -0
  132. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_s.cerevisiae_hcop.tsv.gz +0 -0
  133. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_s.pombe_hcop.tsv.gz +0 -0
  134. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_xenopus_hcop.tsv.gz +0 -0
  135. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/hcop/data/human_zebrafish_hcop.tsv.gz +0 -0
  136. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/ncbi/__init__.py +0 -0
  137. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/ncbi/data/gi/escherichia_coli_gene_info.tsv.gz +0 -0
  138. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/ncbi/data/gi/homo_sapiens_gene_info.tsv.gz +0 -0
  139. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/ncbi/data/gi/mus_musculus_gene_info.tsv.gz +0 -0
  140. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/databases/omnipath/__init__.py +0 -0
  141. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/grntools/__init__.py +0 -0
  142. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/py.typed +0 -0
  143. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/__init__.py +0 -0
  144. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/datasets/__init__.py +0 -0
  145. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/datasets/nestorowa_hvg.h5ad +0 -0
  146. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/__init__.py +0 -0
  147. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_typing.py +0 -0
  148. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/plotting/_utils.py +0 -0
  149. {bonesistools-1.2.4 → bonesistools-1.2.5}/src/bonesistools/sctools/tools/_conversion.py +0 -0
  150. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/conftest.py +0 -0
  151. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_influence_graph_scoring.py +0 -0
  152. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_partial_boolean.py +0 -0
  153. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/bpy/test_plotting_styles.py +0 -0
  154. {bonesistools-1.2.4 → bonesistools-1.2.5}/tests/sct/tools/test_write.py +0 -0
@@ -111,6 +111,7 @@ src/bonesistools/databases/omnipath/.cache/
111
111
  !tests/data/
112
112
  !tests/data/*.h5ad
113
113
  tests/dbs/data/*.json
114
+ tests/reproducibility/*.json
114
115
  !src/bonesistools/sctools/datasets/
115
116
  !src/bonesistools/sctools/datasets/*.h5ad
116
117
  scripts/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bonesistools
3
- Version: 1.2.4
3
+ Version: 1.2.5
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
@@ -556,16 +556,19 @@ Requires-Dist: matplotlib>=3.5
556
556
  Requires-Dist: networkx>=2.1
557
557
  Requires-Dist: numpy>=1.21
558
558
  Requires-Dist: pandas>=1.3.5
559
+ Requires-Dist: scikit-learn>=1.0
559
560
  Requires-Dist: scipy>=1.7
560
561
  Requires-Dist: typing-extensions>=4.0
561
562
  Provides-Extra: all
562
563
  Requires-Dist: graphviz>=0.20; extra == 'all'
564
+ Requires-Dist: igraph>=0.10; extra == 'all'
565
+ Requires-Dist: leidenalg>=0.10; extra == 'all'
563
566
  Requires-Dist: mpbn>=4.1; extra == 'all'
564
567
  Requires-Dist: mudata>=0.3.1; extra == 'all'
565
568
  Requires-Dist: multiprocess>=0.70.18; extra == 'all'
566
569
  Requires-Dist: pydot>=3.0.2; extra == 'all'
567
- Requires-Dist: scikit-learn>=1.0; extra == 'all'
568
570
  Requires-Dist: seaborn>=0.11; extra == 'all'
571
+ Requires-Dist: umap-learn>=0.5; extra == 'all'
569
572
  Provides-Extra: graphviz
570
573
  Requires-Dist: graphviz>=0.20; extra == 'graphviz'
571
574
  Provides-Extra: mpbn
@@ -573,7 +576,9 @@ Requires-Dist: mpbn>=4.1; extra == 'mpbn'
573
576
  Provides-Extra: mudata
574
577
  Requires-Dist: mudata>=0.3.1; extra == 'mudata'
575
578
  Provides-Extra: sctools
576
- Requires-Dist: scikit-learn>=1.0; extra == 'sctools'
579
+ Requires-Dist: igraph>=0.10; extra == 'sctools'
580
+ Requires-Dist: leidenalg>=0.10; extra == 'sctools'
581
+ Requires-Dist: umap-learn>=0.5; extra == 'sctools'
577
582
  Description-Content-Type: text/markdown
578
583
 
579
584
  [![tests](https://github.com/bnediction/bonesistools/actions/workflows/tests.yml/badge.svg)](https://github.com/bnediction/bonesistools/actions/workflows/tests.yml)
@@ -611,7 +616,7 @@ import bonesistools as bt
611
616
 
612
617
  ## Single-cell tools
613
618
 
614
- `bt.sct` follows a [Scanpy](https://github.com/scverse/scanpy)-like API while providing additional and complementary features for single-cell analyses.
619
+ `bt.sct` is inspired by [Scanpy](https://github.com/scverse/scanpy) while providing additional and complementary features for single-cell analyses.
615
620
 
616
621
  Submodules:
617
622
 
@@ -33,7 +33,7 @@ import bonesistools as bt
33
33
 
34
34
  ## Single-cell tools
35
35
 
36
- `bt.sct` follows a [Scanpy](https://github.com/scverse/scanpy)-like API while providing additional and complementary features for single-cell analyses.
36
+ `bt.sct` is inspired by [Scanpy](https://github.com/scverse/scanpy) while providing additional and complementary features for single-cell analyses.
37
37
 
38
38
  Submodules:
39
39
 
@@ -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.2.4"
8
+ version = "1.2.5"
9
9
  license = {file = "LICENSE"}
10
10
  credits = ["BNeDiction", "PEPR Santé Numérique 2030"]
11
11
  authors = [
@@ -46,6 +46,7 @@ dependencies = [
46
46
  "numpy>=1.21",
47
47
  "pandas>=1.3.5",
48
48
  "scipy>=1.7",
49
+ "scikit-learn>=1.0",
49
50
  "networkx>=2.1",
50
51
  "matplotlib>=3.5",
51
52
  "h5py>=3.7",
@@ -71,14 +72,20 @@ all = [
71
72
  "mudata>=0.3.1",
72
73
  "multiprocess>=0.70.18",
73
74
  "pydot>=3.0.2",
74
- "scikit-learn>=1.0",
75
+ "igraph>=0.10",
76
+ "leidenalg>=0.10",
75
77
  "seaborn>=0.11",
78
+ "umap-learn>=0.5",
76
79
  "mpbn>=4.1",
77
80
  ]
78
81
  graphviz = [ "graphviz>=0.20" ]
79
82
  mudata = [ "mudata>=0.3.1" ]
80
83
  mpbn = [ "mpbn>=4.1" ]
81
- sctools = [ "scikit-learn>=1.0" ]
84
+ sctools = [
85
+ "igraph>=0.10",
86
+ "leidenalg>=0.10",
87
+ "umap-learn>=0.5",
88
+ ]
82
89
 
83
90
  [tool.hatch.build.targets.sdist]
84
91
  ignore-vcs = true
@@ -113,6 +120,9 @@ select = ["E", "F", "I"]
113
120
  typing-modules = ["bonesistools._compat"]
114
121
 
115
122
  [tool.pytest.ini_options]
123
+ norecursedirs = [
124
+ "tests/reproducibility",
125
+ ]
116
126
  filterwarnings = [
117
127
  "ignore:The NumPy module was reloaded:UserWarning",
118
128
  ]
@@ -22,7 +22,6 @@ from __future__ import annotations
22
22
 
23
23
  import importlib as _importlib
24
24
  import sys as _sys
25
- import warnings as _warnings
26
25
  from types import ModuleType as _ModuleType
27
26
  from typing import TYPE_CHECKING as _TYPE_CHECKING
28
27
  from typing import List as _List
@@ -30,6 +29,7 @@ from typing import List as _List
30
29
  from . import boolpy as bpy
31
30
  from . import databases as dbs
32
31
  from . import sctools as sct
32
+ from ._warnings import _warn_deprecated
33
33
 
34
34
  if _TYPE_CHECKING:
35
35
  from . import grntools as grn
@@ -66,13 +66,9 @@ _sys.modules.update(
66
66
 
67
67
  def __getattr__(name: str) -> _ModuleType:
68
68
  if name == "grn":
69
- message = (
70
- "`bt.grn` is deprecated and will be removed in a future release; "
71
- "use `bt.bpy.ig` instead."
72
- )
73
- _warnings.warn(
74
- message,
75
- FutureWarning,
69
+ _warn_deprecated(
70
+ "`bt.grn`",
71
+ replacement="`bt.bpy.ig`",
76
72
  stacklevel=2,
77
73
  )
78
74
 
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env python
2
+
3
+ from types import ModuleType
4
+ from typing import Optional, Union
5
+
6
+ import numpy as np
7
+
8
+ from ._compat import Literal
9
+
10
+ RandomStateSeed = Optional[Union[int, np.random.RandomState, ModuleType]]
11
+ AutoInteger = Union[int, Literal["auto"]]
12
+ DataFrameAxis = Literal["index", "columns"]
13
+ FileOrientation = Literal["rows", "columns"]
@@ -0,0 +1,388 @@
1
+ #!/usr/bin/env python
2
+
3
+ import numbers
4
+ import re
5
+ from typing import Callable, Iterable, Optional, TypeVar, Union, overload
6
+
7
+ import numpy as np
8
+
9
+ from ._compat import Literal
10
+ from ._typing import (
11
+ DataFrameAxis,
12
+ FileOrientation,
13
+ RandomStateSeed,
14
+ )
15
+
16
+ T = TypeVar("T", bound=str)
17
+ F = TypeVar("F", bound=Callable[..., object])
18
+
19
+ _MEMORY_SIZE_PATTERN = re.compile(
20
+ r"^\s*(?P<value>[0-9]+(?:\.[0-9]+)?)\s*(?P<unit>[KMGT]i?B)\s*$",
21
+ re.IGNORECASE,
22
+ )
23
+ _MEMORY_SIZE_UNITS = {
24
+ "KB": 10**3,
25
+ "MB": 10**6,
26
+ "GB": 10**9,
27
+ "TB": 10**12,
28
+ "KIB": 2**10,
29
+ "MIB": 2**20,
30
+ "GIB": 2**30,
31
+ "TIB": 2**40,
32
+ }
33
+
34
+
35
+ def _format_choices(choices: Iterable[str], *, include_none: bool = False) -> str:
36
+
37
+ choices = tuple(choices)
38
+ formatted = tuple(repr(choice) for choice in choices)
39
+ if include_none:
40
+ formatted = formatted + ("None",)
41
+ if len(formatted) == 1:
42
+ return formatted[0]
43
+ if len(formatted) == 2:
44
+ return f"{formatted[0]} or {formatted[1]}"
45
+ return f"{', '.join(formatted[:-1])} or {formatted[-1]}"
46
+
47
+
48
+ @overload
49
+ def _as_literal(
50
+ value: str,
51
+ *,
52
+ choices: Iterable[T],
53
+ name: str,
54
+ allow_none: Literal[False] = False,
55
+ ) -> T: ...
56
+
57
+
58
+ @overload
59
+ def _as_literal(
60
+ value: Optional[str],
61
+ *,
62
+ choices: Iterable[T],
63
+ name: str,
64
+ allow_none: Literal[True],
65
+ ) -> Optional[T]: ...
66
+
67
+
68
+ def _as_literal(
69
+ value: Optional[str],
70
+ *,
71
+ choices: Iterable[T],
72
+ name: str,
73
+ allow_none: bool = False,
74
+ ) -> Optional[T]:
75
+
76
+ if value is None and allow_none:
77
+ return None
78
+
79
+ if not isinstance(value, str):
80
+ expected = f"{str} or None" if allow_none else str
81
+ raise TypeError(
82
+ f"unsupported argument type for '{name}': "
83
+ f"expected {expected} but received {type(value)}"
84
+ )
85
+
86
+ resolved_choices = tuple(choices)
87
+ for choice in resolved_choices:
88
+ if value == choice:
89
+ return choice
90
+
91
+ expected = _format_choices(resolved_choices, include_none=allow_none)
92
+ raise ValueError(
93
+ f"invalid argument value for '{name}': "
94
+ f"expected one of {expected} but received {value!r}"
95
+ )
96
+
97
+
98
+ @overload
99
+ def _as_string(
100
+ value: str,
101
+ name: str,
102
+ *,
103
+ allow_none: Literal[False] = False,
104
+ ) -> str: ...
105
+
106
+
107
+ @overload
108
+ def _as_string(
109
+ value: Optional[str],
110
+ name: str,
111
+ *,
112
+ allow_none: Literal[True],
113
+ ) -> Optional[str]: ...
114
+
115
+
116
+ def _as_string(
117
+ value: Optional[str],
118
+ name: str,
119
+ *,
120
+ allow_none: bool = False,
121
+ ) -> Optional[str]:
122
+
123
+ if value is None and allow_none:
124
+ return None
125
+
126
+ if not isinstance(value, str):
127
+ expected = f"{str} or None" if allow_none else str
128
+ raise TypeError(
129
+ f"unsupported argument type for '{name}': "
130
+ f"expected {expected} but received {type(value)}"
131
+ )
132
+
133
+ return value
134
+
135
+
136
+ @overload
137
+ def _as_boolean(
138
+ value: bool,
139
+ name: str,
140
+ *,
141
+ allow_none: Literal[False] = False,
142
+ ) -> bool: ...
143
+
144
+
145
+ @overload
146
+ def _as_boolean(
147
+ value: Optional[bool],
148
+ name: str,
149
+ *,
150
+ allow_none: Literal[True],
151
+ ) -> Optional[bool]: ...
152
+
153
+
154
+ def _as_boolean(
155
+ value: Optional[bool],
156
+ name: str,
157
+ *,
158
+ allow_none: bool = False,
159
+ ) -> Optional[bool]:
160
+
161
+ if value is None and allow_none:
162
+ return None
163
+
164
+ if not isinstance(value, bool):
165
+ expected = f"{bool} or None" if allow_none else bool
166
+ raise TypeError(
167
+ f"unsupported argument type for '{name}': "
168
+ f"expected {expected} but received {type(value)}"
169
+ )
170
+
171
+ return value
172
+
173
+
174
+ @overload
175
+ def _as_callable(
176
+ value: F,
177
+ name: str,
178
+ *,
179
+ allow_none: Literal[False] = False,
180
+ ) -> F: ...
181
+
182
+
183
+ @overload
184
+ def _as_callable(
185
+ value: Optional[F],
186
+ name: str,
187
+ *,
188
+ allow_none: Literal[True],
189
+ ) -> Optional[F]: ...
190
+
191
+
192
+ def _as_callable(
193
+ value: Optional[F],
194
+ name: str,
195
+ *,
196
+ allow_none: bool = False,
197
+ ) -> Optional[F]:
198
+
199
+ if value is None and allow_none:
200
+ return None
201
+
202
+ if not callable(value):
203
+ expected = "callable object or None" if allow_none else "callable object"
204
+ raise TypeError(
205
+ f"unsupported argument type for '{name}': "
206
+ f"expected {expected} but received {type(value)}"
207
+ )
208
+
209
+ return value
210
+
211
+
212
+ def _as_positive_number(value: float, name: str) -> float:
213
+
214
+ if not isinstance(value, (int, float)) or isinstance(value, bool):
215
+ raise TypeError(
216
+ f"unsupported argument type for '{name}': "
217
+ f"expected {float} but received {type(value)}"
218
+ )
219
+
220
+ value = float(value)
221
+ if value <= 0:
222
+ raise ValueError(
223
+ f"invalid argument value for '{name}': "
224
+ f"expected positive value but received {value!r}"
225
+ )
226
+
227
+ return value
228
+
229
+
230
+ def _as_non_negative_number(value: float, name: str) -> float:
231
+
232
+ if not isinstance(value, (int, float)) or isinstance(value, bool):
233
+ raise TypeError(
234
+ f"unsupported argument type for '{name}': "
235
+ f"expected {float} but received {type(value)}"
236
+ )
237
+
238
+ value = float(value)
239
+ if value < 0:
240
+ raise ValueError(
241
+ f"invalid argument value for '{name}': "
242
+ f"expected non-negative value but received {value!r}"
243
+ )
244
+
245
+ return value
246
+
247
+
248
+ def _as_positive_integer(value: Union[int, float], name: str) -> int:
249
+
250
+ if not isinstance(value, (int, float)) or isinstance(value, bool):
251
+ raise TypeError(
252
+ f"unsupported argument type for '{name}': "
253
+ f"expected {int} but received {type(value)}"
254
+ )
255
+
256
+ if value <= 0:
257
+ raise ValueError(
258
+ f"invalid argument value for '{name}': "
259
+ f"expected non-null positive value but received {value!r}"
260
+ )
261
+
262
+ if isinstance(value, float) and not value.is_integer():
263
+ raise ValueError(
264
+ f"invalid argument value for '{name}': "
265
+ f"expected integer but received {value!r}"
266
+ )
267
+
268
+ return int(value)
269
+
270
+
271
+ def _as_non_negative_integer(value: Union[int, float], name: str) -> int:
272
+
273
+ if not isinstance(value, (int, float)) or isinstance(value, bool):
274
+ raise TypeError(
275
+ f"unsupported argument type for '{name}': "
276
+ f"expected {int} but received {type(value)}"
277
+ )
278
+
279
+ if value < 0:
280
+ raise ValueError(
281
+ f"invalid argument value for '{name}': "
282
+ f"expected non-negative value but received {value!r}"
283
+ )
284
+
285
+ if isinstance(value, float) and not value.is_integer():
286
+ raise ValueError(
287
+ f"invalid argument value for '{name}': "
288
+ f"expected integer but received {value!r}"
289
+ )
290
+
291
+ return int(value)
292
+
293
+
294
+ def _as_memory_size(value: Union[int, str], name: str) -> int:
295
+
296
+ if isinstance(value, bool) or not isinstance(value, (int, str)):
297
+ raise TypeError(
298
+ f"unsupported argument type for '{name}': "
299
+ f"expected {int} or {str} but received {type(value)}"
300
+ )
301
+
302
+ if isinstance(value, int):
303
+ if value <= 0:
304
+ raise ValueError(
305
+ f"invalid argument value for '{name}': "
306
+ f"expected positive memory size but received {value!r}"
307
+ )
308
+ return value
309
+
310
+ match = _MEMORY_SIZE_PATTERN.match(value)
311
+ if match is None:
312
+ raise ValueError(
313
+ f"invalid argument value for '{name}': "
314
+ "expected memory size with unit KB, MB, GB, TB, KiB, MiB, GiB or TiB "
315
+ f"but received {value!r}"
316
+ )
317
+
318
+ size = float(match.group("value"))
319
+ unit = match.group("unit").upper()
320
+ bytes_size = int(size * _MEMORY_SIZE_UNITS[unit])
321
+ if bytes_size <= 0:
322
+ raise ValueError(
323
+ f"invalid argument value for '{name}': "
324
+ f"expected positive memory size but received {value!r}"
325
+ )
326
+
327
+ return bytes_size
328
+
329
+
330
+ def _as_probability(value: float, name: str) -> float:
331
+
332
+ if not isinstance(value, (int, float)) or isinstance(value, bool):
333
+ raise TypeError(
334
+ f"unsupported argument type for '{name}': "
335
+ f"expected {float} but received {type(value)}"
336
+ )
337
+
338
+ value = float(value)
339
+ if not 0 <= value <= 1:
340
+ raise ValueError(
341
+ f"invalid argument value for '{name}': "
342
+ f"expected value between 0 and 1 but received {value!r}"
343
+ )
344
+
345
+ return value
346
+
347
+
348
+ def _as_seed(seed: RandomStateSeed) -> np.random.RandomState:
349
+
350
+ if seed is None or seed is np.random:
351
+ return np.random.mtrand._rand
352
+ if isinstance(seed, numbers.Integral):
353
+ return np.random.RandomState(int(seed))
354
+ if isinstance(seed, np.random.RandomState):
355
+ return seed
356
+ raise ValueError(
357
+ f"invalid argument value for 'seed': "
358
+ f"expected None, np.random, integer seed or np.random.RandomState "
359
+ f"but received {seed!r}"
360
+ )
361
+
362
+
363
+ def _as_dataframe_axis(axis: Union[int, str]) -> DataFrameAxis:
364
+
365
+ if isinstance(axis, str) and axis == "index":
366
+ return "index"
367
+ if isinstance(axis, str) and axis == "columns":
368
+ return "columns"
369
+ if isinstance(axis, int) and not isinstance(axis, bool) and axis == 0:
370
+ return "index"
371
+ if isinstance(axis, int) and not isinstance(axis, bool) and axis == 1:
372
+ return "columns"
373
+
374
+ raise ValueError(
375
+ f"invalid argument value for 'axis': "
376
+ f"expected 0, 1, 'index' or 'columns' but received {axis!r}"
377
+ )
378
+
379
+
380
+ def _as_orientation(orientation: str) -> FileOrientation:
381
+
382
+ if orientation == "rows" or orientation == "columns":
383
+ return orientation
384
+
385
+ raise ValueError(
386
+ f"invalid argument value for 'orientation': "
387
+ f"expected 'rows' or 'columns' but received {orientation!r}"
388
+ )
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env python
2
+
3
+ import warnings
4
+ from typing import Optional
5
+
6
+
7
+ def _warn_deprecated(
8
+ name: str,
9
+ *,
10
+ replacement: Optional[str] = None,
11
+ stacklevel: int = 2,
12
+ ) -> None:
13
+
14
+ message = f"{name} is deprecated and will be removed in 2.0.0"
15
+ if replacement is not None:
16
+ message = f"{message}; use {replacement} instead"
17
+ warnings.warn(f"{message}.", FutureWarning, stacklevel=stacklevel)
18
+
19
+
20
+ def _warn_deprecated_argument(
21
+ old_name: str,
22
+ new_name: str,
23
+ *,
24
+ stacklevel: int = 2,
25
+ ) -> None:
26
+
27
+ _warn_deprecated(
28
+ f"`{old_name}`",
29
+ replacement=f"`{new_name}`",
30
+ stacklevel=stacklevel,
31
+ )
@@ -21,13 +21,13 @@ pl
21
21
  from __future__ import annotations
22
22
 
23
23
  import sys as _sys
24
- import warnings as _warnings
25
24
  from types import ModuleType as _ModuleType
26
25
  from typing import Dict as _Dict
27
26
  from typing import List as _List
28
27
  from typing import Tuple as _Tuple
29
28
  from typing import cast as _cast
30
29
 
30
+ from .._warnings import _warn_deprecated
31
31
  from . import boolean_algebra as ba
32
32
  from . import boolean_network as bn
33
33
  from . import influence_graph as ig
@@ -65,10 +65,9 @@ __all__ = [
65
65
  def __getattr__(name: str) -> object:
66
66
  if name in _DEPRECATED:
67
67
  module_alias, attr = _DEPRECATED[name]
68
- _warnings.warn(
69
- f"`bt.bpy.{name}` is deprecated; use "
70
- f"`bt.bpy.{module_alias}.{attr}` instead.",
71
- DeprecationWarning,
68
+ _warn_deprecated(
69
+ f"`bt.bpy.{name}`",
70
+ replacement=f"`bt.bpy.{module_alias}.{attr}`",
72
71
  stacklevel=2,
73
72
  )
74
73
  return _cast(object, getattr(_MODULES[module_alias], attr))
@@ -407,6 +407,7 @@ class BooleanPredecessorInference:
407
407
 
408
408
  @staticmethod
409
409
  def _coerce_value(value: PartialBooleanLike) -> PartialBoolean:
410
+
410
411
  return PartialBooleanDifferential._coerce_value(value)
411
412
 
412
413
  @staticmethod
@@ -8,13 +8,16 @@ from collections.abc import (
8
8
  Mapping,
9
9
  )
10
10
  from typing import (
11
+ Any,
11
12
  Dict,
12
13
  FrozenSet,
13
14
  MutableMapping,
14
15
  MutableSet,
15
16
  Optional,
16
17
  Set,
18
+ Tuple,
17
19
  cast,
20
+ overload,
18
21
  )
19
22
 
20
23
  from ._boolean import PartialBoolean
@@ -169,6 +172,44 @@ class Hypercube(MutableMapping[str, PartialBoolean]):
169
172
 
170
173
  return len(self._values)
171
174
 
175
+ @overload
176
+ def update(self, mapping: Mapping[str, PartialBooleanLike]) -> None: ...
177
+
178
+ @overload
179
+ def update(self, mapping: Iterable[Tuple[str, PartialBooleanLike]]) -> None: ...
180
+
181
+ @overload
182
+ def update(self, **kwargs: PartialBooleanLike) -> None: ...
183
+
184
+ def update( # pyright: ignore[reportIncompatibleMethodOverride]
185
+ self,
186
+ *args: Any,
187
+ **kwargs: PartialBooleanLike,
188
+ ) -> None:
189
+ """
190
+ Update explicitly specified component values.
191
+
192
+ Values are converted to `PartialBoolean`, following `__setitem__`.
193
+ """
194
+
195
+ if len(args) > 1:
196
+ raise TypeError(
197
+ f"update expected at most 1 positional argument, got {len(args)}"
198
+ )
199
+
200
+ if args:
201
+ other = args[0]
202
+ if isinstance(other, Mapping):
203
+ iterable = other.items()
204
+ else:
205
+ iterable = other
206
+
207
+ for component, value in iterable:
208
+ self[component] = value
209
+
210
+ for component, value in kwargs.items():
211
+ self[component] = value
212
+
172
213
  def __repr__(self) -> str:
173
214
  """
174
215
  Return a representation of the hypercube.