cytocommunity2 1.0.6__tar.gz → 1.0.7__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 (47) hide show
  1. {cytocommunity2-1.0.6/src/cytocommunity2.egg-info → cytocommunity2-1.0.7}/PKG-INFO +1 -1
  2. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/pyproject.toml +1 -1
  3. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/__init__.py +1 -1
  4. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/dotplots.py +13 -22
  5. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7/src/cytocommunity2.egg-info}/PKG-INFO +1 -1
  6. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/LICENSE +0 -0
  7. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/README.md +0 -0
  8. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/setup.cfg +0 -0
  9. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/_io.py +0 -0
  10. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/colors.py +0 -0
  11. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/config.py +0 -0
  12. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/__init__.py +0 -0
  13. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/coherence.py +0 -0
  14. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/communication/__init__.py +0 -0
  15. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/communication/between.py +0 -0
  16. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/communication/cca.py +0 -0
  17. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/communication/utils.py +0 -0
  18. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/communication/within.py +0 -0
  19. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/differential_composition.py +0 -0
  20. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/dominant_celltype.py +0 -0
  21. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/enrichment.py +0 -0
  22. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/moran.py +0 -0
  23. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/__init__.py +0 -0
  24. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/cn_selection.py +0 -0
  25. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/coherence.py +0 -0
  26. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/common.py +0 -0
  27. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/communication.py +0 -0
  28. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/communication_cca.py +0 -0
  29. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/communication_stack.py +0 -0
  30. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/dominant.py +0 -0
  31. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/plotting/recurrence.py +0 -0
  32. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/recurrence.py +0 -0
  33. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/downstream/wilcoxon.py +0 -0
  34. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/ensemble.py +0 -0
  35. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/learning/__init__.py +0 -0
  36. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/learning/api.py +0 -0
  37. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/learning/dataset.py +0 -0
  38. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/learning/model.py +0 -0
  39. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/learning/selection.py +0 -0
  40. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/learning/training.py +0 -0
  41. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/paths.py +0 -0
  42. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/visualization/__init__.py +0 -0
  43. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2/visualization/spatial.py +0 -0
  44. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2.egg-info/SOURCES.txt +0 -0
  45. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2.egg-info/dependency_links.txt +0 -0
  46. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2.egg-info/requires.txt +0 -0
  47. {cytocommunity2-1.0.6 → cytocommunity2-1.0.7}/src/cytocommunity2.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cytocommunity2
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: Weakly supervised cellular-neighborhood learning for spatial omics
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cytocommunity2"
7
- version = "1.0.6"
7
+ version = "1.0.7"
8
8
  description = "Weakly supervised cellular-neighborhood learning for spatial omics"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -10,7 +10,7 @@ from .learning import (
10
10
  )
11
11
  from .visualization import visualize_results
12
12
 
13
- __version__ = "1.0.6"
13
+ __version__ = "1.0.7"
14
14
 
