zmap-tools 0.2.2.2__tar.gz → 0.2.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/PKG-INFO +19 -15
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/pyproject.toml +25 -15
- zmap_tools-0.2.2.5/src/zmap/__init__.py +76 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/dotplot/dotplot_gene.py +82 -17
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/predict/__init__.py +49 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2.py +1975 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/matrix/A_ref_based_3d_weight_matrix_softSpecificityAllcells_timeblockBg_stageEq_full251209_excl_blast_unassigned_expr0p25_pct10_tau1_top1bonus1p5_shrinkM50P50_4term/all_gene_weight_by_celltype_stage_rank_by_weight_mean1_desc_only_MODULE_COMPARABLE_ZEROLOCK.csv +4 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/output/baseline2_zscore_job1148438/label_encoder.joblib +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/output/baseline2_zscore_job1148438/mlp_model.pt +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/output/baseline2_zscore_job1148438/mlp_scaler.joblib +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/output/baseline2_zscore_job1148438/module_input_scale_mean.npy +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/output/baseline2_zscore_job1148438/module_input_scale_std.npy +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/output/baseline2_zscore_job1148438/run_config.json +54 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/script/benchmark_independent_encoder_marker_hvg.py +858 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/script/train_celltype_torch_mlp_lgbxt_ensemble.py +791 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/script/train_encoder_ensembly.py +3839 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2/script/train_time_weighted_module_encoder_mlp.py +667 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/matrix/A_ref_based_3d_weight_matrix_softSpecificityAllcells_timeblockBg_stageEq_full251209_ZMAP_Tissue_excl_blast_unassigned_expr0p25_pct10_tau1_top1bonus1p5_shrinkM50P50_4term/all_gene_weight_by_tissue_stage_rank_by_weight_mean1_desc_only_MODULE_COMPARABLE_ZEROLOCK.csv +4 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/output/baseline2_tissue_zscore_job1149526/label_encoder.joblib +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/output/baseline2_tissue_zscore_job1149526/mlp_model.pt +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/output/baseline2_tissue_zscore_job1149526/mlp_scaler.joblib +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/output/baseline2_tissue_zscore_job1149526/module_input_scale_mean.npy +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/output/baseline2_tissue_zscore_job1149526/module_input_scale_std.npy +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/baseline2_tissue/output/baseline2_tissue_zscore_job1149526/run_config.json +54 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/shared/encoder/xpca_harmony_260103_no_unassigned_blastomere_res1_wd1e4_coral0p05/model/config.json +97 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/shared/encoder/xpca_harmony_260103_no_unassigned_blastomere_res1_wd1e4_coral0p05/model/encoder.pt +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/baseline2_file/shared/time_model/timeid_hvg_logreg_stage_model.joblib +0 -0
- zmap_tools-0.2.2.5/src/zmap/predict/encoder_pipeline.py +3649 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap_tools.egg-info/PKG-INFO +19 -15
- zmap_tools-0.2.2.5/src/zmap_tools.egg-info/SOURCES.txt +41 -0
- zmap_tools-0.2.2.5/src/zmap_tools.egg-info/requires.txt +20 -0
- zmap_tools-0.2.2.2/src/zmap/__init__.py +0 -36
- zmap_tools-0.2.2.2/src/zmap_tools.egg-info/SOURCES.txt +0 -18
- zmap_tools-0.2.2.2/src/zmap_tools.egg-info/requires.txt +0 -17
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/LICENSE +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/README.md +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/setup.cfg +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/dotplot/__init__.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/dotplot/dotplot_group.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/predict/knn_backend.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/predict/predict.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/reference/__init__.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/reference/load_h5ad.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap/reference/markers.py +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap_tools.egg-info/dependency_links.txt +0 -0
- {zmap_tools-0.2.2.2 → zmap_tools-0.2.2.5}/src/zmap_tools.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zmap-tools
|
|
3
|
-
Version: 0.2.2.
|
|
3
|
+
Version: 0.2.2.5
|
|
4
4
|
Summary: API for working with ZMAP (Zebrafish Multi-Atlas Project)
|
|
5
5
|
Author-email: Daniel Wagner <Daniel.Wagner@ucsf.edu>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -44,26 +44,30 @@ Classifier: Programming Language :: Python :: 3
|
|
|
44
44
|
Classifier: Programming Language :: Python :: 3.10
|
|
45
45
|
Classifier: Programming Language :: Python :: 3.11
|
|
46
46
|
Classifier: Programming Language :: Python :: 3.12
|
|
47
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
47
48
|
Requires-Python: >=3.10
|
|
48
49
|
Description-Content-Type: text/markdown
|
|
49
50
|
License-File: LICENSE
|
|
50
|
-
Requires-Dist: anndata
|
|
51
|
-
Requires-Dist: scanpy
|
|
52
|
-
Requires-Dist: numpy
|
|
53
|
-
Requires-Dist: numba
|
|
54
|
-
Requires-Dist:
|
|
55
|
-
Requires-Dist:
|
|
56
|
-
Requires-Dist: matplotlib<4.0,>=3.7
|
|
51
|
+
Requires-Dist: anndata<0.14,>=0.12.18
|
|
52
|
+
Requires-Dist: scanpy<1.13,>=1.12.1
|
|
53
|
+
Requires-Dist: numpy<3,>=2.1
|
|
54
|
+
Requires-Dist: numba>=0.64
|
|
55
|
+
Requires-Dist: pandas<3,>=2.2
|
|
56
|
+
Requires-Dist: matplotlib<4,>=3.7
|
|
57
57
|
Requires-Dist: requests>=2.31
|
|
58
|
-
Requires-Dist: scipy
|
|
59
|
-
Requires-Dist: scikit-learn
|
|
60
|
-
Requires-Dist: faiss-cpu
|
|
61
|
-
Requires-Dist: seaborn
|
|
58
|
+
Requires-Dist: scipy<2,>=1.15
|
|
59
|
+
Requires-Dist: scikit-learn<2,>=1.6
|
|
60
|
+
Requires-Dist: faiss-cpu<2,>=1.14.3
|
|
61
|
+
Requires-Dist: seaborn<0.14,>=0.13.2
|
|
62
62
|
Requires-Dist: tqdm>=4.66
|
|
63
63
|
Requires-Dist: adjustText>=0.8
|
|
64
|
-
Requires-Dist: symphonypy
|
|
65
|
-
Requires-Dist: igraph
|
|
66
|
-
Requires-Dist: leidenalg
|
|
64
|
+
Requires-Dist: symphonypy<0.3,>=0.2.4
|
|
65
|
+
Requires-Dist: igraph<2,>=1.0
|
|
66
|
+
Requires-Dist: leidenalg<0.13,>=0.12
|
|
67
|
+
Requires-Dist: joblib>=1.3
|
|
68
|
+
Requires-Dist: h5py>=3.0
|
|
69
|
+
Requires-Dist: torch>=2.0
|
|
70
|
+
Requires-Dist: lightgbm>=4.0
|
|
67
71
|
Dynamic: license-file
|
|
68
72
|
|
|
69
73
|
# zmap-tools
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "zmap-tools"
|
|
7
|
-
version = "0.2.2.
|
|
7
|
+
version = "0.2.2.5"
|
|
8
8
|
description = "API for working with ZMAP (Zebrafish Multi-Atlas Project)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -24,28 +24,32 @@ classifiers = [
|
|
|
24
24
|
"Programming Language :: Python :: 3.10",
|
|
25
25
|
"Programming Language :: Python :: 3.11",
|
|
26
26
|
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
27
28
|
]
|
|
28
29
|
|
|
29
30
|
dependencies = [
|
|
30
|
-
"anndata
|
|
31
|
-
"scanpy
|
|
31
|
+
"anndata>=0.12.18,<0.14",
|
|
32
|
+
"scanpy>=1.12.1,<1.13",
|
|
32
33
|
|
|
33
|
-
"numpy
|
|
34
|
-
"numba
|
|
35
|
-
"llvmlite==0.43.0",
|
|
34
|
+
"numpy>=2.1,<3",
|
|
35
|
+
"numba>=0.64",
|
|
36
36
|
|
|
37
|
-
"pandas>=2.
|
|
38
|
-
"matplotlib>=3.7,<4
|
|
37
|
+
"pandas>=2.2,<3",
|
|
38
|
+
"matplotlib>=3.7,<4",
|
|
39
39
|
"requests>=2.31",
|
|
40
|
-
"scipy
|
|
41
|
-
"scikit-learn
|
|
42
|
-
"faiss-cpu
|
|
43
|
-
"seaborn
|
|
40
|
+
"scipy>=1.15,<2",
|
|
41
|
+
"scikit-learn>=1.6,<2",
|
|
42
|
+
"faiss-cpu>=1.14.3,<2",
|
|
43
|
+
"seaborn>=0.13.2,<0.14",
|
|
44
44
|
"tqdm>=4.66",
|
|
45
45
|
"adjustText>=0.8",
|
|
46
|
-
"symphonypy
|
|
47
|
-
"igraph
|
|
48
|
-
"leidenalg
|
|
46
|
+
"symphonypy>=0.2.4,<0.3",
|
|
47
|
+
"igraph>=1.0,<2",
|
|
48
|
+
"leidenalg>=0.12,<0.13",
|
|
49
|
+
"joblib>=1.3",
|
|
50
|
+
"h5py>=3.0",
|
|
51
|
+
"torch>=2.0",
|
|
52
|
+
"lightgbm>=4.0",
|
|
49
53
|
]
|
|
50
54
|
|
|
51
55
|
[project.urls]
|
|
@@ -55,6 +59,12 @@ Issues = "https://github.com/WagnerLabUCSF/zmap-tools/issues"
|
|
|
55
59
|
|
|
56
60
|
[tool.setuptools]
|
|
57
61
|
package-dir = {"" = "src"}
|
|
62
|
+
include-package-data = true
|
|
58
63
|
|
|
59
64
|
[tool.setuptools.packages.find]
|
|
60
65
|
where = ["src"]
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.package-data]
|
|
68
|
+
zmap = [
|
|
69
|
+
"predict/baseline2_file/**/*",
|
|
70
|
+
]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
zmap-tools — Python API for the Zebrafish Multi-Atlas Project (ZMAP).
|
|
5
|
+
|
|
6
|
+
A curated single-cell RNA-seq reference atlas for zebrafish development,
|
|
7
|
+
with tools for reference loading, label transfer, and visualization.
|
|
8
|
+
|
|
9
|
+
Submodules
|
|
10
|
+
----------
|
|
11
|
+
reference (aliased as ref)
|
|
12
|
+
Download, cache, and load ZMAP reference H5ADs and consensus markers.
|
|
13
|
+
predict
|
|
14
|
+
kNN-based label transfer from the ZMAP reference to query datasets.
|
|
15
|
+
dotplot
|
|
16
|
+
Publication-ready dotplot visualization of gene expression patterns.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from importlib.metadata import PackageNotFoundError, version as _version
|
|
20
|
+
|
|
21
|
+
# Package version (from the PyPI/dist name)
|
|
22
|
+
try:
|
|
23
|
+
__version__ = _version("zmap-tools")
|
|
24
|
+
except PackageNotFoundError:
|
|
25
|
+
__version__ = "0.0.0"
|
|
26
|
+
|
|
27
|
+
# Import subpackages as attributes
|
|
28
|
+
from . import reference # zmap.reference
|
|
29
|
+
from . import dotplot # zmap.dotplot
|
|
30
|
+
from . import predict # zmap.predict
|
|
31
|
+
|
|
32
|
+
# Scanpy-style aliases:
|
|
33
|
+
ref = reference
|
|
34
|
+
|
|
35
|
+
# Top-level convenience APIs for biological module / baseline2 workflows.
|
|
36
|
+
apply_encoder = predict.apply_encoder
|
|
37
|
+
zmap_projection = predict.zmap_projection
|
|
38
|
+
predict_pseudo_tissue = predict.predict_pseudo_tissue
|
|
39
|
+
knn_config = predict.knn_config
|
|
40
|
+
time_prediction_KNN = predict.time_prediction_KNN
|
|
41
|
+
time_prediction_MLP = predict.time_prediction_MLP
|
|
42
|
+
predict_labels_MLP = predict.predict_labels_MLP
|
|
43
|
+
predict_labels_mlp = predict.predict_labels_mlp
|
|
44
|
+
predict_labels_baseline2 = predict.predict_labels_baseline2
|
|
45
|
+
predict_labels_baseline_tissue = predict.predict_labels_baseline_tissue
|
|
46
|
+
baseline2 = predict.baseline2
|
|
47
|
+
baseline_tissue = predict.baseline_tissue
|
|
48
|
+
plot_conf_entropy_margin = predict.plot_conf_entropy_margin
|
|
49
|
+
plot_pseudo_tissue_conf_entropy_margin = predict.plot_pseudo_tissue_conf_entropy_margin
|
|
50
|
+
plot_confusion_matrix = predict.plot_confusion_matrix
|
|
51
|
+
report_leiden_celltype_topk = predict.report_leiden_celltype_topk
|
|
52
|
+
plot_leiden_celltype = predict.plot_leiden_celltype
|
|
53
|
+
plot_projection_celltype_overlay = predict.plot_projection_celltype_overlay
|
|
54
|
+
|
|
55
|
+
__all__ = ["__version__", "ref", "dotplot", "predict"]
|
|
56
|
+
|
|
57
|
+
__all__ += [
|
|
58
|
+
"apply_encoder",
|
|
59
|
+
"zmap_projection",
|
|
60
|
+
"predict_pseudo_tissue",
|
|
61
|
+
"knn_config",
|
|
62
|
+
"time_prediction_KNN",
|
|
63
|
+
"time_prediction_MLP",
|
|
64
|
+
"predict_labels_MLP",
|
|
65
|
+
"predict_labels_mlp",
|
|
66
|
+
"predict_labels_baseline2",
|
|
67
|
+
"predict_labels_baseline_tissue",
|
|
68
|
+
"baseline2",
|
|
69
|
+
"baseline_tissue",
|
|
70
|
+
"plot_conf_entropy_margin",
|
|
71
|
+
"plot_pseudo_tissue_conf_entropy_margin",
|
|
72
|
+
"plot_confusion_matrix",
|
|
73
|
+
"report_leiden_celltype_topk",
|
|
74
|
+
"plot_leiden_celltype",
|
|
75
|
+
"plot_projection_celltype_overlay",
|
|
76
|
+
]
|
|
@@ -39,6 +39,29 @@ DEFAULT_ROW_COLOR_GROUPS_ZMAP_CellType = {
|
|
|
39
39
|
|
|
40
40
|
DEFAULT_ROW_DIVIDERS_ZMAP_CellType = [1, 11, 18, 24, 31, 35, 49, 63, 68, 73, 76]
|
|
41
41
|
|
|
42
|
+
DEFAULT_CLUSTER_ORDER_ZMAP_Tissue = [
|
|
43
|
+
'blastomeres',
|
|
44
|
+
'ectoderm_early', 'epidermis', 'ionocyte_epithelium', 'placodes',
|
|
45
|
+
'endoderm_early', 'pharyngeal', 'intestine', 'liver', 'pancreas',
|
|
46
|
+
'neural_crest',
|
|
47
|
+
'neural_early', 'eye', 'forebrain', 'midbrain', 'hindbrain', 'spinal_cord', 'neurons',
|
|
48
|
+
'mesoderm_early', 'axial_meso', 'somitic_meso', 'muscle', 'lateral_plate', 'endothelial', 'fin_bud', 'heart', 'hematopoietic', 'intermediate_meso',
|
|
49
|
+
'primordial_germ_cell',
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
DEFAULT_ROW_COLOR_GROUPS_ZMAP_Tissue = {
|
|
53
|
+
"black": ["blastomeres"],
|
|
54
|
+
"green": ['ectoderm_early', 'epidermis', 'ionocyte_epithelium', 'placodes'],
|
|
55
|
+
"darkorange": ['endoderm_early', 'pharyngeal', 'intestine', 'liver', 'pancreas'],
|
|
56
|
+
"steelblue": ['neural_crest'],
|
|
57
|
+
"blue": ['neural_early', 'eye', 'forebrain', 'midbrain', 'hindbrain', 'spinal_cord', 'neurons'],
|
|
58
|
+
"darkblue": ['optic_cup', 'retinal_pigment_epithelium', 'retina', 'photoreceptors'],
|
|
59
|
+
"red": ['mesoderm_early', 'axial_meso', 'somitic_meso', 'muscle', 'lateral_plate', 'endothelial', 'fin_bud', 'heart', 'hematopoietic', 'intermediate_meso'],
|
|
60
|
+
"purple": ["primordial_germ_cell"],
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
DEFAULT_ROW_DIVIDERS_ZMAP_Tissue = [1, 5, 12, 13, 18, 28]
|
|
64
|
+
|
|
42
65
|
DEFAULT_STUDY_ORDER = ["Kamimoto2023", "Farrell2018", "Kukreja2024", "Wagner2018",
|
|
43
66
|
"Farnsworth2020", "Lange2023", "Sur2023", "Spanjaard2018"]
|
|
44
67
|
|
|
@@ -484,7 +507,7 @@ def gene_groups_vs_time(
|
|
|
484
507
|
size_legend_title: str | None = None,
|
|
485
508
|
size_legend_facecolor: str = "black",
|
|
486
509
|
# ===== ordering & filtering =====
|
|
487
|
-
cluster_order: list[str] | None =
|
|
510
|
+
cluster_order: list[str] | None = None,
|
|
488
511
|
time_order: list[str] | None = None,
|
|
489
512
|
omit_groups: list[str] | None = ['nan', 'unknown'],
|
|
490
513
|
# ===== cosmetics =====
|
|
@@ -497,10 +520,10 @@ def gene_groups_vs_time(
|
|
|
497
520
|
tick_grid_alpha: float = 0.15,
|
|
498
521
|
tick_grid_lw: float = 0.6,
|
|
499
522
|
# ===== Row color group mapping & legend =====
|
|
500
|
-
row_color_groups: dict[str, list[str]] | None =
|
|
523
|
+
row_color_groups: dict[str, list[str]] | None = None,
|
|
501
524
|
show_row_color_legend: bool = False,
|
|
502
525
|
# ===== Horizontal split lines between rows =====
|
|
503
|
-
row_dividers: list[int] | None =
|
|
526
|
+
row_dividers: list[int] | None = None,
|
|
504
527
|
row_divider_color: str = "black",
|
|
505
528
|
row_divider_lw: float = 0.5,
|
|
506
529
|
row_divider_alpha: float = 1,
|
|
@@ -571,6 +594,20 @@ def gene_groups_vs_time(
|
|
|
571
594
|
"""
|
|
572
595
|
color = str(color)
|
|
573
596
|
|
|
597
|
+
# Select defaults based on grouping
|
|
598
|
+
if groupby not in ("ZMAP_CellType", "ZMAP_Tissue"):
|
|
599
|
+
raise ValueError("groupby must be 'ZMAP_CellType' or 'ZMAP_Tissue'")
|
|
600
|
+
|
|
601
|
+
if cluster_order is None:
|
|
602
|
+
cluster_order = globals()[f"DEFAULT_CLUSTER_ORDER_{groupby}"]
|
|
603
|
+
if row_color_groups is None:
|
|
604
|
+
row_color_groups = globals()[f"DEFAULT_ROW_COLOR_GROUPS_{groupby}"]
|
|
605
|
+
if row_dividers is None:
|
|
606
|
+
row_dividers = globals()[f"DEFAULT_ROW_DIVIDERS_{groupby}"]
|
|
607
|
+
|
|
608
|
+
if figsize is None and groupby == "ZMAP_Tissue":
|
|
609
|
+
figsize = (4, 5)
|
|
610
|
+
|
|
574
611
|
# ------------------------ color vector ------------------------
|
|
575
612
|
x, color_source = _extract_color_vector(adata, color, layer, use_raw)
|
|
576
613
|
|
|
@@ -785,9 +822,9 @@ def gene_groups_vs_time(
|
|
|
785
822
|
size_legend_title=size_legend_title,
|
|
786
823
|
size_legend_facecolor=size_legend_facecolor,
|
|
787
824
|
left=1.0 - gutter_pad - 0.18,
|
|
788
|
-
bottom=0.55,
|
|
825
|
+
bottom=0.40 if groupby == "ZMAP_Tissue" else 0.55,
|
|
789
826
|
width=0.22,
|
|
790
|
-
height=0.10,
|
|
827
|
+
height=0.20 if groupby == "ZMAP_Tissue" else 0.10,
|
|
791
828
|
background=background,
|
|
792
829
|
)
|
|
793
830
|
|
|
@@ -878,7 +915,7 @@ def gene_groups_vs_studies(
|
|
|
878
915
|
size_legend_title: str | None = None,
|
|
879
916
|
size_legend_facecolor: str = "black",
|
|
880
917
|
# ===== ordering & filtering =====
|
|
881
|
-
cluster_order: list[str] | None =
|
|
918
|
+
cluster_order: list[str] | None = None,
|
|
882
919
|
study_order: list[str] | None = DEFAULT_STUDY_ORDER,
|
|
883
920
|
omit_groups: list[str] | None = ['nan', 'unknown'], # omits clusters
|
|
884
921
|
# ===== cosmetics =====
|
|
@@ -891,10 +928,10 @@ def gene_groups_vs_studies(
|
|
|
891
928
|
tick_grid_alpha: float = 0.15,
|
|
892
929
|
tick_grid_lw: float = 0.6,
|
|
893
930
|
# ===== Row color group mapping & legend =====
|
|
894
|
-
row_color_groups: dict[str, list[str]] | None =
|
|
931
|
+
row_color_groups: dict[str, list[str]] | None = None,
|
|
895
932
|
show_row_color_legend: bool = False,
|
|
896
933
|
# ===== Horizontal split lines between rows =====
|
|
897
|
-
row_dividers: list[int] | None =
|
|
934
|
+
row_dividers: list[int] | None = None,
|
|
898
935
|
row_divider_color: str = "black",
|
|
899
936
|
row_divider_lw: float = 0.5,
|
|
900
937
|
row_divider_alpha: float = 1,
|
|
@@ -964,6 +1001,20 @@ def gene_groups_vs_studies(
|
|
|
964
1001
|
"""
|
|
965
1002
|
color = str(color)
|
|
966
1003
|
|
|
1004
|
+
# Select defaults based on grouping
|
|
1005
|
+
if groupby not in ("ZMAP_CellType", "ZMAP_Tissue"):
|
|
1006
|
+
raise ValueError("groupby must be 'ZMAP_CellType' or 'ZMAP_Tissue'")
|
|
1007
|
+
|
|
1008
|
+
if cluster_order is None:
|
|
1009
|
+
cluster_order = globals()[f"DEFAULT_CLUSTER_ORDER_{groupby}"]
|
|
1010
|
+
if row_color_groups is None:
|
|
1011
|
+
row_color_groups = globals()[f"DEFAULT_ROW_COLOR_GROUPS_{groupby}"]
|
|
1012
|
+
if row_dividers is None:
|
|
1013
|
+
row_dividers = globals()[f"DEFAULT_ROW_DIVIDERS_{groupby}"]
|
|
1014
|
+
|
|
1015
|
+
if figsize is None and groupby == "ZMAP_Tissue":
|
|
1016
|
+
figsize = (4, 5)
|
|
1017
|
+
|
|
967
1018
|
# ------------------------ color vector ------------------------
|
|
968
1019
|
x, color_source = _extract_color_vector(adata, color, layer, use_raw)
|
|
969
1020
|
|
|
@@ -1179,9 +1230,9 @@ def gene_groups_vs_studies(
|
|
|
1179
1230
|
size_legend_title=size_legend_title,
|
|
1180
1231
|
size_legend_facecolor=size_legend_facecolor,
|
|
1181
1232
|
left=1.0 - gutter_pad - 0.18,
|
|
1182
|
-
bottom=0.55,
|
|
1233
|
+
bottom=0.40 if groupby == "ZMAP_Tissue" else 0.55,
|
|
1183
1234
|
width=0.22,
|
|
1184
|
-
height=0.10,
|
|
1235
|
+
height=0.20 if groupby == "ZMAP_Tissue" else 0.10,
|
|
1185
1236
|
background=background,
|
|
1186
1237
|
)
|
|
1187
1238
|
|
|
@@ -1274,7 +1325,7 @@ def gene_groups_vs_time_and_studies(
|
|
|
1274
1325
|
size_legend_title: str | None = None,
|
|
1275
1326
|
size_legend_facecolor: str = "black",
|
|
1276
1327
|
# ===== ordering & filtering =====
|
|
1277
|
-
cluster_order: list[str] | None =
|
|
1328
|
+
cluster_order: list[str] | None = None,
|
|
1278
1329
|
time_order: list[str] | None = None,
|
|
1279
1330
|
study_order: list[str] | None = DEFAULT_STUDY_ORDER,
|
|
1280
1331
|
omit_groups: list[str] | None = ['nan', 'unknown'],
|
|
@@ -1289,10 +1340,10 @@ def gene_groups_vs_time_and_studies(
|
|
|
1289
1340
|
tick_grid_alpha: float = 0.15,
|
|
1290
1341
|
tick_grid_lw: float = 0.6,
|
|
1291
1342
|
# ===== Row color group mapping & legend =====
|
|
1292
|
-
row_color_groups: dict[str, list[str]] | None =
|
|
1343
|
+
row_color_groups: dict[str, list[str]] | None = None,
|
|
1293
1344
|
show_row_color_legend: bool = False,
|
|
1294
1345
|
# ===== Horizontal split lines between rows =====
|
|
1295
|
-
row_dividers: list[int] | None =
|
|
1346
|
+
row_dividers: list[int] | None = None,
|
|
1296
1347
|
row_divider_color: str = "black",
|
|
1297
1348
|
row_divider_lw: float = 0.5,
|
|
1298
1349
|
row_divider_alpha: float = 1.0,
|
|
@@ -1394,6 +1445,20 @@ def gene_groups_vs_time_and_studies(
|
|
|
1394
1445
|
"""
|
|
1395
1446
|
color = str(color)
|
|
1396
1447
|
|
|
1448
|
+
# Select defaults based on grouping
|
|
1449
|
+
if groupby not in ("ZMAP_CellType", "ZMAP_Tissue"):
|
|
1450
|
+
raise ValueError("groupby must be 'ZMAP_CellType' or 'ZMAP_Tissue'")
|
|
1451
|
+
|
|
1452
|
+
if cluster_order is None:
|
|
1453
|
+
cluster_order = globals()[f"DEFAULT_CLUSTER_ORDER_{groupby}"]
|
|
1454
|
+
if row_color_groups is None:
|
|
1455
|
+
row_color_groups = globals()[f"DEFAULT_ROW_COLOR_GROUPS_{groupby}"]
|
|
1456
|
+
if row_dividers is None:
|
|
1457
|
+
row_dividers = globals()[f"DEFAULT_ROW_DIVIDERS_{groupby}"]
|
|
1458
|
+
|
|
1459
|
+
if figsize is None and groupby == "ZMAP_Tissue":
|
|
1460
|
+
figsize = (4, 5)
|
|
1461
|
+
|
|
1397
1462
|
# ------------------------ color vector ------------------------
|
|
1398
1463
|
x_full, color_source = _extract_color_vector(adata, color, layer, use_raw)
|
|
1399
1464
|
|
|
@@ -1664,7 +1729,7 @@ def gene_groups_vs_time_and_studies(
|
|
|
1664
1729
|
|
|
1665
1730
|
# ------------------------ SHARED colorbar in gutter + rotated label -----
|
|
1666
1731
|
if add_colorbar:
|
|
1667
|
-
left_cb = 1.0 - gutter_pad - 0.
|
|
1732
|
+
left_cb = 1.0 - gutter_pad - 0.06
|
|
1668
1733
|
bottom_cb = 0.70
|
|
1669
1734
|
width_cb = 0.02
|
|
1670
1735
|
height_cb = 0.15
|
|
@@ -1702,9 +1767,9 @@ def gene_groups_vs_time_and_studies(
|
|
|
1702
1767
|
size_legend_title=size_legend_title,
|
|
1703
1768
|
size_legend_facecolor=size_legend_facecolor,
|
|
1704
1769
|
left=1.0 - gutter_pad - 0.14,
|
|
1705
|
-
bottom=0.55,
|
|
1706
|
-
width=0.
|
|
1707
|
-
height=0.10,
|
|
1770
|
+
bottom=0.40 if groupby == "ZMAP_Tissue" else 0.55,
|
|
1771
|
+
width=0.22,
|
|
1772
|
+
height=0.20 if groupby == "ZMAP_Tissue" else 0.10,
|
|
1708
1773
|
background=background,
|
|
1709
1774
|
)
|
|
1710
1775
|
|
|
@@ -33,6 +33,31 @@ from .predict import (
|
|
|
33
33
|
validate_markers,
|
|
34
34
|
plot_marker_comparison,
|
|
35
35
|
)
|
|
36
|
+
from .encoder_pipeline import (
|
|
37
|
+
apply_encoder,
|
|
38
|
+
zmap_projection,
|
|
39
|
+
predict_pseudo_tissue,
|
|
40
|
+
knn_config,
|
|
41
|
+
build_module_faiss,
|
|
42
|
+
build_module_concat_reference,
|
|
43
|
+
apply_module_concat_query,
|
|
44
|
+
time_prediction_KNN,
|
|
45
|
+
plot_conf_entropy_margin,
|
|
46
|
+
plot_pseudo_tissue_conf_entropy_margin,
|
|
47
|
+
plot_confusion_matrix,
|
|
48
|
+
report_leiden_celltype_topk,
|
|
49
|
+
plot_leiden_celltype,
|
|
50
|
+
plot_projection_celltype_overlay,
|
|
51
|
+
)
|
|
52
|
+
from .baseline2 import (
|
|
53
|
+
predict_labels_MLP,
|
|
54
|
+
predict_labels_mlp,
|
|
55
|
+
predict_labels_baseline2,
|
|
56
|
+
predict_labels_baseline_tissue,
|
|
57
|
+
time_prediction_MLP,
|
|
58
|
+
baseline2,
|
|
59
|
+
baseline_tissue,
|
|
60
|
+
)
|
|
36
61
|
|
|
37
62
|
__all__ = [
|
|
38
63
|
"preprocess_adata_query",
|
|
@@ -55,3 +80,27 @@ __all__ = [
|
|
|
55
80
|
"validate_markers",
|
|
56
81
|
"plot_marker_comparison",
|
|
57
82
|
]
|
|
83
|
+
|
|
84
|
+
__all__ += [
|
|
85
|
+
"apply_encoder",
|
|
86
|
+
"zmap_projection",
|
|
87
|
+
"predict_pseudo_tissue",
|
|
88
|
+
"knn_config",
|
|
89
|
+
"build_module_faiss",
|
|
90
|
+
"build_module_concat_reference",
|
|
91
|
+
"apply_module_concat_query",
|
|
92
|
+
"time_prediction_KNN",
|
|
93
|
+
"plot_conf_entropy_margin",
|
|
94
|
+
"plot_pseudo_tissue_conf_entropy_margin",
|
|
95
|
+
"plot_confusion_matrix",
|
|
96
|
+
"report_leiden_celltype_topk",
|
|
97
|
+
"plot_leiden_celltype",
|
|
98
|
+
"plot_projection_celltype_overlay",
|
|
99
|
+
"predict_labels_MLP",
|
|
100
|
+
"predict_labels_mlp",
|
|
101
|
+
"predict_labels_baseline2",
|
|
102
|
+
"predict_labels_baseline_tissue",
|
|
103
|
+
"time_prediction_MLP",
|
|
104
|
+
"baseline2",
|
|
105
|
+
"baseline_tissue",
|
|
106
|
+
]
|