densr 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.
- densr-0.1.0/PKG-INFO +78 -0
- densr-0.1.0/README.md +61 -0
- densr-0.1.0/pyproject.toml +33 -0
- densr-0.1.0/setup.cfg +4 -0
- densr-0.1.0/setup.py +5 -0
- densr-0.1.0/src/densr/__init__.py +29 -0
- densr-0.1.0/src/densr/analysis.py +614 -0
- densr-0.1.0/src/densr/cli.py +38 -0
- densr-0.1.0/src/densr/sample_data/D4_1b.txt +370 -0
- densr-0.1.0/src/densr/sample_data/D4_lamp1.txt +817 -0
- densr-0.1.0/src/densr/sample_data/D4_volume.obj +19196 -0
- densr-0.1.0/src/densr.egg-info/PKG-INFO +78 -0
- densr-0.1.0/src/densr.egg-info/SOURCES.txt +15 -0
- densr-0.1.0/src/densr.egg-info/dependency_links.txt +1 -0
- densr-0.1.0/src/densr.egg-info/entry_points.txt +2 -0
- densr-0.1.0/src/densr.egg-info/requires.txt +8 -0
- densr-0.1.0/src/densr.egg-info/top_level.txt +1 -0
densr-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: densr
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Density-aware spatial randomization and object-based colocalization analysis for 3D RNA spot data.
|
|
5
|
+
Author: Sudharsan Kannan
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: numpy>=1.23
|
|
10
|
+
Requires-Dist: pandas>=1.5
|
|
11
|
+
Requires-Dist: scipy>=1.9
|
|
12
|
+
Requires-Dist: trimesh>=3.20
|
|
13
|
+
Requires-Dist: rtree>=1.0
|
|
14
|
+
Requires-Dist: libigl>=2.5
|
|
15
|
+
Requires-Dist: plotly>=5.0
|
|
16
|
+
Requires-Dist: kaleido>=0.2.1
|
|
17
|
+
|
|
18
|
+
# DenSR
|
|
19
|
+
|
|
20
|
+
DenSR provides density-aware spatial randomization using KDE-weighted sampling within a 3D cell mesh, plus object-based colocalization analysis for observed RNA spot coordinates, UniSR, and DenSR.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install .
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## One-line use
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from densr import densr
|
|
32
|
+
|
|
33
|
+
spots1 = "C1_1a_xyz.txt"
|
|
34
|
+
spots2 = "C1_1b_xyz.txt"
|
|
35
|
+
object = "C1_volume.obj"
|
|
36
|
+
colocalization_threshold = 1
|
|
37
|
+
|
|
38
|
+
results = densr(
|
|
39
|
+
spots1=spots1,
|
|
40
|
+
spots2=spots2,
|
|
41
|
+
object=object,
|
|
42
|
+
colocalization_threshold=colocalization_threshold,
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The RNA spot files are read as tab-separated text files, and the first three columns are used as x, y, and z coordinates.
|
|
47
|
+
The `densr(...)` call displays the results table and spot plot automatically.
|
|
48
|
+
|
|
49
|
+
## Built-in sample data
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from densr import densr, sample_data
|
|
53
|
+
|
|
54
|
+
sample = sample_data()
|
|
55
|
+
|
|
56
|
+
results = densr(
|
|
57
|
+
spots1=sample.spots1,
|
|
58
|
+
spots2=sample.spots2,
|
|
59
|
+
object=sample.object,
|
|
60
|
+
colocalization_threshold=0.25,
|
|
61
|
+
)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Command line
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
densr C1_volume.obj C1_1a_xyz.txt C1_1b_xyz.txt --colocalization-threshold 1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Public functions
|
|
71
|
+
|
|
72
|
+
- `extract_rna_spots(file)`: extract RNA spot coordinates from a text file.
|
|
73
|
+
- `filter_spots_inside_mesh(mesh, spots)`: retain only spots located within the 3D cell mesh.
|
|
74
|
+
- `coloc_percentage(spots1, spots2, threshold=0.5)`: calculate bidirectional object-based colocalization between two spot populations.
|
|
75
|
+
- `generate_unisr_spots(mesh, desired_points)`: UniSR, uniform spatial randomization within the 3D cell mesh.
|
|
76
|
+
- `generate_densr_spots(rna_spots, mesh)`: DenSR, density-aware spatial randomization using KDE-weighted sampling within the 3D cell mesh.
|
|
77
|
+
- `densr(spots1, spots2, object, colocalization_threshold=1)`: one-line DenSR analysis using RNA spot files and a 3D cell mesh file.
|
|
78
|
+
- `sample_data()`: return file paths for the built-in DenSR sample data.
|
densr-0.1.0/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# DenSR
|
|
2
|
+
|
|
3
|
+
DenSR provides density-aware spatial randomization using KDE-weighted sampling within a 3D cell mesh, plus object-based colocalization analysis for observed RNA spot coordinates, UniSR, and DenSR.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install .
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## One-line use
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from densr import densr
|
|
15
|
+
|
|
16
|
+
spots1 = "C1_1a_xyz.txt"
|
|
17
|
+
spots2 = "C1_1b_xyz.txt"
|
|
18
|
+
object = "C1_volume.obj"
|
|
19
|
+
colocalization_threshold = 1
|
|
20
|
+
|
|
21
|
+
results = densr(
|
|
22
|
+
spots1=spots1,
|
|
23
|
+
spots2=spots2,
|
|
24
|
+
object=object,
|
|
25
|
+
colocalization_threshold=colocalization_threshold,
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The RNA spot files are read as tab-separated text files, and the first three columns are used as x, y, and z coordinates.
|
|
30
|
+
The `densr(...)` call displays the results table and spot plot automatically.
|
|
31
|
+
|
|
32
|
+
## Built-in sample data
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from densr import densr, sample_data
|
|
36
|
+
|
|
37
|
+
sample = sample_data()
|
|
38
|
+
|
|
39
|
+
results = densr(
|
|
40
|
+
spots1=sample.spots1,
|
|
41
|
+
spots2=sample.spots2,
|
|
42
|
+
object=sample.object,
|
|
43
|
+
colocalization_threshold=0.25,
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Command line
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
densr C1_volume.obj C1_1a_xyz.txt C1_1b_xyz.txt --colocalization-threshold 1
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Public functions
|
|
54
|
+
|
|
55
|
+
- `extract_rna_spots(file)`: extract RNA spot coordinates from a text file.
|
|
56
|
+
- `filter_spots_inside_mesh(mesh, spots)`: retain only spots located within the 3D cell mesh.
|
|
57
|
+
- `coloc_percentage(spots1, spots2, threshold=0.5)`: calculate bidirectional object-based colocalization between two spot populations.
|
|
58
|
+
- `generate_unisr_spots(mesh, desired_points)`: UniSR, uniform spatial randomization within the 3D cell mesh.
|
|
59
|
+
- `generate_densr_spots(rna_spots, mesh)`: DenSR, density-aware spatial randomization using KDE-weighted sampling within the 3D cell mesh.
|
|
60
|
+
- `densr(spots1, spots2, object, colocalization_threshold=1)`: one-line DenSR analysis using RNA spot files and a 3D cell mesh file.
|
|
61
|
+
- `sample_data()`: return file paths for the built-in DenSR sample data.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "densr"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Density-aware spatial randomization and object-based colocalization analysis for 3D RNA spot data."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Sudharsan Kannan" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy>=1.23",
|
|
17
|
+
"pandas>=1.5",
|
|
18
|
+
"scipy>=1.9",
|
|
19
|
+
"trimesh>=3.20",
|
|
20
|
+
"rtree>=1.0",
|
|
21
|
+
"libigl>=2.5",
|
|
22
|
+
"plotly>=5.0",
|
|
23
|
+
"kaleido>=0.2.1",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
densr = "densr.cli:main"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.package-data]
|
|
33
|
+
densr = ["sample_data/*"]
|
densr-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""DenSR package API."""
|
|
2
|
+
|
|
3
|
+
from .analysis import (
|
|
4
|
+
DenSRResults,
|
|
5
|
+
DenSRSampleData,
|
|
6
|
+
calculate_max_density,
|
|
7
|
+
calculate_max_density_bbox,
|
|
8
|
+
coloc_percentage,
|
|
9
|
+
densr,
|
|
10
|
+
extract_rna_spots,
|
|
11
|
+
filter_spots_inside_mesh,
|
|
12
|
+
generate_densr_spots,
|
|
13
|
+
generate_unisr_spots,
|
|
14
|
+
sample_data,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"DenSRResults",
|
|
19
|
+
"DenSRSampleData",
|
|
20
|
+
"calculate_max_density",
|
|
21
|
+
"calculate_max_density_bbox",
|
|
22
|
+
"coloc_percentage",
|
|
23
|
+
"densr",
|
|
24
|
+
"extract_rna_spots",
|
|
25
|
+
"filter_spots_inside_mesh",
|
|
26
|
+
"generate_densr_spots",
|
|
27
|
+
"generate_unisr_spots",
|
|
28
|
+
"sample_data",
|
|
29
|
+
]
|