bonesistools 1.2.0__tar.gz → 1.2.1__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 (102) hide show
  1. bonesistools-1.2.1/.gitignore +113 -0
  2. {bonesistools-1.2.0 → bonesistools-1.2.1}/PKG-INFO +108 -12
  3. bonesistools-1.2.1/README.md +166 -0
  4. {bonesistools-1.2.0 → bonesistools-1.2.1}/pyproject.toml +12 -2
  5. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/__init__.py +14 -4
  6. bonesistools-1.2.1/src/bonesistools/_compat.py +15 -0
  7. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/__init__.py +25 -15
  8. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/__init__.py +11 -5
  9. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_algebra.py +71 -72
  10. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_boolean.py +10 -10
  11. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_hypercube.py +14 -9
  12. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_parser.py +9 -7
  13. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_structure.py +18 -24
  14. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_typing.py +62 -7
  15. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_network/__init__.py +10 -9
  16. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_network/_network.py +194 -98
  17. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_network/_parser.py +9 -2
  18. bonesistools-1.2.1/src/bonesistools/boolpy/boolean_network/_typing.py +42 -0
  19. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/interaction_graph/__init__.py +4 -2
  20. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/interaction_graph/_algorithms.py +5 -3
  21. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/interaction_graph/_influence_graph.py +71 -42
  22. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/interaction_graph/_parser.py +16 -4
  23. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/interaction_graph/_scoring.py +11 -13
  24. bonesistools-1.2.1/src/bonesistools/boolpy/interaction_graph/_typing.py +1 -0
  25. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/plotting/__init__.py +4 -2
  26. {bonesistools-1.2.0/src/bonesistools/boolpy → bonesistools-1.2.1/src/bonesistools/boolpy/plotting}/_graphviz.py +10 -7
  27. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/__init__.py +5 -3
  28. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/ncbi/__init__.py +4 -2
  29. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/ncbi/_genesyn.py +129 -72
  30. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/ncbi/_typing.py +1 -4
  31. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/omnipath/__init__.py +3 -1
  32. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/omnipath/_collectri.py +32 -8
  33. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/omnipath/_dorothea.py +15 -10
  34. bonesistools-1.2.1/src/bonesistools/grntools/__init__.py +34 -0
  35. bonesistools-1.2.1/src/bonesistools/py.typed +0 -0
  36. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/__init__.py +6 -5
  37. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/_dependencies.py +48 -4
  38. bonesistools-1.2.1/src/bonesistools/sctools/_typing.py +384 -0
  39. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/datasets/__init__.py +15 -10
  40. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/__init__.py +12 -12
  41. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_boxplot.py +184 -119
  42. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_colors.py +10 -10
  43. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_density.py +77 -47
  44. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_figure.py +40 -24
  45. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_graphplot.py +7 -13
  46. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_scatterplot.py +153 -98
  47. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/preprocessing/__init__.py +11 -13
  48. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/preprocessing/_genename.py +26 -20
  49. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/preprocessing/_simple.py +22 -9
  50. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/preprocessing/_transfer.py +35 -18
  51. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/__init__.py +14 -16
  52. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_classification.py +6 -5
  53. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_conversion.py +29 -27
  54. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_graph.py +7 -4
  55. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_markers.py +46 -38
  56. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_maths.py +14 -7
  57. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_neighbors.py +340 -205
  58. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_regress.py +11 -5
  59. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_utils.py +18 -17
  60. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/tools/_write.py +1 -3
  61. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_boolean_algebra.py +16 -4
  62. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_boolean_network.py +16 -2
  63. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_boolean_network_ensemble.py +2 -2
  64. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_influence_graph.py +136 -15
  65. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_interaction_graph_parser.py +34 -0
  66. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_interaction_graph_scoring.py +42 -7
  67. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_plotting_styles.py +9 -9
  68. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/dbs/test_ncbi.py +32 -2
  69. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/dbs/test_omnipath.py +152 -0
  70. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/conftest.py +35 -1
  71. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/preprocessing/test_genename.py +1 -1
  72. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/preprocessing/test_simple.py +30 -6
  73. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/preprocessing/test_transfer_obs.py +4 -4
  74. bonesistools-1.2.1/tests/sct/test_typing.py +202 -0
  75. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/tools/test_graph_neighbors_classification.py +37 -6
  76. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/tools/test_knnbs.py +103 -44
  77. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/tools/test_utils_conversion_maths.py +130 -50
  78. bonesistools-1.2.0/.gitignore +0 -93
  79. bonesistools-1.2.0/README.md +0 -70
  80. bonesistools-1.2.0/src/bonesistools/boolpy/boolean_network/_typing.py +0 -60
  81. bonesistools-1.2.0/src/bonesistools/boolpy/interaction_graph/_typing.py +0 -4
  82. bonesistools-1.2.0/src/bonesistools/grntools/__init__.py +0 -17
  83. bonesistools-1.2.0/src/bonesistools/sctools/_typing.py +0 -390
  84. {bonesistools-1.2.0 → bonesistools-1.2.1}/LICENSE +0 -0
  85. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/boolean_algebra/_representation.py +0 -0
  86. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/boolpy/plotting/_styles.py +1 -1
  87. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/ncbi/data/gi/escherichia_coli_gene_info.tsv +0 -0
  88. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/ncbi/data/gi/homo_sapiens_gene_info.tsv +0 -0
  89. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/databases/ncbi/data/gi/mus_musculus_gene_info.tsv +0 -0
  90. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/datasets/nestorowa_hvg.h5ad +0 -0
  91. {bonesistools-1.2.0 → bonesistools-1.2.1}/src/bonesistools/sctools/plotting/_typing.py +0 -0
  92. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/conftest.py +1 -1
  93. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_hypercube.py +2 -2
  94. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_hypercube_collection.py +0 -0
  95. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/bpy/test_partial_boolean.py +0 -0
  96. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/plotting/test_boxplot.py +2 -2
  97. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/plotting/test_colors.py +0 -0
  98. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/plotting/test_density.py +2 -2
  99. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/plotting/test_figure.py +0 -0
  100. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/plotting/test_graphplot.py +1 -1
  101. {bonesistools-1.2.0 → bonesistools-1.2.1}/tests/sct/plotting/test_scatterplot.py +1 -1
  102. {bonesistools-1.2.0 → bonesistools-1.2.1}/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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bonesistools
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: BoNesisTools is a python package proposing bioinformatics tools for upstream and downstream analysis of BoNesis framework
5
5
  Project-URL: Repository, https://github.com/bnediction/bonesistools
