bonesistools 1.2.4__tar.gz → 1.2.6__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.
- {bonesistools-1.2.4 → bonesistools-1.2.6}/.gitignore +2 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/PKG-INFO +10 -4
- {bonesistools-1.2.4 → bonesistools-1.2.6}/README.md +1 -1
- {bonesistools-1.2.4 → bonesistools-1.2.6}/pyproject.toml +14 -3
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/__init__.py +7 -8
- bonesistools-1.2.6/src/bonesistools/_metadata.py +70 -0
- bonesistools-1.2.6/src/bonesistools/_typing.py +13 -0
- bonesistools-1.2.6/src/bonesistools/_validation.py +388 -0
- bonesistools-1.2.6/src/bonesistools/_warnings.py +31 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/__init__.py +4 -5
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_algebra.py +1 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_hypercube.py +41 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_parser.py +20 -17
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_structure.py +10 -5
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_typing.py +1 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_network/__init__.py +4 -6
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_network/_network.py +43 -21
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/influence_graph/__init__.py +3 -0
- bonesistools-1.2.6/src/bonesistools/boolpy/influence_graph/_distances.py +192 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/influence_graph/_influence_graph.py +50 -49
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/influence_graph/_parser.py +1 -4
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/influence_graph/_scoring.py +13 -15
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/plotting/_graphviz.py +3 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/_orthologs.py +186 -64
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/ncbi/_genesyn.py +31 -45
- bonesistools-1.2.6/src/bonesistools/databases/ncbi/_typing.py +18 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/omnipath/_archive.py +24 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/omnipath/_collectri.py +23 -37
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/omnipath/_dorothea.py +30 -27
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/_dependencies.py +0 -35
- bonesistools-1.2.6/src/bonesistools/sctools/_metadata.py +21 -0
- bonesistools-1.2.6/src/bonesistools/sctools/_stats.py +90 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/_typing.py +39 -15
- bonesistools-1.2.6/src/bonesistools/sctools/_validation.py +130 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/datasets/__init__.py +8 -8
- bonesistools-1.2.6/src/bonesistools/sctools/datasets/_geo.py +475 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_barplot.py +94 -5
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_colors.py +12 -27
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_density.py +125 -21
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_distribution.py +136 -12
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_figure.py +2 -1
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_graph.py +140 -23
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_scatterplot.py +97 -49
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/preprocessing/__init__.py +16 -7
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/preprocessing/_duplicates.py +86 -12
- bonesistools-1.2.6/src/bonesistools/sctools/preprocessing/_filter.py +106 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/preprocessing/_genename.py +91 -24
- bonesistools-1.2.6/src/bonesistools/sctools/preprocessing/_simple.py +63 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/preprocessing/_transfer.py +176 -36
- bonesistools-1.2.6/src/bonesistools/sctools/preprocessing/_transform.py +491 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/tools/__init__.py +26 -13
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_binarize.py +246 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/tools/_classification.py +102 -42
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_clustering.py +649 -0
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_embedding.py +736 -0
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_graph.py +286 -0
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_markers.py +884 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/tools/_maths.py +52 -9
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_neighbors.py +1930 -0
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_regress.py +128 -0
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_stats.py +830 -0
- bonesistools-1.2.6/src/bonesistools/sctools/tools/_utils.py +461 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/tools/_write.py +2 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_aggregated_influence_graph.py +26 -18
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_boolean_algebra.py +5 -4
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_boolean_network.py +41 -27
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_boolean_network_ensemble.py +23 -11
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_hypercube.py +8 -6
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_hypercube_collection.py +4 -3
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_influence_graph.py +34 -18
- bonesistools-1.2.6/tests/bpy/test_influence_graph_distances.py +220 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_influence_graph_parser.py +11 -6
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/dbs/test_hcop.py +107 -2
- bonesistools-1.2.6/tests/dbs/test_hcop_orthologs.py +217 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/dbs/test_ncbi.py +164 -10
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/dbs/test_omnipath.py +15 -13
- bonesistools-1.2.4/tests/dbs/test_omnipath_reproducibility.py → bonesistools-1.2.6/tests/reproducibility/test_reproducibility_omnipath.py +6 -9
- bonesistools-1.2.6/tests/reproducibility/test_reproducibility_stats.py +34 -0
- bonesistools-1.2.6/tests/reproducibility/test_reproducibility_workflow.py +247 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/conftest.py +3 -2
- bonesistools-1.2.6/tests/sct/datasets/test_geo.py +293 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_barplot.py +34 -7
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_colors.py +3 -2
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_density.py +1 -1
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_distribution.py +44 -16
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_figure.py +2 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_graph.py +55 -2
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/plotting/test_scatterplot.py +33 -5
- bonesistools-1.2.6/tests/sct/preprocessing/test_duplicates.py +211 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/preprocessing/test_genename.py +42 -32
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/preprocessing/test_simple.py +14 -12
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/preprocessing/test_transfer_obs.py +7 -2
- bonesistools-1.2.6/tests/sct/preprocessing/test_transform.py +851 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/test_typing.py +7 -4
- bonesistools-1.2.6/tests/sct/tools/test_binarize.py +89 -0
- bonesistools-1.2.6/tests/sct/tools/test_classification.py +62 -0
- bonesistools-1.2.6/tests/sct/tools/test_clustering.py +337 -0
- bonesistools-1.2.6/tests/sct/tools/test_conversion.py +48 -0
- bonesistools-1.2.6/tests/sct/tools/test_embedding.py +511 -0
- bonesistools-1.2.6/tests/sct/tools/test_knnsc.py +681 -0
- bonesistools-1.2.6/tests/sct/tools/test_markers.py +772 -0
- bonesistools-1.2.6/tests/sct/tools/test_maths.py +47 -0
- bonesistools-1.2.6/tests/sct/tools/test_neighbors.py +513 -0
- bonesistools-1.2.6/tests/sct/tools/test_paga.py +140 -0
- bonesistools-1.2.6/tests/sct/tools/test_regress.py +219 -0
- bonesistools-1.2.6/tests/sct/tools/test_stats.py +946 -0
- bonesistools-1.2.6/tests/sct/tools/test_utils.py +391 -0
- bonesistools-1.2.6/tests/test_import.py +24 -0
- bonesistools-1.2.6/tests/test_validation.py +39 -0
- bonesistools-1.2.4/src/bonesistools/databases/ncbi/_typing.py +0 -6
- bonesistools-1.2.4/src/bonesistools/sctools/preprocessing/_simple.py +0 -185
- bonesistools-1.2.4/src/bonesistools/sctools/tools/_graph.py +0 -117
- bonesistools-1.2.4/src/bonesistools/sctools/tools/_markers.py +0 -375
- bonesistools-1.2.4/src/bonesistools/sctools/tools/_neighbors.py +0 -993
- bonesistools-1.2.4/src/bonesistools/sctools/tools/_regress.py +0 -103
- bonesistools-1.2.4/src/bonesistools/sctools/tools/_utils.py +0 -232
- bonesistools-1.2.4/tests/dbs/test_hcop_orthologs.py +0 -105
- bonesistools-1.2.4/tests/sct/tools/test_graph_neighbors_classification.py +0 -186
- bonesistools-1.2.4/tests/sct/tools/test_knnbs.py +0 -399
- bonesistools-1.2.4/tests/sct/tools/test_utils_conversion_maths.py +0 -533
- {bonesistools-1.2.4 → bonesistools-1.2.6}/LICENSE +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/_compat.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_boolean.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_algebra/_representation.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_network/_parser.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/boolean_network/_typing.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/influence_graph/_algorithms.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/influence_graph/_typing.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/plotting/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/plotting/_styles.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/boolpy/plotting/_svg.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_anole_lizard_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_c.elegans_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_cat_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_cattle_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_chicken_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_chimpanzee_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_dog_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_fruitfly_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_horse_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_macaque_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_mouse_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_opossum_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_pig_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_platypus_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_rat_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_s.cerevisiae_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_s.pombe_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_xenopus_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/hcop/data/human_zebrafish_hcop.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/ncbi/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/ncbi/data/gi/escherichia_coli_gene_info.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/ncbi/data/gi/homo_sapiens_gene_info.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/ncbi/data/gi/mus_musculus_gene_info.tsv.gz +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/databases/omnipath/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/grntools/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/py.typed +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/datasets/nestorowa_hvg.h5ad +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/__init__.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_typing.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/plotting/_utils.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/src/bonesistools/sctools/tools/_conversion.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/conftest.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_influence_graph_scoring.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_partial_boolean.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/bpy/test_plotting_styles.py +0 -0
- {bonesistools-1.2.4 → bonesistools-1.2.6}/tests/sct/tools/test_write.py +0 -0
|
@@ -62,6 +62,7 @@ Thumbs.db
|
|
|
62
62
|
/tmp/
|
|
63
63
|
/temp/
|
|
64
64
|
*.tmp
|
|
65
|
+
*tmp*
|
|
65
66
|
*.bak
|
|
66
67
|
*.bak.tsv
|
|
67
68
|
|
|
@@ -111,6 +112,7 @@ src/bonesistools/databases/omnipath/.cache/
|
|
|
111
112
|
!tests/data/
|
|
112
113
|
!tests/data/*.h5ad
|
|
113
114
|
tests/dbs/data/*.json
|
|
115
|
+
tests/reproducibility/*.json
|
|
114
116
|
!src/bonesistools/sctools/datasets/
|
|
115
117
|
!src/bonesistools/sctools/datasets/*.h5ad
|
|
116
118
|
scripts/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bonesistools
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.6
|
|
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
|
|
@@ -551,21 +551,25 @@ Requires-Python: >=3.7
|
|
|
551
551
|
Requires-Dist: anndata>=0.8
|
|
552
552
|
Requires-Dist: boolean-py>=4.0
|
|
553
553
|
Requires-Dist: h5py>=3.7
|
|
554
|
+
Requires-Dist: importlib-metadata; python_version < '3.8'
|
|
554
555
|
Requires-Dist: importlib-resources; python_version < '3.9'
|
|
555
556
|
Requires-Dist: matplotlib>=3.5
|
|
556
557
|
Requires-Dist: networkx>=2.1
|
|
557
558
|
Requires-Dist: numpy>=1.21
|
|
558
559
|
Requires-Dist: pandas>=1.3.5
|
|
560
|
+
Requires-Dist: scikit-learn>=1.0
|
|
559
561
|
Requires-Dist: scipy>=1.7
|
|
560
562
|
Requires-Dist: typing-extensions>=4.0
|
|
561
563
|
Provides-Extra: all
|
|
562
564
|
Requires-Dist: graphviz>=0.20; extra == 'all'
|
|
565
|
+
Requires-Dist: igraph>=0.10; extra == 'all'
|
|
566
|
+
Requires-Dist: leidenalg>=0.10; extra == 'all'
|
|
563
567
|
Requires-Dist: mpbn>=4.1; extra == 'all'
|
|
564
568
|
Requires-Dist: mudata>=0.3.1; extra == 'all'
|
|
565
569
|
Requires-Dist: multiprocess>=0.70.18; extra == 'all'
|
|
566
570
|
Requires-Dist: pydot>=3.0.2; extra == 'all'
|
|
567
|
-
Requires-Dist: scikit-learn>=1.0; extra == 'all'
|
|
568
571
|
Requires-Dist: seaborn>=0.11; extra == 'all'
|
|
572
|
+
Requires-Dist: umap-learn>=0.5; extra == 'all'
|
|
569
573
|
Provides-Extra: graphviz
|
|
570
574
|
Requires-Dist: graphviz>=0.20; extra == 'graphviz'
|
|
571
575
|
Provides-Extra: mpbn
|
|
@@ -573,7 +577,9 @@ Requires-Dist: mpbn>=4.1; extra == 'mpbn'
|
|
|
573
577
|
Provides-Extra: mudata
|
|
574
578
|
Requires-Dist: mudata>=0.3.1; extra == 'mudata'
|
|
575
579
|
Provides-Extra: sctools
|
|
576
|
-
Requires-Dist:
|
|
580
|
+
Requires-Dist: igraph>=0.10; extra == 'sctools'
|
|
581
|
+
Requires-Dist: leidenalg>=0.10; extra == 'sctools'
|
|
582
|
+
Requires-Dist: umap-learn>=0.5; extra == 'sctools'
|
|
577
583
|
Description-Content-Type: text/markdown
|
|
578
584
|
|
|
579
585
|
[](https://github.com/bnediction/bonesistools/actions/workflows/tests.yml)
|
|
@@ -611,7 +617,7 @@ import bonesistools as bt
|
|
|
611
617
|
|
|
612
618
|
## Single-cell tools
|
|
613
619
|
|
|
614
|
-
`bt.sct`
|
|
620
|
+
`bt.sct` is inspired by [Scanpy](https://github.com/scverse/scanpy) while providing additional and complementary features for single-cell analyses.
|
|
615
621
|
|
|
616
622
|
Submodules:
|
|
617
623
|
|
|
@@ -33,7 +33,7 @@ import bonesistools as bt
|
|
|
33
33
|
|
|
34
34
|
## Single-cell tools
|
|
35
35
|
|
|
36
|
-
`bt.sct`
|
|
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.
|
|
8
|
+
version = "1.2.6"
|
|
9
9
|
license = {file = "LICENSE"}
|
|
10
10
|
credits = ["BNeDiction", "PEPR Santé Numérique 2030"]
|
|
11
11
|
authors = [
|
|
@@ -41,11 +41,13 @@ classifiers = [
|
|
|
41
41
|
]
|
|
42
42
|
requires-python = ">=3.7"
|
|
43
43
|
dependencies = [
|
|
44
|
+
"importlib-metadata; python_version < '3.8'",
|
|
44
45
|
"importlib_resources; python_version < '3.9'",
|
|
45
46
|
"typing-extensions>=4.0",
|
|
46
47
|
"numpy>=1.21",
|
|
47
48
|
"pandas>=1.3.5",
|
|
48
49
|
"scipy>=1.7",
|
|
50
|
+
"scikit-learn>=1.0",
|
|
49
51
|
"networkx>=2.1",
|
|
50
52
|
"matplotlib>=3.5",
|
|
51
53
|
"h5py>=3.7",
|
|
@@ -71,14 +73,20 @@ all = [
|
|
|
71
73
|
"mudata>=0.3.1",
|
|
72
74
|
"multiprocess>=0.70.18",
|
|
73
75
|
"pydot>=3.0.2",
|
|
74
|
-
"
|
|
76
|
+
"igraph>=0.10",
|
|
77
|
+
"leidenalg>=0.10",
|
|
75
78
|
"seaborn>=0.11",
|
|
79
|
+
"umap-learn>=0.5",
|
|
76
80
|
"mpbn>=4.1",
|
|
77
81
|
]
|
|
78
82
|
graphviz = [ "graphviz>=0.20" ]
|
|
79
83
|
mudata = [ "mudata>=0.3.1" ]
|
|
80
84
|
mpbn = [ "mpbn>=4.1" ]
|
|
81
|
-
sctools = [
|
|
85
|
+
sctools = [
|
|
86
|
+
"igraph>=0.10",
|
|
87
|
+
"leidenalg>=0.10",
|
|
88
|
+
"umap-learn>=0.5",
|
|
89
|
+
]
|
|
82
90
|
|
|
83
91
|
[tool.hatch.build.targets.sdist]
|
|
84
92
|
ignore-vcs = true
|
|
@@ -113,6 +121,9 @@ select = ["E", "F", "I"]
|
|
|
113
121
|
typing-modules = ["bonesistools._compat"]
|
|
114
122
|
|
|
115
123
|
[tool.pytest.ini_options]
|
|
124
|
+
norecursedirs = [
|
|
125
|
+
"tests/reproducibility",
|
|
126
|
+
]
|
|
116
127
|
filterwarnings = [
|
|
117
128
|
"ignore:The NumPy module was reloaded:UserWarning",
|
|
118
129
|
]
|
|
@@ -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,8 @@ 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 ._metadata import package_version as _package_version
|
|
33
|
+
from ._warnings import _warn_deprecated
|
|
33
34
|
|
|
34
35
|
if _TYPE_CHECKING:
|
|
35
36
|
from . import grntools as grn
|
|
@@ -37,8 +38,10 @@ if _TYPE_CHECKING:
|
|
|
37
38
|
del annotations
|
|
38
39
|
|
|
39
40
|
__credits__ = "BNeDiction; PEPR Santé Numérique 2030"
|
|
41
|
+
__version__ = _package_version()
|
|
40
42
|
|
|
41
43
|
__all__ = [
|
|
44
|
+
"__version__",
|
|
42
45
|
"sct",
|
|
43
46
|
"bpy",
|
|
44
47
|
"dbs",
|
|
@@ -66,13 +69,9 @@ _sys.modules.update(
|
|
|
66
69
|
|
|
67
70
|
def __getattr__(name: str) -> _ModuleType:
|
|
68
71
|
if name == "grn":
|
|
69
|
-
|
|
70
|
-
"`bt.grn`
|
|
71
|
-
"
|
|
72
|
-
)
|
|
73
|
-
_warnings.warn(
|
|
74
|
-
message,
|
|
75
|
-
FutureWarning,
|
|
72
|
+
_warn_deprecated(
|
|
73
|
+
"`bt.grn`",
|
|
74
|
+
replacement="`bt.bpy.ig`",
|
|
76
75
|
stacklevel=2,
|
|
77
76
|
)
|
|
78
77
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, Optional, cast
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def package_version(distribution: str = "bonesistools") -> str:
|
|
11
|
+
"""
|
|
12
|
+
Return the installed package version.
|
|
13
|
+
|
|
14
|
+
When the package is imported directly from a source checkout, distribution
|
|
15
|
+
metadata can be unavailable. In that case, read the version from
|
|
16
|
+
`pyproject.toml`.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
source_version = _pyproject_version()
|
|
20
|
+
if source_version is not None:
|
|
21
|
+
return source_version
|
|
22
|
+
|
|
23
|
+
installed_version = _installed_version(distribution)
|
|
24
|
+
return installed_version if installed_version is not None else "0+unknown"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _installed_version(distribution: str) -> Optional[str]:
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
metadata = importlib.import_module("importlib.metadata")
|
|
31
|
+
except ImportError: # pragma: no cover - Python 3.7 compatibility
|
|
32
|
+
metadata = importlib.import_module("importlib_metadata")
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
return cast(str, cast(Any, metadata).version(distribution))
|
|
36
|
+
except Exception as error:
|
|
37
|
+
if error.__class__.__name__ == "PackageNotFoundError":
|
|
38
|
+
return None
|
|
39
|
+
raise
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _pyproject_version() -> Optional[str]:
|
|
43
|
+
|
|
44
|
+
pyproject = _find_pyproject()
|
|
45
|
+
if pyproject is None:
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
in_project = False
|
|
49
|
+
for line in pyproject.read_text(encoding="utf-8").splitlines():
|
|
50
|
+
stripped = line.strip()
|
|
51
|
+
if stripped == "[project]":
|
|
52
|
+
in_project = True
|
|
53
|
+
continue
|
|
54
|
+
if in_project and stripped.startswith("["):
|
|
55
|
+
return None
|
|
56
|
+
if in_project and stripped.startswith("version"):
|
|
57
|
+
_, value = stripped.split("=", 1)
|
|
58
|
+
return value.strip().strip("\"'")
|
|
59
|
+
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _find_pyproject() -> Optional[Path]:
|
|
64
|
+
|
|
65
|
+
for parent in Path(__file__).resolve().parents:
|
|
66
|
+
pyproject = parent / "pyproject.toml"
|
|
67
|
+
if pyproject.exists():
|
|
68
|
+
return pyproject
|
|
69
|
+
|
|
70
|
+
return None
|
|
@@ -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
|
+
)
|