15
15
  __all__ = [
16
16
  "CytoCommunityConfig",
@@ -10,6 +10,7 @@ from .common import add_colorbar, plotting_style, dot_size, save_figure
10
10
 
11
11
 
12
12
  DOTPLOT_CMAP = "coolwarm"
13
+ DOTPLOT_STRENGTH_VALUES = (0.5, 1.3, 2.0)
13
14
 
14
15
 
15
16
  def _tested_mask(record):
@@ -18,18 +19,8 @@ def _tested_mask(record):
18
19
 
19
20
  def _panel_size(record):
20
21
  tested = _tested_mask(record)
21
- return (max(6.0, 0.60 * tested.any(axis=1).sum() + 1.8),
22
- max(3.0, 0.60 * tested.any(axis=0).sum() + 1.8))
23
-
24
-
25
- def _legend_strength_values(records):
26
- """Choose up to three size examples from the dots actually being drawn."""
27
- pvalues = np.concatenate([record["pvalues"][_tested_mask(record)] for record in records])
28
- values = np.unique(np.minimum(-np.log10(np.clip(pvalues, 1e-300, 1.0)), 5.0))
29
- values[values == 0] = 0.0
30
- if len(values) <= 3:
31
- return values
32
- return values[np.rint(np.linspace(0, len(values) - 1, 3)).astype(int)]
22
+ return (max(5.4, 0.46 * tested.any(axis=1).sum() + 1.6),
23
+ max(3.0, 0.46 * tested.any(axis=0).sum() + 1.8))
33
24
 
34
25
 
35
26
  def _draw_panel(
@@ -64,11 +55,11 @@ def _draw_panel(
64
55
  x_grid[significant], y_grid[significant], s=60.0, marker="*",
65
56
  c="#1d2630", edgecolors="none", zorder=4,
66
57
  )
67
- axis.set_title(title, fontsize=15, fontweight="bold", pad=10)
58
+ axis.set_title(title, fontsize=17, fontweight="bold", pad=10)
68
59
  axis.set_xticks(np.arange(len(celltypes)))
69
- axis.set_xticklabels(celltypes, rotation=rotation, ha="right" if rotation != 90 else "center", fontsize=12)
60
+ axis.set_xticklabels(celltypes, rotation=rotation, ha="right" if rotation != 90 else "center", fontsize=14)
70
61
  axis.set_yticks(np.arange(len(cn_order)))
71
- axis.set_yticklabels([f"CN{cn}" for cn in cn_order], fontsize=12)
62
+ axis.set_yticklabels([f"CN{cn}" for cn in cn_order], fontsize=14)
72
63
  axis.set_xlim(-0.6, len(celltypes) - 0.4)
73
64
  axis.set_ylim(-0.55, len(cn_order) - 0.45)
74
65
  axis.set_aspect("equal", adjustable="box")
@@ -91,20 +82,20 @@ def _draw_dotplot_legend(figure, norm, threshold, colorbar_title,
91
82
 
92
83
  axis = add_axis([0.04, 0.34, 0.92, 0.64] if compact else [0.04, 0.30, 0.92, 0.65])
93
84
  axis.axis("off")
94
- values = (1.3, 2.0, 3.0) if strength_values is None else strength_values
85
+ values = DOTPLOT_STRENGTH_VALUES if strength_values is None else strength_values
95
86
  handles = [axis.scatter([], [], s=dot_size(10.0 ** -value), color="#b9414b") for value in values]
96
87
  handles.append(axis.scatter([], [], s=60.0, marker="*", color="#1d2630"))
97
88
  axis.legend(
98
89
  handles, [f"{value:.3g}" for value in values] + [f"p-value < {threshold:g}"],
99
90
  title=significance_title, frameon=False, loc="upper left",
100
91
  bbox_to_anchor=(0.02, 1.0), labelspacing=0.8 if compact else 1.9, handletextpad=0.75,
101
- fontsize=14, title_fontsize=14, markerscale=1.0,
92
+ fontsize=16, title_fontsize=16, markerscale=1.0,
102
93
  )
103
94
  colorbar = add_colorbar(figure, add_axis([0.04, 0.06, 0.92, 0.08]), norm,
104
95
  colorbar_title, cmap=DOTPLOT_CMAP, orientation="horizontal")
105
- colorbar.ax.tick_params(labelsize=12, pad=3)
96
+ colorbar.ax.tick_params(labelsize=14, pad=3)
106
97
  colorbar.ax.xaxis.set_label_position("top")
107
- colorbar.set_label(colorbar_title, fontsize=14, labelpad=6)
98
+ colorbar.set_label(colorbar_title, fontsize=16, labelpad=6)
108
99
 
109
100
 
110
101
  @plotting_style()
@@ -114,7 +105,7 @@ def save_dotplot_legend(norm, output_dir, threshold=0.05, colorbar_title="log2FC
114
105
  """Save a standalone legend for callers that explicitly request one."""
115
106
  import matplotlib.pyplot as plt
116
107
 
117
- figure = plt.figure(figsize=(3.6, 2.55 if compact else 4.15))
108
+ figure = plt.figure(figsize=(3.6, 3.1 if compact else 4.15))
118
109
  _draw_dotplot_legend(figure, norm, threshold, colorbar_title,
119
110
  significance_title, compact=compact, strength_values=strength_values)
120
111
  output = save_figure(figure, Path(output_dir) / "LEGEND.pdf", png=png)
@@ -164,7 +155,7 @@ def _save_dotplots(
164
155
 
165
156
  import matplotlib.pyplot as plt
166
157
 
167
- strength_values = _legend_strength_values(records)
158
+ strength_values = DOTPLOT_STRENGTH_VALUES
168
159
  outputs = []
169
160
  for index, record in enumerate(records):
170
161
  figure, axis = plt.subplots(figsize=_panel_size(record))
@@ -199,7 +190,7 @@ def _save_dotplots(
199
190
  figure.subplots_adjust(left=0.07 * plot_width / figure_width,
200
191
  right=0.98 * plot_width / figure_width,
201
192
  bottom=0.10, top=0.96, hspace=0.60, wspace=0.25)
202
- legend_height = 2.55 if compact_legend else 4.15
193
+ legend_height = 3.1 if compact_legend else 4.15
203
194
  legend_center = 0.96 - 0.86 / rows / 2
204
195
  _draw_dotplot_legend(
205
196
  figure, norm, threshold, colorbar_title, significance_title,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cytocommunity2
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: Weakly supervised cellular-neighborhood learning for spatial omics
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
File without changes
File without changes
File without changes