py-TranspaceR 0.1.0__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.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-TranspaceR
3
+ Version: 0.1.0
4
+ Summary: Statistical analysis of Spatial transcriptomic data (Python port of TranspaceR)
5
+ Author-email: Pierre Bost <pierre.bost@curie.fr>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/TranspaceR/TranspaceR
8
+ Keywords: spatial,transcriptomics,variogram,geary-c,bioinformatics
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: numpy>=1.21
22
+ Requires-Dist: scipy>=1.7
23
+ Requires-Dist: scikit-learn>=1.0
24
+ Requires-Dist: pandas>=1.3
25
+ Requires-Dist: matplotlib>=3.4
26
+ Provides-Extra: umap
27
+ Requires-Dist: umap-learn>=0.5; extra == "umap"
28
+ Provides-Extra: leiden
29
+ Requires-Dist: python-igraph>=0.10; extra == "leiden"
30
+ Requires-Dist: leidenalg>=0.9; extra == "leiden"
31
+ Provides-Extra: stats
32
+ Requires-Dist: statsmodels>=0.13; extra == "stats"
33
+ Provides-Extra: all
34
+ Requires-Dist: py-TranspaceR[leiden,stats,umap]; extra == "all"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=7.0; extra == "dev"
37
+ Requires-Dist: py-TranspaceR[all]; extra == "dev"
38
+
39
+ # py-TranspaceR
40
+
41
+ [![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
43
+ [![Tests](https://img.shields.io/badge/Tests-29%20passed-brightgreen.svg)](#testing)
44
+ [![Speedup](https://img.shields.io/badge/Speedup-17.7x-orange.svg)](#speed-benchmark)
45
+
46
+ Python port of [TranspaceR](https://github.com/TranspaceR/TranspaceR) — Statistical analysis of Spatial transcriptomic data.
47
+
48
+ ## Correlation Benchmark (Python vs R)
49
+
50
+ | Function | Pearson r | Max Abs Error |
51
+ |---|---|---|
52
+ | `C_normalisation` | 1.000000 | 4.10e-05 |
53
+ | `Otsu_thresholding` | — | 3.54e-05 |
54
+ | `colvars_sparse` | 1.000000 | 4.40e-05 |
55
+ | `Get_variogram_map` | Deterministic match | 0 |
56
+ | `Get_isotropic_vario` | 1.000000 | 0 |
57
+
58
+ All outputs are highly consistent with R references, with errors within floating-point precision.
59
+
60
+ ## Speed Benchmark (39,047 cells x 539 genes)
61
+
62
+ | Function | R Time | Python Time | Speedup |
63
+ |---|---|---|---|
64
+ | `C_normalisation` | 1.47s | 0.157s | 9.4x |
65
+ | `Otsu_thresholding` | 0.31s | 0.031s | 10.0x |
66
+ | `colvars_sparse` | 1.72s | 0.011s | 156x |
67
+ | `Get_variogram_map` | 0.02s | 0.0004s | 50x |
68
+ | `Get_isotropic_vario` | 0.01s | 0.0004s | 25x |
69
+ | **Total** | **3.53s** | **0.20s** | **17.7x** |
70
+
71
+ ### Why faster
72
+
73
+ - NumPy/SciPy compiled C backend vs R interpreted execution
74
+ - Direct CSC sparse matrix memory layout access
75
+ - Broadcasting replaces R's row-wise `apply` loops
76
+
77
+ ## Installation
78
+
79
+ ```bash
80
+ pip install -e ".[all]"
81
+ ```
82
+
83
+ ## Quick Start
84
+
85
+ ```python
86
+ import transspacer as ts
87
+ import numpy as np
88
+ import pandas as pd
89
+
90
+ # Load data
91
+ expr = pd.read_csv("Expression_file.csv.gz", index_col=0)
92
+ meta = pd.read_csv("Meta_data.csv", index_col=0)
93
+
94
+ # Cell-size normalisation
95
+ normed = ts.c_normalisation(expr.values.astype(float), meta["Area"].values)
96
+
97
+ # Otsu thresholding
98
+ threshold = ts.otsu_thresholding(np.log10(expr.values.sum(axis=1) + 1))
99
+
100
+ # Variogram analysis
101
+ result = ts.compute_variogram(normed, meta["cell_centroid_x"].values,
102
+ meta["cell_centroid_y"].values)
103
+
104
+ # Geary's C spatial autocorrelation
105
+ gc = ts.geary_c_score(normed, coords, pvalue_threshold=0.01)
106
+
107
+ # Clustering
108
+ labels = ts.cell_clustering_function(pca_data, K=10, resolution=1.0)
109
+ ```
110
+
111
+ ## Modules
112
+
113
+ | Module | Description |
114
+ |---|---|
115
+ | `fft_utils` | `fftshift`, `ifftshift`, `pad_definitor` |
116
+ | `normalization` | `C_normalisation` cell-size normalisation |
117
+ | `sparse_utils` | Sparse matrix column variance, group aggregation |
118
+ | `variogram` | FFT variogram map, variogram model fitting |
119
+ | `spatial_stats` | Geary's C, NB excess variance / excess zero score |
120
+ | `clustering` | KNN + Leiden/Louvain clustering, UMAP |
121
+ | `gene_selection` | `log2FC`, gene set union |
122
+ | `qc` | Otsu thresholding, QC gene filtering |
123
+ | `plotting` | Spatial visualization, heatmaps, UMAP plots |
124
+
125
+ ## Testing
126
+
127
+ ```bash
128
+ pytest tests/ -q
129
+ # 29 passed
130
+ ```
131
+
132
+ ## Dependencies
133
+
134
+ **Core:** `numpy`, `scipy`, `scikit-learn`, `pandas`, `matplotlib`
135
+
136
+ **Optional:** `umap-learn` (UMAP), `python-igraph` + `leidenalg` (Leiden clustering), `statsmodels` (FDR correction)
137
+
138
+ ## License
139
+
140
+ MIT
@@ -0,0 +1,102 @@
1
+ # py-TranspaceR
2
+
3
+ [![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
+ [![Tests](https://img.shields.io/badge/Tests-29%20passed-brightgreen.svg)](#testing)
6
+ [![Speedup](https://img.shields.io/badge/Speedup-17.7x-orange.svg)](#speed-benchmark)
7
+
8
+ Python port of [TranspaceR](https://github.com/TranspaceR/TranspaceR) — Statistical analysis of Spatial transcriptomic data.
9
+
10
+ ## Correlation Benchmark (Python vs R)
11
+
12
+ | Function | Pearson r | Max Abs Error |
13
+ |---|---|---|
14
+ | `C_normalisation` | 1.000000 | 4.10e-05 |
15
+ | `Otsu_thresholding` | — | 3.54e-05 |
16
+ | `colvars_sparse` | 1.000000 | 4.40e-05 |
17
+ | `Get_variogram_map` | Deterministic match | 0 |
18
+ | `Get_isotropic_vario` | 1.000000 | 0 |
19
+
20
+ All outputs are highly consistent with R references, with errors within floating-point precision.
21
+
22
+ ## Speed Benchmark (39,047 cells x 539 genes)
23
+
24
+ | Function | R Time | Python Time | Speedup |
25
+ |---|---|---|---|
26
+ | `C_normalisation` | 1.47s | 0.157s | 9.4x |
27
+ | `Otsu_thresholding` | 0.31s | 0.031s | 10.0x |
28
+ | `colvars_sparse` | 1.72s | 0.011s | 156x |
29
+ | `Get_variogram_map` | 0.02s | 0.0004s | 50x |
30
+ | `Get_isotropic_vario` | 0.01s | 0.0004s | 25x |
31
+ | **Total** | **3.53s** | **0.20s** | **17.7x** |
32
+
33
+ ### Why faster
34
+
35
+ - NumPy/SciPy compiled C backend vs R interpreted execution
36
+ - Direct CSC sparse matrix memory layout access
37
+ - Broadcasting replaces R's row-wise `apply` loops
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install -e ".[all]"
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ import transspacer as ts
49
+ import numpy as np
50
+ import pandas as pd
51
+
52
+ # Load data
53
+ expr = pd.read_csv("Expression_file.csv.gz", index_col=0)
54
+ meta = pd.read_csv("Meta_data.csv", index_col=0)
55
+
56
+ # Cell-size normalisation
57
+ normed = ts.c_normalisation(expr.values.astype(float), meta["Area"].values)
58
+
59
+ # Otsu thresholding
60
+ threshold = ts.otsu_thresholding(np.log10(expr.values.sum(axis=1) + 1))
61
+
62
+ # Variogram analysis
63
+ result = ts.compute_variogram(normed, meta["cell_centroid_x"].values,
64
+ meta["cell_centroid_y"].values)
65
+
66
+ # Geary's C spatial autocorrelation
67
+ gc = ts.geary_c_score(normed, coords, pvalue_threshold=0.01)
68
+
69
+ # Clustering
70
+ labels = ts.cell_clustering_function(pca_data, K=10, resolution=1.0)
71
+ ```
72
+
73
+ ## Modules
74
+
75
+ | Module | Description |
76
+ |---|---|
77
+ | `fft_utils` | `fftshift`, `ifftshift`, `pad_definitor` |
78
+ | `normalization` | `C_normalisation` cell-size normalisation |
79
+ | `sparse_utils` | Sparse matrix column variance, group aggregation |
80
+ | `variogram` | FFT variogram map, variogram model fitting |
81
+ | `spatial_stats` | Geary's C, NB excess variance / excess zero score |
82
+ | `clustering` | KNN + Leiden/Louvain clustering, UMAP |
83
+ | `gene_selection` | `log2FC`, gene set union |
84
+ | `qc` | Otsu thresholding, QC gene filtering |
85
+ | `plotting` | Spatial visualization, heatmaps, UMAP plots |
86
+
87
+ ## Testing
88
+
89
+ ```bash
90
+ pytest tests/ -q
91
+ # 29 passed
92
+ ```
93
+
94
+ ## Dependencies
95
+
96
+ **Core:** `numpy`, `scipy`, `scikit-learn`, `pandas`, `matplotlib`
97
+
98
+ **Optional:** `umap-learn` (UMAP), `python-igraph` + `leidenalg` (Leiden clustering), `statsmodels` (FDR correction)
99
+
100
+ ## License
101
+
102
+ MIT
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-TranspaceR
3
+ Version: 0.1.0
4
+ Summary: Statistical analysis of Spatial transcriptomic data (Python port of TranspaceR)
5
+ Author-email: Pierre Bost <pierre.bost@curie.fr>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/TranspaceR/TranspaceR
8
+ Keywords: spatial,transcriptomics,variogram,geary-c,bioinformatics
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: numpy>=1.21
22
+ Requires-Dist: scipy>=1.7
23
+ Requires-Dist: scikit-learn>=1.0
24
+ Requires-Dist: pandas>=1.3
25
+ Requires-Dist: matplotlib>=3.4
26
+ Provides-Extra: umap
27
+ Requires-Dist: umap-learn>=0.5; extra == "umap"
28
+ Provides-Extra: leiden
29
+ Requires-Dist: python-igraph>=0.10; extra == "leiden"
30
+ Requires-Dist: leidenalg>=0.9; extra == "leiden"
31
+ Provides-Extra: stats
32
+ Requires-Dist: statsmodels>=0.13; extra == "stats"
33
+ Provides-Extra: all
34
+ Requires-Dist: py-TranspaceR[leiden,stats,umap]; extra == "all"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=7.0; extra == "dev"
37
+ Requires-Dist: py-TranspaceR[all]; extra == "dev"
38
+
39
+ # py-TranspaceR
40
+
41
+ [![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
43
+ [![Tests](https://img.shields.io/badge/Tests-29%20passed-brightgreen.svg)](#testing)
44
+ [![Speedup](https://img.shields.io/badge/Speedup-17.7x-orange.svg)](#speed-benchmark)
45
+
46
+ Python port of [TranspaceR](https://github.com/TranspaceR/TranspaceR) — Statistical analysis of Spatial transcriptomic data.
47
+
48
+ ## Correlation Benchmark (Python vs R)
49
+
50
+ | Function | Pearson r | Max Abs Error |
51
+ |---|---|---|
52
+ | `C_normalisation` | 1.000000 | 4.10e-05 |
53
+ | `Otsu_thresholding` | — | 3.54e-05 |
54
+ | `colvars_sparse` | 1.000000 | 4.40e-05 |
55
+ | `Get_variogram_map` | Deterministic match | 0 |
56
+ | `Get_isotropic_vario` | 1.000000 | 0 |
57
+
58
+ All outputs are highly consistent with R references, with errors within floating-point precision.
59
+
60
+ ## Speed Benchmark (39,047 cells x 539 genes)
61
+
62
+ | Function | R Time | Python Time | Speedup |
63
+ |---|---|---|---|
64
+ | `C_normalisation` | 1.47s | 0.157s | 9.4x |
65
+ | `Otsu_thresholding` | 0.31s | 0.031s | 10.0x |
66
+ | `colvars_sparse` | 1.72s | 0.011s | 156x |
67
+ | `Get_variogram_map` | 0.02s | 0.0004s | 50x |
68
+ | `Get_isotropic_vario` | 0.01s | 0.0004s | 25x |
69
+ | **Total** | **3.53s** | **0.20s** | **17.7x** |
70
+
71
+ ### Why faster
72
+
73
+ - NumPy/SciPy compiled C backend vs R interpreted execution
74
+ - Direct CSC sparse matrix memory layout access
75
+ - Broadcasting replaces R's row-wise `apply` loops
76
+
77
+ ## Installation
78
+
79
+ ```bash
80
+ pip install -e ".[all]"
81
+ ```
82
+
83
+ ## Quick Start
84
+
85
+ ```python
86
+ import transspacer as ts
87
+ import numpy as np
88
+ import pandas as pd
89
+
90
+ # Load data
91
+ expr = pd.read_csv("Expression_file.csv.gz", index_col=0)
92
+ meta = pd.read_csv("Meta_data.csv", index_col=0)
93
+
94
+ # Cell-size normalisation
95
+ normed = ts.c_normalisation(expr.values.astype(float), meta["Area"].values)
96
+
97
+ # Otsu thresholding
98
+ threshold = ts.otsu_thresholding(np.log10(expr.values.sum(axis=1) + 1))
99
+
100
+ # Variogram analysis
101
+ result = ts.compute_variogram(normed, meta["cell_centroid_x"].values,
102
+ meta["cell_centroid_y"].values)
103
+
104
+ # Geary's C spatial autocorrelation
105
+ gc = ts.geary_c_score(normed, coords, pvalue_threshold=0.01)
106
+
107
+ # Clustering
108
+ labels = ts.cell_clustering_function(pca_data, K=10, resolution=1.0)
109
+ ```
110
+
111
+ ## Modules
112
+
113
+ | Module | Description |
114
+ |---|---|
115
+ | `fft_utils` | `fftshift`, `ifftshift`, `pad_definitor` |
116
+ | `normalization` | `C_normalisation` cell-size normalisation |
117
+ | `sparse_utils` | Sparse matrix column variance, group aggregation |
118
+ | `variogram` | FFT variogram map, variogram model fitting |
119
+ | `spatial_stats` | Geary's C, NB excess variance / excess zero score |
120
+ | `clustering` | KNN + Leiden/Louvain clustering, UMAP |
121
+ | `gene_selection` | `log2FC`, gene set union |
122
+ | `qc` | Otsu thresholding, QC gene filtering |
123
+ | `plotting` | Spatial visualization, heatmaps, UMAP plots |
124
+
125
+ ## Testing
126
+
127
+ ```bash
128
+ pytest tests/ -q
129
+ # 29 passed
130
+ ```
131
+
132
+ ## Dependencies
133
+
134
+ **Core:** `numpy`, `scipy`, `scikit-learn`, `pandas`, `matplotlib`
135
+
136
+ **Optional:** `umap-learn` (UMAP), `python-igraph` + `leidenalg` (Leiden clustering), `statsmodels` (FDR correction)
137
+
138
+ ## License
139
+
140
+ MIT
@@ -0,0 +1,21 @@
1
+ README.md
2
+ pyproject.toml
3
+ py_TranspaceR.egg-info/PKG-INFO
4
+ py_TranspaceR.egg-info/SOURCES.txt
5
+ py_TranspaceR.egg-info/dependency_links.txt
6
+ py_TranspaceR.egg-info/requires.txt
7
+ py_TranspaceR.egg-info/top_level.txt
8
+ tests/test_correlation_and_speed.py
9
+ tests/test_parity.py
10
+ tests/test_parity_vs_r.py
11
+ transspacer/__init__.py
12
+ transspacer/clustering.py
13
+ transspacer/fft_utils.py
14
+ transspacer/gene_selection.py
15
+ transspacer/normalization.py
16
+ transspacer/plotting.py
17
+ transspacer/qc.py
18
+ transspacer/sparse_utils.py
19
+ transspacer/spatial_stats.py
20
+ transspacer/utils.py
21
+ transspacer/variogram.py
@@ -0,0 +1,22 @@
1
+ numpy>=1.21
2
+ scipy>=1.7
3
+ scikit-learn>=1.0
4
+ pandas>=1.3
5
+ matplotlib>=3.4
6
+
7
+ [all]
8
+ py-TranspaceR[leiden,stats,umap]
9
+
10
+ [dev]
11
+ pytest>=7.0
12
+ py-TranspaceR[all]
13
+
14
+ [leiden]
15
+ python-igraph>=0.10
16
+ leidenalg>=0.9
17
+
18
+ [stats]
19
+ statsmodels>=0.13
20
+
21
+ [umap]
22
+ umap-learn>=0.5
@@ -0,0 +1 @@
1
+ transspacer
@@ -0,0 +1,47 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "py-TranspaceR"
7
+ version = "0.1.0"
8
+ description = "Statistical analysis of Spatial transcriptomic data (Python port of TranspaceR)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Pierre Bost", email = "pierre.bost@curie.fr"},
14
+ ]
15
+ keywords = ["spatial", "transcriptomics", "variogram", "geary-c", "bioinformatics"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Science/Research",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
27
+ ]
28
+ dependencies = [
29
+ "numpy>=1.21",
30
+ "scipy>=1.7",
31
+ "scikit-learn>=1.0",
32
+ "pandas>=1.3",
33
+ "matplotlib>=3.4",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ umap = ["umap-learn>=0.5"]
38
+ leiden = ["python-igraph>=0.10", "leidenalg>=0.9"]
39
+ stats = ["statsmodels>=0.13"]
40
+ all = ["py-TranspaceR[umap,leiden,stats]"]
41
+ dev = ["pytest>=7.0", "py-TranspaceR[all]"]
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/TranspaceR/TranspaceR"
45
+
46
+ [tool.setuptools.packages.find]
47
+ include = ["transspacer*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+