6
6
  Author: Théo Roncalli
@@ -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 interaction 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 interaction and 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,142 @@ 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
+ Submodules:
635
+
636
+ - Boolean algebra: `bt.bpy.ba`
637
+ - partial Boolean abstractions and hypercube representations
638
+ - Boolean differential and predecessor inference utilities
639
+
640
+ - Boolean network: `bt.bpy.bn`
641
+ - Boolean network manipulation and analysis
642
+ - fixed-point computation
643
+ - `.bnet` import/export
644
+
645
+ - influence graph: `bt.bpy.ig`
646
+ - signed regulatory interaction graphs
647
+ - feedback circuit and SCC analysis
648
+ - signed interaction scoring from bounded walks
649
+ - graph compression and visualization utilities
650
+
651
+ Example:
652
+
653
+ ```python
654
+ bn = bt.bpy.bn.BooleanNetwork(
655
+ {
656
+ "A": "B & ~C",
657
+ "B": 1,
658
+ "C": 0,
659
+ }
660
+ )
661
+
662
+ graph = bn.to_influence_graph()
663
+
664
+ graph.show()
665
+ ```
666
+
667
+ ---
668
+
669
+ ## Biological external resources
612
670
 
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`
671
+ `bt.dbs` provides lightweight interfaces and utilities for biological
672
+ external resources.
673
+
674
+ Submodules:
675
+
676
+ - NCBI: `bt.dbs.ncbi`
677
+ - gene synonym harmonization
678
+ - gene annotation utilities
679
+
680
+ - OmniPath: `bt.dbs.omnipath`
681
+ - DoRothEA transcription factor interactions
682
+ - CollecTRI regulatory interaction networks
683
+
684
+ Example:
685
+
686
+ ```python
687
+ genesyn = bt.dbs.ncbi.GeneSynonyms()
688
+
689
+ grn = bt.dbs.omnipath.load_collectri_grn(
690
+ organism="mouse",
691
+ genesyn=genesyn,
692
+ )
693
+ ```
694
+
695
+ ---
616
696
 
617
697
  ## Installation
618
698
 
619
699
  Install the latest release:
700
+
620
701
  ```sh
