mcDETECT 2.0.1__py3-none-any.whl → 2.0.3__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.

Potentially problematic release.


This version of mcDETECT might be problematic. Click here for more details.

mcDETECT/__init__.py CHANGED
@@ -1,3 +1,6 @@
1
- __version__ = "2.0.1"
2
- from .utils import *
3
- from .model import mcDETECT, spot_neuron, spot_granule, neighbor_granule, neuron_embedding_one_hot, neuron_embedding_spatial_weight
1
+ __version__ = "2.0.3"
2
+
3
+ from . import model
4
+ from . import utils
5
+
6
+ __all__ = ["model", "utils"]
mcDETECT/model.py CHANGED
@@ -11,6 +11,7 @@ from shapely.geometry import Point
11
11
  from sklearn.cluster import DBSCAN
12
12
  from sklearn.preprocessing import OneHotEncoder
13
13
 
14
+
14
15
  from .utils import *
15
16
 
16
17
 
mcDETECT/utils.py CHANGED
@@ -100,26 +100,26 @@ def weighted_spearmanr(A, B, weights):
100
100
  return weighted_spearman_corr
101
101
 
102
102
 
103
- def assign_palette_to_adata(adata, obs_key = "granule_expr_cluster_hierarchical", cmap_name = "tab10"):
103
+ def assign_palette_to_adata(adata, obs_key = "granule_expr_cluster_hierarchical", self_defined = False, cmap_name = "tab10"):
104
104
 
105
105
  adata = adata.copy()
106
106
 
107
- # ensure the column is categorical
108
107
  if not pd.api.types.is_categorical_dtype(adata.obs[obs_key]):
109
108
  adata.obs[obs_key] = adata.obs[obs_key].astype("category")
110
-
111
- # extract categories and number of levels
109
+
112
110
  categories = adata.obs[obs_key].cat.categories
113
111
  n_categories = len(categories)
114
-
115
- # choose or extend the colormap
116
- base_colors = plt.get_cmap(cmap_name).colors
117
- if n_categories > len(base_colors):
118
- color_palette = sns.color_palette(cmap_name, n_categories)
112
+
113
+ if self_defined:
114
+ cmap = plt.colormaps[cmap_name]
115
+ color_palette = [cmap(i) for i in range(n_categories)]
119
116
  else:
120
- color_palette = base_colors[:n_categories]
121
-
122
- # convert to hex and assign
117
+ base_colors = plt.get_cmap(cmap_name).colors
118
+ if n_categories > len(base_colors):
119
+ color_palette = sns.color_palette(cmap_name, n_categories)
120
+ else:
121
+ color_palette = base_colors[:n_categories]
122
+
123
123
  adata.uns[f"{obs_key}_colors"] = [mcolors.to_hex(c) for c in color_palette]
124
124
 
125
125
  return adata
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcDETECT
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Uncovering the dark transcriptome in polarized neuronal compartments with mcDETECT
5
5
  Home-page: https://github.com/chen-yang-yuan/mcDETECT
6
6
  Author: Chenyang Yuan
@@ -0,0 +1,8 @@
1
+ mcDETECT/__init__.py,sha256=SPCzZZOrSFKUNUYRrFbrBWF0FPN6OUzUpRP4zjlfQr0,92
2
+ mcDETECT/model.py,sha256=zEdHqgwTjDi7HxdLW0aPG2j8uLMPiobNu-BcJraAG8g,28047
3
+ mcDETECT/utils.py,sha256=0gvqZV7sGi8qvvdC5x9XScyiTXlSfqbUt1zks4t7Xd4,4545
4
+ mcdetect-2.0.3.dist-info/licenses/LICENSE,sha256=uxq-shEWOGTIGVnQLmpElILmfCkuUhFZRAMnZUiKvtg,1070
5
+ mcdetect-2.0.3.dist-info/METADATA,sha256=1ny7qrjmE9p1Ybgmw3k4QnVJSKlXVJR4nlBNPxj3RCU,3016
6
+ mcdetect-2.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ mcdetect-2.0.3.dist-info/top_level.txt,sha256=WwzBojt5U-T2hZ8llO6XgpM9OFIBkWQQldQKu19O8EY,9
8
+ mcdetect-2.0.3.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- mcDETECT/__init__.py,sha256=o9fQTRgcHPisSCcv0Cy-AtdiTSWrj-ITBK_FQxfnmKE,174
2
- mcDETECT/model.py,sha256=-r2_Ve0wxOALxiFk0REa58WjMea495yLZ6oXT-WWekw,28046
3
- mcDETECT/utils.py,sha256=kKw7KnrS-0llqtT32S_PDkag1jk4CWYkSm-FZeIJFAw,4510
4
- mcdetect-2.0.1.dist-info/licenses/LICENSE,sha256=uxq-shEWOGTIGVnQLmpElILmfCkuUhFZRAMnZUiKvtg,1070
5
- mcdetect-2.0.1.dist-info/METADATA,sha256=qMO7hrWgabHHp1_UxlDvsLmQYaBC7Nf85RPNxyBvA8o,3016
6
- mcdetect-2.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- mcdetect-2.0.1.dist-info/top_level.txt,sha256=WwzBojt5U-T2hZ8llO6XgpM9OFIBkWQQldQKu19O8EY,9
8
- mcdetect-2.0.1.dist-info/RECORD,,