SURE-tools 2.0.1__tar.gz → 2.0.2__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.

Potentially problematic release.


This version of SURE-tools might be problematic. Click here for more details.

Files changed (26) hide show
  1. {sure_tools-2.0.1 → sure_tools-2.0.2}/PKG-INFO +1 -1
  2. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/__init__.py +2 -1
  3. sure_tools-2.0.2/SURE/flow/__init__.py +1 -0
  4. sure_tools-2.0.2/SURE/flow/quiver.py +52 -0
  5. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE_tools.egg-info/PKG-INFO +1 -1
  6. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE_tools.egg-info/SOURCES.txt +2 -0
  7. {sure_tools-2.0.1 → sure_tools-2.0.2}/setup.py +1 -1
  8. {sure_tools-2.0.1 → sure_tools-2.0.2}/LICENSE +0 -0
  9. {sure_tools-2.0.1 → sure_tools-2.0.2}/README.md +0 -0
  10. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/SURE.py +0 -0
  11. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/assembly/__init__.py +0 -0
  12. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/assembly/assembly.py +0 -0
  13. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/assembly/atlas.py +0 -0
  14. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/atac/__init__.py +0 -0
  15. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/atac/utils.py +0 -0
  16. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/codebook/__init__.py +0 -0
  17. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/codebook/codebook.py +0 -0
  18. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/utils/__init__.py +0 -0
  19. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/utils/custom_mlp.py +0 -0
  20. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/utils/queue.py +0 -0
  21. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE/utils/utils.py +0 -0
  22. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE_tools.egg-info/dependency_links.txt +0 -0
  23. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE_tools.egg-info/entry_points.txt +0 -0
  24. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE_tools.egg-info/requires.txt +0 -0
  25. {sure_tools-2.0.1 → sure_tools-2.0.2}/SURE_tools.egg-info/top_level.txt +0 -0
  26. {sure_tools-2.0.1 → sure_tools-2.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Succinct Representation of Single Cells
5
5
  Home-page: https://github.com/ZengFLab/SURE
6
6
  Author: Feng Zeng
@@ -6,5 +6,6 @@ from . import codebook
6
6
  from . import SURE
7
7
  from . import SURE2
8
8
  from . import atac
9
+ from . import flow
9
10
 
10
- __all__ = ['SURE','SURE2', 'atac', 'utils', 'codebook']
11
+ __all__ = ['SURE','SURE2', 'flow', 'atac', 'utils', 'codebook']
@@ -0,0 +1 @@
1
+ from .quiver import plot_quiver
@@ -0,0 +1,52 @@
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ from sklearn.decomposition import PCA
4
+ import scanpy as sc
5
+
6
+ def plot_quiver_high_dim(z_points, delta_z, method='umap', figsize=(6,4), dpi=200):
7
+ """
8
+ 从高维潜在空间选择2个维度进行quiver可视化
9
+ """
10
+ if method == 'variance':
11
+ # 方法1: 选择方差最大的2个维度
12
+ variances = np.var(z_points, axis=0)
13
+ dims = np.argsort(variances)[-2:] # 选择方差最大的两个维度
14
+ dim_names = [f'z[{d}]' for d in dims]
15
+
16
+ elif method == 'pca':
17
+ # 方法2: 使用PCA的前两个主成分
18
+ pca = PCA(n_components=2)
19
+ z_2d = pca.fit_transform(z_points)
20
+ delta_z_2d = pca.transform(z_points + delta_z) - z_2d
21
+ dim_names = ['PC1', 'PC2']
22
+
23
+ elif method == 'manual':
24
+ # 方法3: 手动选择感兴趣的维度
25
+ dims = [0, 1] # 选择前两个维度
26
+ z_2d = z_points[:, dims]
27
+ delta_z_2d = delta_z[:, dims]
28
+ dim_names = [f'z[{d}]' for d in dims]
29
+
30
+ elif method == 'umap':
31
+ ad = sc.AnnData(np.vstack([z_points, z_points+delta_z]))
32
+ sc.pp.neighbors(ad)
33
+ sc.tl.umap(ad)
34
+ z_2d = ad[:z_points.shape[0]].obsm['X_umap']
35
+ delta_z_2d = ad[z_points.shape[0]:] - z_2d
36
+ dim_names = ['UMAP1', 'UMAP2']
37
+
38
+ # 绘制quiver图
39
+ plt.figure(figsize=figsize, dpi=dpi)
40
+ plt.quiver(z_2d[:, 0], z_2d[:, 1],
41
+ delta_z_2d[:, 0], delta_z_2d[:, 1],
42
+ angles='xy', scale_units='xy', scale=1,
43
+ color='blue', alpha=0.6, width=0.005)
44
+
45
+ plt.scatter(z_2d[:, 0], z_2d[:, 1], c='gray', alpha=0.5, s=10)
46
+ plt.xlabel(dim_names[0])
47
+ plt.ylabel(dim_names[1])
48
+ plt.title(f"Latent Space Movement ({method} projection)")
49
+ plt.grid(alpha=0.3)
50
+ plt.show()
51
+
52
+ return z_2d, delta_z_2d
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SURE-tools
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Succinct Representation of Single Cells
5
5
  Home-page: https://github.com/ZengFLab/SURE
6
6
  Author: Feng Zeng
@@ -10,6 +10,8 @@ SURE/atac/__init__.py
10
10
  SURE/atac/utils.py
11
11
  SURE/codebook/__init__.py
12
12
  SURE/codebook/codebook.py
13
+ SURE/flow/__init__.py
14
+ SURE/flow/quiver.py
13
15
  SURE/utils/__init__.py
14
16
  SURE/utils/custom_mlp.py
15
17
  SURE/utils/queue.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name='SURE-tools',
8
- version='2.0.1',
8
+ version='2.0.2',
9
9
  description='Succinct Representation of Single Cells',
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes