bonesistools 1.2.0__tar.gz → 1.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. bonesistools-1.2.2/.gitignore +113 -0
  2. {bonesistools-1.2.0 → bonesistools-1.2.2}/PKG-INFO +107 -13
  3. bonesistools-1.2.2/README.md +164 -0
  4. {bonesistools-1.2.0 → bonesistools-1.2.2}/pyproject.toml +13 -3
  5. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/__init__.py +20 -5
  6. bonesistools-1.2.2/src/bonesistools/_compat.py +15 -0
  7. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/__init__.py +37 -20
  8. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/__init__.py +11 -5
  9. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_algebra.py +71 -72
  10. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_boolean.py +10 -10
  11. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_hypercube.py +14 -9
  12. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_parser.py +9 -7
  13. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_structure.py +18 -24
  14. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_typing.py +71 -12
  15. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_network/__init__.py +11 -9
  16. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_network/_network.py +194 -98
  17. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_network/_parser.py +9 -2
  18. bonesistools-1.2.2/src/bonesistools/boolpy/boolean_network/_typing.py +44 -0
  19. {bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph → bonesistools-1.2.2/src/bonesistools/boolpy/influence_graph}/__init__.py +7 -5
  20. {bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph → bonesistools-1.2.2/src/bonesistools/boolpy/influence_graph}/_algorithms.py +5 -3
  21. {bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph → bonesistools-1.2.2/src/bonesistools/boolpy/influence_graph}/_influence_graph.py +71 -42
  22. {bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph → bonesistools-1.2.2/src/bonesistools/boolpy/influence_graph}/_parser.py +25 -13
  23. {bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph → bonesistools-1.2.2/src/bonesistools/boolpy/influence_graph}/_scoring.py +11 -13
  24. bonesistools-1.2.2/src/bonesistools/boolpy/influence_graph/_typing.py +1 -0
  25. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/plotting/__init__.py +4 -2
  26. {bonesistools-1.2.0/src/bonesistools/boolpy → bonesistools-1.2.2/src/bonesistools/boolpy/plotting}/_graphviz.py +10 -7
  27. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/__init__.py +5 -3
  28. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/ncbi/__init__.py +4 -4
  29. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/ncbi/_genesyn.py +129 -72
  30. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/ncbi/_typing.py +1 -4
  31. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/omnipath/__init__.py +3 -1
  32. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/omnipath/_collectri.py +32 -8
  33. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/omnipath/_dorothea.py +15 -10
  34. bonesistools-1.2.2/src/bonesistools/grntools/__init__.py +34 -0
  35. bonesistools-1.2.2/src/bonesistools/py.typed +0 -0
  36. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/__init__.py +6 -5
  37. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/_dependencies.py +48 -4
  38. bonesistools-1.2.2/src/bonesistools/sctools/_typing.py +384 -0
  39. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/datasets/__init__.py +21 -14
  40. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/__init__.py +12 -12
  41. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/_boxplot.py +184 -119
  42. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/_colors.py +10 -10
  43. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/_density.py +77 -47
  44. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/_figure.py +40 -24
  45. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/_graphplot.py +7 -13
  46. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/plotting/_scatterplot.py +153 -98
  47. bonesistools-1.2.2/src/bonesistools/sctools/plotting/_typing.py +5 -0
  48. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/preprocessing/__init__.py +12 -13
  49. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/preprocessing/_genename.py +27 -21
  50. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/preprocessing/_simple.py +22 -9
  51. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/preprocessing/_transfer.py +35 -18
  52. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/__init__.py +14 -16
  53. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_classification.py +6 -5
  54. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_conversion.py +29 -27
  55. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_graph.py +7 -4
  56. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_markers.py +46 -38
  57. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_maths.py +14 -7
  58. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_neighbors.py +340 -205
  59. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_regress.py +11 -5
  60. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_utils.py +18 -17
  61. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/tools/_write.py +1 -3
  62. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_boolean_algebra.py +16 -4
  63. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_boolean_network.py +16 -2
  64. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_boolean_network_ensemble.py +2 -2
  65. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_influence_graph.py +136 -15
  66. bonesistools-1.2.2/tests/bpy/test_influence_graph_parser.py +99 -0
  67. bonesistools-1.2.0/tests/bpy/test_interaction_graph_scoring.py → bonesistools-1.2.2/tests/bpy/test_influence_graph_scoring.py +43 -8
  68. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_plotting_styles.py +9 -9
  69. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/dbs/test_ncbi.py +32 -2
  70. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/dbs/test_omnipath.py +152 -0
  71. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/conftest.py +35 -1
  72. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/preprocessing/test_genename.py +1 -1
  73. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/preprocessing/test_simple.py +30 -6
  74. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/preprocessing/test_transfer_obs.py +4 -4
  75. bonesistools-1.2.2/tests/sct/test_typing.py +202 -0
  76. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/tools/test_graph_neighbors_classification.py +37 -6
  77. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/tools/test_knnbs.py +103 -44
  78. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/tools/test_utils_conversion_maths.py +130 -50
  79. bonesistools-1.2.0/.gitignore +0 -93
  80. bonesistools-1.2.0/README.md +0 -70
  81. bonesistools-1.2.0/src/bonesistools/boolpy/boolean_network/_typing.py +0 -60
  82. bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph/_typing.py +0 -4
  83. bonesistools-1.2.0/src/bonesistools/grntools/__init__.py +0 -17
  84. bonesistools-1.2.0/src/bonesistools/sctools/_typing.py +0 -390
  85. bonesistools-1.2.0/src/bonesistools/sctools/plotting/_typing.py +0 -5
  86. bonesistools-1.2.0/tests/bpy/test_interaction_graph_parser.py +0 -65
  87. {bonesistools-1.2.0 → bonesistools-1.2.2}/LICENSE +0 -0
  88. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/boolean_algebra/_representation.py +0 -0
  89. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/boolpy/plotting/_styles.py +1 -1
  90. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/ncbi/data/gi/escherichia_coli_gene_info.tsv +0 -0
  91. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/ncbi/data/gi/homo_sapiens_gene_info.tsv +0 -0
  92. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/databases/ncbi/data/gi/mus_musculus_gene_info.tsv +0 -0
  93. {bonesistools-1.2.0 → bonesistools-1.2.2}/src/bonesistools/sctools/datasets/nestorowa_hvg.h5ad +0 -0
  94. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/conftest.py +1 -1
  95. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_hypercube.py +2 -2
  96. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_hypercube_collection.py +0 -0
  97. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/bpy/test_partial_boolean.py +0 -0
  98. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/plotting/test_boxplot.py +2 -2
  99. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/plotting/test_colors.py +0 -0
  100. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/plotting/test_density.py +2 -2
  101. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/plotting/test_figure.py +0 -0
  102. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/plotting/test_graphplot.py +1 -1
  103. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/plotting/test_scatterplot.py +1 -1
  104. {bonesistools-1.2.0 → bonesistools-1.2.2}/tests/sct/tools/test_write.py +0 -0
@@ -0,0 +1,113 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+
7
+ # Build / packaging
8
+ build/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ *.egg-info/
14
+ *.egg
15
+ sdist/
16
+ wheels/
17
+ pip-wheel-metadata/
18
+ share/python-wheels/
19
+ .installed.cfg
20
+
21
+ # Virtual environments
22
+ .env
23
+ .venv
24
+ env/
25
+ venv/
26
+ ENV/
27
+ env.bak/
28
+ venv.bak/
29
+
30
+ # Test / coverage / type-checker caches
31
+ .coverage
32
+ .coverage.*
33
+ coverage.xml
34
+ htmlcov/
35
+ .pytest_cache/
36
+ .mypy_cache/
37
+ .pyright/
38
+ .pyre/
39
+ .ruff_cache/
40
+ .tox/
41
+ .nox/
42
+ .hypothesis/
43
+
44
+ # Jupyter / IPython
45
+ .ipynb_checkpoints/
46
+ ipython_config.py
47
+
48
+ # Editors / IDEs
49
+ .vscode/
50
+ .idea/
51
+ *.swp
52
+ *.swo
53
+ *~
54
+
55
+ # OS files
56
+ .DS_Store
57
+ Thumbs.db
58
+
59
+ # Logs / temporary files
60
+ *.log
61
+ /logs/
62
+ /tmp/
63
+ /temp/
64
+ *.tmp
65
+ *.bak
66
+
67
+ # Generated figures / graph exports
68
+ *.dot
69
+ *.dot.pdf
70
+ *.gv
71
+ *.gv.pdf
72
+ *.png
73
+ *.jpg
74
+ *.jpeg
75
+
76
+ # Large local single-cell files
77
+ *.h5ad
78
+ *.h5mu
79
+ *.loom
80
+
81
+ # LaTeX artifacts
82
+ *.aux
83
+ *.bbl
84
+ *.bcf
85
+ *.blg
86
+ *.fdb_latexmk
87
+ *.fls
88
+ *.nav
89
+ *.out
90
+ *.run.xml
91
+ *.snm
92
+ *.synctex.gz
93
+ *.toc
94
+ q.log
95
+
96
+ # R
97
+ .Rhistory
98
+ .RData
99
+ .Rproj.user/
100
+
101
+ # Project-specific
102
+ *.md
103
+ !README.md
104
+ !docs/**/*.md
105
+
106
+ src/bonesistools/databases/omnipath/.cache/
107
+ /data/
108
+ /results/
109
+ !tests/
110
+ !tests/data/
111
+ !tests/data/*.h5ad
112
+ !src/bonesistools/sctools/datasets/
113
+ !src/bonesistools/sctools/datasets/*.h5ad
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bonesistools
3
- Version: 1.2.0
4
- Summary: BoNesisTools is a python package proposing bioinformatics tools for upstream and downstream analysis of BoNesis framework
3
+ Version: 1.2.2
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
7
7
  Maintainer-email: Théo Roncalli <theo.roncalli@labri.fr>
@@ -557,7 +557,7 @@ Requires-Dist: networkx>=2.1
557
557
  Requires-Dist: numpy>=1.21
558
558
  Requires-Dist: pandas>=1.3.5
559
559
  Requires-Dist: scipy>=1.7
560
- Requires-Dist: typing-extensions>=4.0; python_version < '3.8'
560
+ Requires-Dist: typing-extensions>=4.0
561
561
  Provides-Extra: all
562
562
  Requires-Dist: decoupler>=2.0.0; extra == 'all'
563
563
  Requires-Dist: graphviz>=0.20; extra == 'all'
@@ -586,7 +586,16 @@ Description-Content-Type: text/markdown
586
586
 
587
587
  # BoNesisTools
588
588
 
589
- `BoNesisTools` is a Python package providing bioinformatics utilities for upstream and downstream analyses of the [BoNesis](https://github.com/bnediction/bonesis) framework.
589
+ `BoNesisTools` is a Python package providing utilities for Boolean modelling, regulatory influence graphs and single-cell analyses around the [BoNesis](https://github.com/bnediction/bonesis) ecosystem.
590
+
591
+ The package provides:
592
+
593
+ - Boolean algebra and partial Boolean abstractions
594
+ - Boolean network manipulation and analysis
595
+ - signed influence graph utilities
596
+ - GRN-informed Boolean predecessor inference
597
+ - single-cell and multimodal analysis helpers
598
+ - biological database interfaces
590
599
 
591
600
  ## Usage
592
601
 
@@ -597,55 +606,140 @@ import bonesistools as bt
597
606
  `BoNesisTools` exposes four main namespaces:
598
607
 
599
608
  - `bt.sct` — single-cell and multimodal annotated data tools
600
- - `bt.bpy` — Boolean modelling utilities
609
+ - `bt.bpy` — Boolean modelling and graph utilities
601
610
  - `bt.dbs` — biological database interfaces
602
611
  - `bt.grn` — deprecated alias for `bt.bpy.ig`
603
612
 
604
- `bt.sct` follows a [Scanpy](https://github.com/scverse/scanpy)-like API while providing additional and complementary features for single-cell analyses:
613
+ ---
614
+
615
+ ## Single-cell tools
616
+
617
+ `bt.sct` follows a [Scanpy](https://github.com/scverse/scanpy)-like API while providing additional and complementary features for single-cell analyses.
618
+
619
+ Submodules:
605
620
 
606
621
  - preprocessing: `bt.sct.pp`
607
622
  - tools: `bt.sct.tl`
608
623
  - plotting: `bt.sct.pl`
609
624
  - datasets: `bt.sct.datasets`
610
625
 
611
- `bt.bpy` provides utilities for Boolean modelling:
626
+ ---
627
+
628
+ ## Boolean modelling utilities
629
+
630
+ `bt.bpy` provides utilities for Boolean modelling, logical abstractions and signed regulatory graphs.
631
+
632
+ Submodules:
633
+
634
+ - Boolean algebra: `bt.bpy.ba`
635
+ - partial Boolean abstractions and hypercube representations
636
+ - Boolean differential and predecessor inference utilities
637
+
638
+ - Boolean network: `bt.bpy.bn`
639
+ - Boolean network manipulation and analysis
640
+ - fixed-point computation
641
+ - `.bnet` import/export
642
+
643
+ - influence graph: `bt.bpy.ig`
644
+ - signed regulatory influence graphs
645
+ - feedback circuit and SCC analysis
646
+ - signed interaction scoring from bounded walks
647
+ - graph compression and visualization utilities
648
+
649
+ Example:
650
+
651
+ ```python
652
+ bn = bt.bpy.bn.BooleanNetwork(
653
+ {
654
+ "A": "B & ~C",
655
+ "B": 1,
656
+ "C": 0,
657
+ }
658
+ )
659
+
660
+ graph = bn.to_influence_graph()
661
+
662
+ graph.show()
663
+ ```
664
+
665
+ ---
666
+
667
+ ## Biological external resources
612
668
 
613
- - Boolean algebra and partial Boolean abstractions: `bt.bpy.ba`
614
- - Boolean network utilities: `bt.bpy.bn`
615
- - interaction and influence graph utilities: `bt.bpy.ig`
669
+ `bt.dbs` provides lightweight interfaces and utilities for biological
670
+ external resources.
671
+
672
+ Submodules:
673
+
674
+ - NCBI: `bt.dbs.ncbi`
675
+ - gene synonym harmonization
676
+ - gene annotation utilities
677
+
678
+ - OmniPath: `bt.dbs.omnipath`
679
+ - DoRothEA transcription factor interactions
680
+ - CollecTRI regulatory interaction networks
681
+
682
+ Example:
683
+
684
+ ```python
685
+ genesyn = bt.dbs.ncbi.GeneSynonyms()
686
+
687
+ grn = bt.dbs.omnipath.load_collectri_grn(
688
+ organism="mouse",
689
+ genesyn=genesyn,
690
+ )
691
+ ```
692
+
693
+ ---
616
694
 
617
695
  ## Installation
618
696
 
619
697
  Install the latest release:
698
+
620
699
  ```sh
621
700
  pip install bonesistools
622
701
  ```
623
702
 
624
- Install the single-cell tools dependencies:
703
+ Install the single-cell dependencies:
704
+
625
705
  ```sh
626
706
  pip install "bonesistools[sctools]"
627
707
  ```
628
708
 
629
- Install with all extra dependencies:
709
+ Install all optional dependencies:
710
+
630
711
  ```sh
631
712
  pip install "bonesistools[all]"
632
713
  ```
633
714
 
634
715
  Install the development version:
716
+
635
717
  ```sh
636
718
  git clone https://github.com/bnediction/bonesistools.git
637
719
  cd bonesistools
638
720
  pip install -e ".[all]"
639
721
  ```
722
+
640
723
  or directly:
724
+
641
725
  ```sh
642
726
  pip install git+https://github.com/bnediction/bonesistools.git
643
727
  ```
644
728
 
729
+ ---
730
+
645
731
  ## Bugs
646
732
 
647
- Please report any bugs or ask questions [here](https://github.com/bnediction/bonesistools/issues).
733
+ Please report bugs or ask questions here:
734
+
735
+ https://github.com/bnediction/bonesistools/issues
736
+
737
+ ---
648
738
 
649
739
  ## License
650
740
 
651
741
  This package is distributed under the [CeCILL v2.1](http://www.cecill.info/index.en.html) free software license (GNU GPL compatible).
742
+
743
+ This package also includes third-party data resources derived from the
744
+ NCBI Gene database (`gene_info`). NCBI places no restrictions on the
745
+ use or redistribution of these data: https://www.ncbi.nlm.nih.gov/home/about/policies/
@@ -0,0 +1,164 @@
1
+ [![tests](https://github.com/bnediction/bonesistools/actions/workflows/tests.yml/badge.svg)](https://github.com/bnediction/bonesistools/actions/workflows/tests.yml)
2
+ [![PyPI](https://img.shields.io/pypi/v/bonesistools.svg)](https://pypi.org/project/bonesistools)
3
+ [![python](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbnediction%2Fbonesistools%2Frefs%2Fheads%2Fmain%2Fpyproject.toml&query=%24.project.requires-python&style=flat&label=python)](https://www.python.org/)
4
+ [![license](https://img.shields.io/pypi/l/bonesistools.svg)](https://github.com/bnediction/bonesistools/blob/main/LICENSE)
5
+
6
+ # BoNesisTools
7
+
8
+ `BoNesisTools` is a Python package providing utilities for Boolean modelling, regulatory influence graphs and single-cell analyses around the [BoNesis](https://github.com/bnediction/bonesis) ecosystem.
9
+
10
+ The package provides:
11
+
12
+ - Boolean algebra and partial Boolean abstractions
13
+ - Boolean network manipulation and analysis
14
+ - signed influence graph utilities
15
+ - GRN-informed Boolean predecessor inference
16
+ - single-cell and multimodal analysis helpers
17
+ - biological database interfaces
18
+
19
+ ## Usage
20
+
21
+ ```python
22
+ import bonesistools as bt
23
+ ```
24
+
25
+ `BoNesisTools` exposes four main namespaces:
26
+
27
+ - `bt.sct` — single-cell and multimodal annotated data tools
28
+ - `bt.bpy` — Boolean modelling and graph utilities
29
+ - `bt.dbs` — biological database interfaces
30
+ - `bt.grn` — deprecated alias for `bt.bpy.ig`
31
+
32
+ ---
33
+
34
+ ## Single-cell tools
35
+
36
+ `bt.sct` follows a [Scanpy](https://github.com/scverse/scanpy)-like API while providing additional and complementary features for single-cell analyses.
37
+
38
+ Submodules:
39
+
40
+ - preprocessing: `bt.sct.pp`
41
+ - tools: `bt.sct.tl`
42
+ - plotting: `bt.sct.pl`
43
+ - datasets: `bt.sct.datasets`
44
+
45
+ ---
46
+
47
+ ## Boolean modelling utilities
48
+
49
+ `bt.bpy` provides utilities for Boolean modelling, logical abstractions and signed regulatory graphs.
50
+
51
+ Submodules:
52
+
53
+ - Boolean algebra: `bt.bpy.ba`
54
+ - partial Boolean abstractions and hypercube representations
55
+ - Boolean differential and predecessor inference utilities
56
+
57
+ - Boolean network: `bt.bpy.bn`
58
+ - Boolean network manipulation and analysis
59
+ - fixed-point computation
60
+ - `.bnet` import/export
61
+
62
+ - influence graph: `bt.bpy.ig`
63
+ - signed regulatory influence graphs
64
+ - feedback circuit and SCC analysis
65
+ - signed interaction scoring from bounded walks
66
+ - graph compression and visualization utilities
67
+
68
+ Example:
69
+
70
+ ```python
71
+ bn = bt.bpy.bn.BooleanNetwork(
72
+ {
73
+ "A": "B & ~C",
74
+ "B": 1,
75
+ "C": 0,
76
+ }
77
+ )
78
+
79
+ graph = bn.to_influence_graph()
80
+
81
+ graph.show()
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Biological external resources
87
+
88
+ `bt.dbs` provides lightweight interfaces and utilities for biological
89
+ external resources.
90
+
91
+ Submodules:
92
+
93
+ - NCBI: `bt.dbs.ncbi`
94
+ - gene synonym harmonization
95
+ - gene annotation utilities
96
+
97
+ - OmniPath: `bt.dbs.omnipath`
98
+ - DoRothEA transcription factor interactions
99
+ - CollecTRI regulatory interaction networks
100
+
101
+ Example:
102
+
103
+ ```python
104
+ genesyn = bt.dbs.ncbi.GeneSynonyms()
105
+
106
+ grn = bt.dbs.omnipath.load_collectri_grn(
107
+ organism="mouse",
108
+ genesyn=genesyn,
109
+ )
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Installation
115
+
116
+ Install the latest release:
117
+
118
+ ```sh
119
+ pip install bonesistools
120
+ ```
121
+
122
+ Install the single-cell dependencies:
123
+
124
+ ```sh
125
+ pip install "bonesistools[sctools]"
126
+ ```
127
+
128
+ Install all optional dependencies:
129
+
130
+ ```sh
131
+ pip install "bonesistools[all]"
132
+ ```
133
+
134
+ Install the development version:
135
+
136
+ ```sh
137
+ git clone https://github.com/bnediction/bonesistools.git
138
+ cd bonesistools
139
+ pip install -e ".[all]"
140
+ ```
141
+
142
+ or directly:
143
+
144
+ ```sh
145
+ pip install git+https://github.com/bnediction/bonesistools.git
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Bugs
151
+
152
+ Please report bugs or ask questions here:
153
+
154
+ https://github.com/bnediction/bonesistools/issues
155
+
156
+ ---
157
+
158
+ ## License
159
+
160
+ This package is distributed under the [CeCILL v2.1](http://www.cecill.info/index.en.html) free software license (GNU GPL compatible).
161
+
162
+ This package also includes third-party data resources derived from the
163
+ NCBI Gene database (`gene_info`). NCBI places no restrictions on the
164
+ use or redistribution of these data: https://www.ncbi.nlm.nih.gov/home/about/policies/
@@ -4,8 +4,8 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bonesistools"
7
- description = "BoNesisTools is a python package proposing bioinformatics tools for upstream and downstream analysis of BoNesis framework"
8
- version = "1.2.0"
7
+ description = "Bioinformatics toolkit for upstream and downstream analyses around the BoNesis framework"
8
+ version = "1.2.2"
9
9
  license = {file = "LICENSE"}
10
10
  credits = ["BNeDiction", "PEPR Santé Numérique 2030"]
11
11
  authors = [
@@ -42,7 +42,7 @@ classifiers = [
42
42
  requires-python = ">=3.7"
43
43
  dependencies = [
44
44
  "importlib_resources; python_version < '3.9'",
45
- "typing-extensions>=4.0; python_version < '3.8'",
45
+ "typing-extensions>=4.0",
46
46
  "numpy>=1.21",
47
47
  "pandas>=1.3.5",
48
48
  "scipy>=1.7",
@@ -86,6 +86,7 @@ sctools = [ "scikit-learn>=1.0" ]
86
86
  ignore-vcs = true
87
87
  include = [
88
88
  "*.py",
89
+ "src/bonesistools/py.typed",
89
90
  "src/bonesistools/databases/ncbi/data/gi/*.tsv",
90
91
  "src/bonesistools/sctools/datasets/*.h5ad",
91
92
  ]
@@ -99,6 +100,15 @@ Repository = "https://github.com/bnediction/bonesistools"
99
100
  [tool.black]
100
101
  target-version = ["py37"]
101
102
 
103
+ [tool.ruff]
104
+ target-version = "py37"
105
+ line-length = 88
106
+ extend-exclude = ["ensemble"]
107
+
108
+ [tool.ruff.lint]
109
+ select = ["E", "F", "I"]
110
+ typing-modules = ["bonesistools._compat"]
111
+
102
112
  [tool.pytest.ini_options]
103
113
  filterwarnings = [
104
114
  "ignore:The NumPy module was reloaded:UserWarning",
@@ -18,14 +18,23 @@ grn
18
18
  Credits: BNeDiction; PEPR Santé Numérique 2030.
19
19
  """
20
20
 
21
+ from __future__ import annotations
22
+
21
23
  import importlib as _importlib
22
24
  import sys as _sys
23
25
  import warnings as _warnings
26
+ from types import ModuleType as _ModuleType
27
+ from typing import TYPE_CHECKING as _TYPE_CHECKING
24
28
 
25
29
  from . import boolpy as bpy
26
30
  from . import databases as dbs
27
31
  from . import sctools as sct
28
32
 
33
+ if _TYPE_CHECKING:
34
+ from . import grntools as grn
35
+
36
+ del annotations
37
+
29
38
  __credits__ = "BNeDiction; PEPR Santé Numérique 2030"
30
39
 
31
40
  __all__ = [
@@ -47,15 +56,21 @@ _sys.modules.update(
47
56
  )
48
57
 
49
58
  _sys.modules.update(
50
- {f"{__name__}.bpy.{alias}": getattr(bpy, alias) for alias in ["ba", "bn", "ig"]}
59
+ {
60
+ f"{__name__}.bpy.{alias}": getattr(bpy, alias)
61
+ for alias in ["ba", "bn", "ig", "pl"]
62
+ }
51
63
  )
52
64
 
53
65
 
54
- def __getattr__(name):
66
+ def __getattr__(name: str) -> _ModuleType:
55
67
  if name == "grn":
56
- _warnings.warn(
68
+ message = (
57
69
  "`bt.grn` is deprecated and will be removed in a future release; "
58
- "use `bt.bpy.ig` instead.",
70
+ "use `bt.bpy.ig` instead."
71
+ )
72
+ _warnings.warn(
73
+ message,
59
74
  FutureWarning,
60
75
  stacklevel=2,
61
76
  )
@@ -68,5 +83,5 @@ def __getattr__(name):
68
83
  raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
69
84
 
70
85
 
71
- def __dir__():
86
+ def __dir__() -> list[str]:
72
87
  return sorted(set(globals()) | set(__all__))
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env python
2
+
3
+ """
4
+ Compatibility imports shared across the package.
5
+ """
6
+
7
+ try:
8
+ from typing import Literal, get_args
9
+ except ImportError:
10
+ from typing_extensions import Literal, get_args
11
+
12
+ __all__ = [
13
+ "Literal",
14
+ "get_args",
15
+ ]
@@ -3,8 +3,8 @@
3
3
  """
4
4
  Utilities for Boolean modelling.
5
5
 
6
- The `bpy` package provides tools for Boolean algebra, Boolean networks
7
- and interaction/influence graphs.
6
+ The `bpy` package provides tools for Boolean algebra, Boolean networks,
7
+ influence graphs and plotting.
8
8
 
9
9
  Sub-packages
10
10
  ------------
@@ -13,48 +13,65 @@ ba
13
13
  bn
14
14
  Boolean networks and logical modelling utilities.
15
15
  ig
16
- Interaction and influence graph utilities.
16
+ Influence graph utilities.
17
+ pl
18
+ Plotting utilities.
17
19
  """
18
20
 
19
- import warnings as _warnings
21
+ from __future__ import annotations
22
+
20
23
  import sys as _sys
24
+ import warnings as _warnings
25
+ from types import ModuleType as _ModuleType
26
+ from typing import cast as _cast
21
27
 
22
28
  from . import boolean_algebra as ba
23
29
  from . import boolean_network as bn
24
- from . import interaction_graph as ig
30
+ from . import influence_graph as ig
31
+ from . import plotting as pl
32
+
33
+ del annotations
25
34
 
26
35
  _sys.modules.update(
27
- {f"{__name__}.{alias}": globals()[alias] for alias in ["ba", "bn", "ig"]}
36
+ {f"{__name__}.{alias}": globals()[alias] for alias in ["ba", "bn", "ig", "pl"]}
28
37
  )
29
38
 
30
- _DEPRECATED = {
39
+ _MODULES: dict[str, _ModuleType] = {
40
+ "ba": ba,
41
+ "bn": bn,
42
+ "ig": ig,
43
+ "pl": pl,
44
+ }
45
+
46
+ _DEPRECATED: dict[str, tuple[str, str]] = {
31
47
  "PartialBoolean": ("ba", "PartialBoolean"),
32
48
  "BooleanNetworkEnsemble": ("bn", "BooleanNetworkEnsemble"),
33
- "Hypercube": ("bn", "Hypercube"),
34
- "HypercubeCollection": ("bn", "HypercubeCollection"),
49
+ "Hypercube": ("ba", "Hypercube"),
50
+ "HypercubeCollection": ("ba", "HypercubeCollection"),
35
51
  "bn_to_pydot": ("bn", "bn_to_pydot"),
36
52
  }
37
53
 
54
+ __all__ = [
55
+ "ba",
56
+ "bn",
57
+ "ig",
58
+ "pl",
59
+ ]
60
+
38
61
 
39
- def __getattr__(name):
62
+ def __getattr__(name: str) -> object:
40
63
  if name in _DEPRECATED:
41
64
  module_alias, attr = _DEPRECATED[name]
42
65
  _warnings.warn(
43
- f"`bt.bpy.{name}` is deprecated; use `bt.bpy.{module_alias}.{attr}` instead.",
66
+ f"`bt.bpy.{name}` is deprecated; use "
67
+ f"`bt.bpy.{module_alias}.{attr}` instead.",
44
68
  DeprecationWarning,
45
69
  stacklevel=2,
46
70
  )
47
- return getattr(globals()[module_alias], attr)
71
+ return _cast(object, getattr(_MODULES[module_alias], attr))
48
72
 
49
73
  raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
50
74
 
51
75
 
52
- __all__ = [
53
- "ba",
54
- "bn",
55
- "ig",
56
- ]
57
-
58
-
59
- def __dir__():
76
+ def __dir__() -> list[str]:
60
77
  return sorted(set(globals()) | set(__all__))