621
702
  pip install bonesistools
622
703
  ```
623
704
 
624
- Install the single-cell tools dependencies:
705
+ Install the single-cell dependencies:
706
+
625
707
  ```sh
626
708
  pip install "bonesistools[sctools]"
627
709
  ```
628
710
 
629
- Install with all extra dependencies:
711
+ Install all optional dependencies:
712
+
630
713
  ```sh
631
714
  pip install "bonesistools[all]"
632
715
  ```
633
716
 
634
717
  Install the development version:
718
+
635
719
  ```sh
636
720
  git clone https://github.com/bnediction/bonesistools.git
637
721
  cd bonesistools
638
722
  pip install -e ".[all]"
639
723
  ```
724
+
640
725
  or directly:
726
+
641
727
  ```sh
642
728
  pip install git+https://github.com/bnediction/bonesistools.git
643
729
  ```
644
730
 
731
+ ---
732
+
645
733
  ## Bugs
646
734
 
647
- Please report any bugs or ask questions [here](https://github.com/bnediction/bonesistools/issues).
735
+ Please report bugs or ask questions here:
736
+
737
+ https://github.com/bnediction/bonesistools/issues
738
+
739
+ ---
648
740
 
649
741
  ## License
650
742
 
651
743
  This package is distributed under the [CeCILL v2.1](http://www.cecill.info/index.en.html) free software license (GNU GPL compatible).
744
+
745
+ This package also includes third-party data resources derived from the
746
+ NCBI Gene database (`gene_info`). NCBI places no restrictions on the
747
+ use or redistribution of these data: https://www.ncbi.nlm.nih.gov/home/about/policies/
@@ -0,0 +1,166 @@
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 interaction 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 interaction and 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
+ Submodules:
54
+
55
+ - Boolean algebra: `bt.bpy.ba`
56
+ - partial Boolean abstractions and hypercube representations
57
+ - Boolean differential and predecessor inference utilities
58
+
59
+ - Boolean network: `bt.bpy.bn`
60
+ - Boolean network manipulation and analysis
61
+ - fixed-point computation
62
+ - `.bnet` import/export
63
+
64
+ - influence graph: `bt.bpy.ig`
65
+ - signed regulatory interaction graphs
66
+ - feedback circuit and SCC analysis
67
+ - signed interaction scoring from bounded walks
68
+ - graph compression and visualization utilities
69
+
70
+ Example:
71
+
72
+ ```python
73
+ bn = bt.bpy.bn.BooleanNetwork(
74
+ {
75
+ "A": "B & ~C",
76
+ "B": 1,
77
+ "C": 0,
78
+ }
79
+ )
80
+
81
+ graph = bn.to_influence_graph()
82
+
83
+ graph.show()
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Biological external resources
89
+
90
+ `bt.dbs` provides lightweight interfaces and utilities for biological
91
+ external resources.
92
+
93
+ Submodules:
94
+
95
+ - NCBI: `bt.dbs.ncbi`
96
+ - gene synonym harmonization
97
+ - gene annotation utilities
98
+
99
+ - OmniPath: `bt.dbs.omnipath`
100
+ - DoRothEA transcription factor interactions
101
+ - CollecTRI regulatory interaction networks
102
+
103
+ Example:
104
+
105
+ ```python
106
+ genesyn = bt.dbs.ncbi.GeneSynonyms()
107
+
108
+ grn = bt.dbs.omnipath.load_collectri_grn(
109
+ organism="mouse",
110
+ genesyn=genesyn,
111
+ )
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Installation
117
+
118
+ Install the latest release:
119
+
120
+ ```sh
121
+ pip install bonesistools
122
+ ```
123
+
124
+ Install the single-cell dependencies:
125
+
126
+ ```sh
127
+ pip install "bonesistools[sctools]"
128
+ ```
129
+
130
+ Install all optional dependencies:
131
+
132
+ ```sh
133
+ pip install "bonesistools[all]"
134
+ ```
135
+
136
+ Install the development version:
137
+
138
+ ```sh
139
+ git clone https://github.com/bnediction/bonesistools.git
140
+ cd bonesistools
141
+ pip install -e ".[all]"
142
+ ```
143
+
144
+ or directly:
145
+
146
+ ```sh
147
+ pip install git+https://github.com/bnediction/bonesistools.git
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Bugs
153
+
154
+ Please report bugs or ask questions here:
155
+
156
+ https://github.com/bnediction/bonesistools/issues
157
+
158
+ ---
159
+
160
+ ## License
161
+
162
+ This package is distributed under the [CeCILL v2.1](http://www.cecill.info/index.en.html) free software license (GNU GPL compatible).
163
+
164
+ This package also includes third-party data resources derived from the
165
+ NCBI Gene database (`gene_info`). NCBI places no restrictions on the
166
+ use or redistribution of these data: https://www.ncbi.nlm.nih.gov/home/about/policies/
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "bonesistools"
7
7
  description = "BoNesisTools is a python package proposing bioinformatics tools for upstream and downstream analysis of BoNesis framework"
8
- version = "1.2.0"
8
+ version = "1.2.1"
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,21 @@ 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
27
+ from typing import 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
+
29
36
  __credits__ = "BNeDiction; PEPR Santé Numérique 2030"
30
37
 
31
38
  __all__ = [
@@ -51,11 +58,14 @@ _sys.modules.update(
51
58
  )
52
59
 
53
60
 
54
- def __getattr__(name):
61
+ def __getattr__(name: str) -> ModuleType:
55
62
  if name == "grn":
56
- _warnings.warn(
63
+ message = (
57
64
  "`bt.grn` is deprecated and will be removed in a future release; "
58
- "use `bt.bpy.ig` instead.",
65
+ "use `bt.bpy.ig` instead."
66
+ )
67
+ _warnings.warn(
68
+ message,
59
69
  FutureWarning,
60
70
  stacklevel=2,
61
71
  )
@@ -68,5 +78,5 @@ def __getattr__(name):
68
78
  raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
69
79
 
70
80
 
71
- def __dir__():
81
+ def __dir__() -> list[str]:
72
82
  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
+ ]
@@ -16,8 +16,12 @@ ig
16
16
  Interaction and influence graph utilities.
17
17
  """
18
18
 
19
- import warnings as _warnings
19
+ from __future__ import annotations
20
+
20
21
  import sys as _sys
22
+ import warnings as _warnings
23
+ from types import ModuleType
24
+ from typing import cast
21
25
 
22
26
  from . import boolean_algebra as ba
23
27
  from . import boolean_network as bn
@@ -27,34 +31,40 @@ _sys.modules.update(
27
31
  {f"{__name__}.{alias}": globals()[alias] for alias in ["ba", "bn", "ig"]}
28
32
  )
29
33
 
30
- _DEPRECATED = {
34
+ _MODULES: dict[str, ModuleType] = {
35
+ "ba": ba,
36
+ "bn": bn,
37
+ "ig": ig,
38
+ }
39
+
40
+ _DEPRECATED: dict[str, tuple[str, str]] = {
31
41
  "PartialBoolean": ("ba", "PartialBoolean"),
32
42
  "BooleanNetworkEnsemble": ("bn", "BooleanNetworkEnsemble"),
33
- "Hypercube": ("bn", "Hypercube"),
34
- "HypercubeCollection": ("bn", "HypercubeCollection"),
43
+ "Hypercube": ("ba", "Hypercube"),
44
+ "HypercubeCollection": ("ba", "HypercubeCollection"),
35
45
  "bn_to_pydot": ("bn", "bn_to_pydot"),
36
46
  }
37
47
 
48
+ __all__ = [
49
+ "ba",
50
+ "bn",
51
+ "ig",
52
+ ]
53
+
38
54
 
39
- def __getattr__(name):
55
+ def __getattr__(name: str) -> object:
40
56
  if name in _DEPRECATED:
41
57
  module_alias, attr = _DEPRECATED[name]
42
58
  _warnings.warn(
43
- f"`bt.bpy.{name}` is deprecated; use `bt.bpy.{module_alias}.{attr}` instead.",
59
+ f"`bt.bpy.{name}` is deprecated; use "
60
+ f"`bt.bpy.{module_alias}.{attr}` instead.",
44
61
  DeprecationWarning,
45
62
  stacklevel=2,
46
63
  )
47
- return getattr(globals()[module_alias], attr)
64
+ return cast(object, getattr(_MODULES[module_alias], attr))
48
65
 
49
66
  raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
50
67
 
51
68
 
52
- __all__ = [
53
- "ba",
54
- "bn",
55
- "ig",
56
- ]
57
-
58
-
59
- def __dir__():
69
+ def __dir__() -> list[str]:
60
70
  return sorted(set(globals()) | set(__all__))
@@ -8,21 +8,25 @@ Boolean algebra, including partial Boolean values and Boolean
8
8
  differential and predecessor inference utilities.
9
9
  """
10
10
 
11
+ from typing import List
12
+
11
13
  from ._algebra import BooleanPredecessorInference, PartialBooleanDifferential
12
14
  from ._boolean import PartialBoolean
13
15
  from ._hypercube import Hypercube, HypercubeCollection
14
- from ._structure import expressions_equivalent, dnf_to_structure
15
- from ._representation import rule_to_string
16
16
  from ._parser import read_hypercube, read_hypercubes
17
+ from ._representation import rule_to_string
18
+ from ._structure import dnf_to_structure, expressions_equivalent
17
19
  from ._typing import (
18
20
  BooleanRule,
19
- PartialBooleanLike,
21
+ ConfigurationLike,
20
22
  HypercubeLike,
23
+ PartialBooleanLike,
21
24
  is_boolean_expression_available,
22
25
  is_boolean_expression_like,
23
26
  is_boolean_rule_like,
24
- is_partial_boolean_like,
27
+ is_configuration_like,
25
28
  is_hypercube_like,
29
+ is_partial_boolean_like,
26
30
  )
27
31
 
28
32
  __all__ = [
@@ -37,15 +41,17 @@ __all__ = [
37
41
  "read_hypercube",
38
42
  "read_hypercubes",
39
43
  "BooleanRule",
44
+ "ConfigurationLike",
40
45
  "PartialBooleanLike",
41
46
  "HypercubeLike",
42
47
  "is_boolean_expression_available",
43
48
  "is_boolean_expression_like",
44
49
  "is_boolean_rule_like",
50
+ "is_configuration_like",
45
51
  "is_partial_boolean_like",
46
52
  "is_hypercube_like",
47
53
  ]
48
54
 
49
55
 
50
- def __dir__():
56
+ def __dir__() -> List[str]:
51
57
  return sorted(set(globals()) | set(__all__))