SURE-tools 2.1.45__py3-none-any.whl → 2.1.47__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 SURE-tools might be problematic. Click here for more details.

SURE/flow/flow_stats.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import numpy as np
2
+ from scipy.interpolate import griddata
2
3
  from scipy.spatial.distance import pdist, squareform
3
4
  from sklearn.decomposition import PCA
4
5
  from scipy.stats import pearsonr
@@ -16,6 +17,30 @@ class VectorFieldEval:
16
17
 
17
18
  def momentum_flow_metric(self, vectors, masses=None):
18
19
  return momentum_flow_metric(vectors=vectors, masses=masses)
20
+
21
+ def divergence(self, points, vectors, grid_resolution=30):
22
+ # 提取坐标和向量分量
23
+ x_coords = points[:, 0]
24
+ y_coords = points[:, 1]
25
+ u_components = vectors[:, 0] # x方向分量
26
+ v_components = vectors[:, 1] # y方向分量
27
+
28
+ # 创建规则网格
29
+ x_grid = np.linspace(x_coords.min(), x_coords.max(), grid_resolution)
30
+ y_grid = np.linspace(y_coords.min(), y_coords.max(), grid_resolution)
31
+ X, Y = np.meshgrid(x_grid, y_grid)
32
+
33
+ # 插值到网格
34
+ U_grid = griddata((x_coords, y_coords), u_components, (X, Y), method='linear')
35
+ V_grid = griddata((x_coords, y_coords), v_components, (X, Y), method='linear')
36
+
37
+ # 计算散度
38
+ dU_dx = np.gradient(U_grid, x_grid, axis=1)
39
+ dV_dy = np.gradient(V_grid, y_grid, axis=0)
40
+ divergence = dU_dx + dV_dy
41
+ divergence[np.isnan(divergence)] = 0
42
+
43
+ return divergence
19
44
 
20
45
 
21
46
  def calculate_movement_stats(vectors):
SURE/perturb/perturb.py CHANGED
@@ -9,7 +9,7 @@ class LabelMatrix:
9
9
  def __init__(self):
10
10
  self.labels_ = None
11
11
 
12
- def fit_transform(self, labels, control_label=None, sep_pattern=r'[;_\-\s]', speedup: Literal['none','vectorize','parallel']='none'):
12
+ def fit_transform(self, labels, control_label=None, sep_pattern=r'[,;_\s]', speedup: Literal['none','vectorize','parallel']='none'):
13
13
  if speedup=='none':
14
14
  mat, self.labels_ = label_to_matrix(labels=labels, sep_pattern=sep_pattern)
15
15
  elif speedup=='vectorize':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.1.45
3
+ Version: 2.1.47
4
4
  Summary: Succinct Representation of Single Cells
5
5
  Home-page: https://github.com/ZengFLab/SURE
6
6
  Author: Feng Zeng
@@ -9,17 +9,17 @@ SURE/atac/utils.py,sha256=m4NYwpy9O5T1pXTzgCOCcmlwrC6GTi-cQ5sm2wZu2O8,4354
9
9
  SURE/codebook/__init__.py,sha256=2T5gjp8JIaBayrXAnOJYSebQHsWprOs87difpR1OPNw,243
10
10
  SURE/codebook/codebook.py,sha256=ZlN6gRX9Gj2D2u3P5KeOsbZri0MoMAiJo9lNeL-MK-I,17117
11
11
  SURE/flow/__init__.py,sha256=rsAjYsh1xVIrxBCuwOE0Q_6N5th1wBgjJceV0ABPG3c,183
12
- SURE/flow/flow_stats.py,sha256=cBBsPEDpWNMpbzlyQ3f0385RSrX6_5RCH2caOyi4ihM,9908
12
+ SURE/flow/flow_stats.py,sha256=_pF7m4-87SKlCHVtVmx3LG2bAGVXOnAfEgMzLhLx4Io,10910
13
13
  SURE/flow/plot_quiver.py,sha256=UbmuScUcgbQHeMmjKmgqxjrIjHhiHx0VWct16UMMwuE,8110
14
14
  SURE/perturb/__init__.py,sha256=8TP1dSUhXiZzKpFebHZmm8XMMGbUz_OfQ10xu-6uPPY,43
15
- SURE/perturb/perturb.py,sha256=ICs-yMIuT0tZtyx9R7tkzzhAcurs_eActv2v3uyjreE,5038
15
+ SURE/perturb/perturb.py,sha256=1iSsCePcwkA2CyM1nCdq_G8gogUNjhMH0BfhhvhpJQk,5037
16
16
  SURE/utils/__init__.py,sha256=QJUOfrXzdWSmoM0P3LH8oKEHttzCWqpDy2UF0F0dtN4,673
17
17
  SURE/utils/custom_mlp.py,sha256=rHnx9jEef02zfCUdbYVCmbuHcDdIBmRgt__wpdpZvYg,8104
18
18
  SURE/utils/queue.py,sha256=E_5PA5EWcBoGAZj8BkKQnkCK0p4C-4-xcTPqdIXaPXU,1892
19
19
  SURE/utils/utils.py,sha256=IUHjDDtYaAYllCWsZyIzqQwaLul6fJRvHRH4vIYcR-c,8462
20
- sure_tools-2.1.45.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
21
- sure_tools-2.1.45.dist-info/METADATA,sha256=y0VumQ_zuHF_45Mo2MKKap2J_l4rGEzHiYLSxuq1isw,2651
22
- sure_tools-2.1.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- sure_tools-2.1.45.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
24
- sure_tools-2.1.45.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
25
- sure_tools-2.1.45.dist-info/RECORD,,
20
+ sure_tools-2.1.47.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
21
+ sure_tools-2.1.47.dist-info/METADATA,sha256=wysn-KRqcUVbYerQ9FK7D6LLDC4b5KB_IYzTw0uJzVw,2651
22
+ sure_tools-2.1.47.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ sure_tools-2.1.47.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
24
+ sure_tools-2.1.47.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
25
+ sure_tools-2.1.47.dist-info/RECORD,,