sphere-pca 0.3.0__py3-none-any.whl
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.
- pca_sphere_projection/__init__.py +215 -0
- pca_sphere_projection/app.py +522 -0
- pca_sphere_projection/app_plots.py +231 -0
- pca_sphere_projection/app_processing.py +257 -0
- pca_sphere_projection/app_report.py +91 -0
- pca_sphere_projection/comparison.py +185 -0
- pca_sphere_projection/core.py +589 -0
- pca_sphere_projection/data/example_configs.yaml +8 -0
- pca_sphere_projection/data/synthetic_pc_coordinates.csv +13 -0
- pca_sphere_projection/entropy.py +197 -0
- pca_sphere_projection/figures/__init__.py +32 -0
- pca_sphere_projection/figures/common.py +571 -0
- pca_sphere_projection/figures/fig1.py +628 -0
- pca_sphere_projection/figures/fig2.py +872 -0
- pca_sphere_projection/figures/fig3.py +1470 -0
- pca_sphere_projection/figures/fig4.py +1390 -0
- pca_sphere_projection/figures/supplements/__init__.py +15 -0
- pca_sphere_projection/figures/supplements/benchmark.py +430 -0
- pca_sphere_projection/figures/supplements/common.py +156 -0
- pca_sphere_projection/figures/supplements/planaria.py +713 -0
- pca_sphere_projection/figures/supplements/xenium.py +546 -0
- pca_sphere_projection/gene_geometry.py +370 -0
- pca_sphere_projection/io.py +564 -0
- pca_sphere_projection/known_regulators.py +116 -0
- pca_sphere_projection/pc_robustness.py +115 -0
- pca_sphere_projection/perturbation.py +458 -0
- pca_sphere_projection/preprocessing.py +252 -0
- pca_sphere_projection/robustness.py +260 -0
- pca_sphere_projection/sphere_stats.py +312 -0
- pca_sphere_projection/stripe.py +144 -0
- pca_sphere_projection/topology.py +223 -0
- sphere_pca/__init__.py +14 -0
- sphere_pca/cli.py +51 -0
- sphere_pca/core.py +326 -0
- sphere_pca/plotting.py +95 -0
- sphere_pca/result.py +89 -0
- sphere_pca-0.3.0.dist-info/METADATA +216 -0
- sphere_pca-0.3.0.dist-info/RECORD +42 -0
- sphere_pca-0.3.0.dist-info/WHEEL +5 -0
- sphere_pca-0.3.0.dist-info/entry_points.txt +2 -0
- sphere_pca-0.3.0.dist-info/licenses/LICENSE +21 -0
- sphere_pca-0.3.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"""Preserved manuscript-analysis namespace.
|
|
2
|
+
|
|
3
|
+
The lightweight public API is :mod:`sphere_pca`. This historical namespace
|
|
4
|
+
retains its original numerical implementation and requires the ``legacy``
|
|
5
|
+
optional dependency set.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from importlib import import_module
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
_LEGACY_IMPORTS = {
|
|
12
|
+
"matplotlib.pyplot": "matplotlib",
|
|
13
|
+
"pandas": "pandas",
|
|
14
|
+
"plotly.graph_objects": "plotly",
|
|
15
|
+
"scipy.stats": "scipy",
|
|
16
|
+
"seaborn": "seaborn",
|
|
17
|
+
"statsmodels.stats.multitest": "statsmodels",
|
|
18
|
+
}
|
|
19
|
+
_missing_legacy_dependencies = []
|
|
20
|
+
for _module, _distribution in _LEGACY_IMPORTS.items():
|
|
21
|
+
try:
|
|
22
|
+
import_module(_module)
|
|
23
|
+
except ModuleNotFoundError:
|
|
24
|
+
if _distribution not in _missing_legacy_dependencies:
|
|
25
|
+
_missing_legacy_dependencies.append(_distribution)
|
|
26
|
+
|
|
27
|
+
if _missing_legacy_dependencies:
|
|
28
|
+
_missing = ", ".join(sorted(_missing_legacy_dependencies))
|
|
29
|
+
raise ImportError(
|
|
30
|
+
"The preserved pca_sphere_projection namespace requires optional "
|
|
31
|
+
f"legacy dependencies (missing: {_missing}). Install them with "
|
|
32
|
+
"`python -m pip install 'sphere-pca[legacy]'`. The lightweight "
|
|
33
|
+
"public API remains available as `import sphere_pca`."
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
del _LEGACY_IMPORTS, _missing_legacy_dependencies, _module, _distribution
|
|
37
|
+
|
|
38
|
+
from .comparison import (
|
|
39
|
+
conserved_stripe_test,
|
|
40
|
+
procrustes_align_spheres,
|
|
41
|
+
spherical_replicate_residual,
|
|
42
|
+
)
|
|
43
|
+
from .core import (
|
|
44
|
+
align_to_north_pole,
|
|
45
|
+
apply_euler_rotation,
|
|
46
|
+
equirectangular_projection,
|
|
47
|
+
find_and_visualize_correlated_genes,
|
|
48
|
+
statistical_test_on_lineages,
|
|
49
|
+
visualize_globe,
|
|
50
|
+
visualize_lineage_correlation,
|
|
51
|
+
)
|
|
52
|
+
from .perturbation import (
|
|
53
|
+
cluster_genes_by_perturbation_signature,
|
|
54
|
+
compute_gene_perturbation_vectors,
|
|
55
|
+
decompose_perturbation_vectors,
|
|
56
|
+
identify_sensitive_cells,
|
|
57
|
+
perturb_gene_expression,
|
|
58
|
+
plot_perturbation_vector_field,
|
|
59
|
+
project_expression_to_pca,
|
|
60
|
+
rank_genes_by_perturbation_magnitude,
|
|
61
|
+
)
|
|
62
|
+
from .robustness import (
|
|
63
|
+
compare_manual_vs_great_circle,
|
|
64
|
+
pc_coordinate_quality_summary,
|
|
65
|
+
root_sensitivity_analysis,
|
|
66
|
+
rotation_robustness_analysis,
|
|
67
|
+
)
|
|
68
|
+
from .sphere_stats import (
|
|
69
|
+
fit_great_circle,
|
|
70
|
+
geodesic_gradient,
|
|
71
|
+
horseshoe_null_test,
|
|
72
|
+
spherical_anisotropy,
|
|
73
|
+
spherical_kde,
|
|
74
|
+
stripe_strength_score,
|
|
75
|
+
)
|
|
76
|
+
from .stripe import (
|
|
77
|
+
detect_spherical_stripes,
|
|
78
|
+
multi_stripe_strength_score,
|
|
79
|
+
local_stripe_strength,
|
|
80
|
+
plot_detected_stripes,
|
|
81
|
+
)
|
|
82
|
+
from .pc_robustness import (
|
|
83
|
+
compute_scree_summary,
|
|
84
|
+
estimate_intrinsic_dimension,
|
|
85
|
+
compare_pc_count_spherical_geometry,
|
|
86
|
+
compare_top3_vs_random3_pcs,
|
|
87
|
+
compare_hvg_vs_all_gene_pc_geometry,
|
|
88
|
+
)
|
|
89
|
+
from .topology import (
|
|
90
|
+
build_spherical_knn_graph,
|
|
91
|
+
detect_branchpoints,
|
|
92
|
+
linear_vs_branching_score,
|
|
93
|
+
)
|
|
94
|
+
from .io import (
|
|
95
|
+
ExpressionData,
|
|
96
|
+
load_expression_matrix,
|
|
97
|
+
load_rds_expression,
|
|
98
|
+
load_bz2_klein_dataset,
|
|
99
|
+
load_celegan,
|
|
100
|
+
load_uc_epi,
|
|
101
|
+
load_hesc,
|
|
102
|
+
load_brca_atlas,
|
|
103
|
+
match_expression_to_pc_csv,
|
|
104
|
+
)
|
|
105
|
+
from .preprocessing import (
|
|
106
|
+
PCAResult,
|
|
107
|
+
normalize_log1p,
|
|
108
|
+
select_hvgs,
|
|
109
|
+
filter_genes,
|
|
110
|
+
fit_pca_embedding,
|
|
111
|
+
compare_hvg_vs_all_gene_pca,
|
|
112
|
+
)
|
|
113
|
+
from .entropy import (
|
|
114
|
+
compute_transcriptional_entropy,
|
|
115
|
+
compute_cytotrace_proxy,
|
|
116
|
+
compute_scent_proxy,
|
|
117
|
+
test_entropy_geodesic_gradient,
|
|
118
|
+
)
|
|
119
|
+
from .gene_geometry import (
|
|
120
|
+
compute_gene_geodesic_gradients,
|
|
121
|
+
compute_per_cell_gene_geodesic_gradient,
|
|
122
|
+
decompose_gene_gradient_theta_phi,
|
|
123
|
+
decompose_gene_gradient_relative_to_stripes,
|
|
124
|
+
rank_stripe_boundary_genes,
|
|
125
|
+
rank_stripe_boundary_genes_per_cell,
|
|
126
|
+
rank_along_trajectory_genes,
|
|
127
|
+
rank_along_trajectory_genes_per_cell,
|
|
128
|
+
filter_housekeeping_and_low_specificity_genes,
|
|
129
|
+
plot_gene_gradient_field,
|
|
130
|
+
plot_gene_gradient_on_sphere,
|
|
131
|
+
plot_gene_gradient_equirectangular,
|
|
132
|
+
)
|
|
133
|
+
from .known_regulators import (
|
|
134
|
+
REGULATOR_SETS,
|
|
135
|
+
get_regulator_set,
|
|
136
|
+
annotate_overlap,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
__all__ = [
|
|
140
|
+
"align_to_north_pole",
|
|
141
|
+
"apply_euler_rotation",
|
|
142
|
+
"equirectangular_projection",
|
|
143
|
+
"visualize_globe",
|
|
144
|
+
"visualize_lineage_correlation",
|
|
145
|
+
"statistical_test_on_lineages",
|
|
146
|
+
"find_and_visualize_correlated_genes",
|
|
147
|
+
"stripe_strength_score",
|
|
148
|
+
"spherical_kde",
|
|
149
|
+
"geodesic_gradient",
|
|
150
|
+
"fit_great_circle",
|
|
151
|
+
"spherical_anisotropy",
|
|
152
|
+
"horseshoe_null_test",
|
|
153
|
+
"detect_spherical_stripes",
|
|
154
|
+
"multi_stripe_strength_score",
|
|
155
|
+
"local_stripe_strength",
|
|
156
|
+
"plot_detected_stripes",
|
|
157
|
+
"compute_scree_summary",
|
|
158
|
+
"estimate_intrinsic_dimension",
|
|
159
|
+
"compare_pc_count_spherical_geometry",
|
|
160
|
+
"compare_top3_vs_random3_pcs",
|
|
161
|
+
"compare_hvg_vs_all_gene_pc_geometry",
|
|
162
|
+
"build_spherical_knn_graph",
|
|
163
|
+
"detect_branchpoints",
|
|
164
|
+
"linear_vs_branching_score",
|
|
165
|
+
"procrustes_align_spheres",
|
|
166
|
+
"conserved_stripe_test",
|
|
167
|
+
"spherical_replicate_residual",
|
|
168
|
+
"project_expression_to_pca",
|
|
169
|
+
"perturb_gene_expression",
|
|
170
|
+
"compute_gene_perturbation_vectors",
|
|
171
|
+
"rank_genes_by_perturbation_magnitude",
|
|
172
|
+
"decompose_perturbation_vectors",
|
|
173
|
+
"identify_sensitive_cells",
|
|
174
|
+
"plot_perturbation_vector_field",
|
|
175
|
+
"cluster_genes_by_perturbation_signature",
|
|
176
|
+
"root_sensitivity_analysis",
|
|
177
|
+
"rotation_robustness_analysis",
|
|
178
|
+
"pc_coordinate_quality_summary",
|
|
179
|
+
"compare_manual_vs_great_circle",
|
|
180
|
+
# raw-expression validation
|
|
181
|
+
"ExpressionData",
|
|
182
|
+
"load_expression_matrix",
|
|
183
|
+
"load_rds_expression",
|
|
184
|
+
"load_bz2_klein_dataset",
|
|
185
|
+
"load_celegan",
|
|
186
|
+
"load_uc_epi",
|
|
187
|
+
"load_hesc",
|
|
188
|
+
"load_brca_atlas",
|
|
189
|
+
"match_expression_to_pc_csv",
|
|
190
|
+
"PCAResult",
|
|
191
|
+
"normalize_log1p",
|
|
192
|
+
"select_hvgs",
|
|
193
|
+
"filter_genes",
|
|
194
|
+
"fit_pca_embedding",
|
|
195
|
+
"compare_hvg_vs_all_gene_pca",
|
|
196
|
+
"compute_transcriptional_entropy",
|
|
197
|
+
"compute_cytotrace_proxy",
|
|
198
|
+
"compute_scent_proxy",
|
|
199
|
+
"test_entropy_geodesic_gradient",
|
|
200
|
+
"compute_gene_geodesic_gradients",
|
|
201
|
+
"compute_per_cell_gene_geodesic_gradient",
|
|
202
|
+
"decompose_gene_gradient_theta_phi",
|
|
203
|
+
"decompose_gene_gradient_relative_to_stripes",
|
|
204
|
+
"rank_stripe_boundary_genes",
|
|
205
|
+
"rank_stripe_boundary_genes_per_cell",
|
|
206
|
+
"rank_along_trajectory_genes",
|
|
207
|
+
"rank_along_trajectory_genes_per_cell",
|
|
208
|
+
"filter_housekeeping_and_low_specificity_genes",
|
|
209
|
+
"plot_gene_gradient_field",
|
|
210
|
+
"plot_gene_gradient_on_sphere",
|
|
211
|
+
"plot_gene_gradient_equirectangular",
|
|
212
|
+
"REGULATOR_SETS",
|
|
213
|
+
"get_regulator_set",
|
|
214
|
+
"annotate_overlap",
|
|
215
|
+
]
|