segtraq 0.0.1__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.
Files changed (34) hide show
  1. segtraq-0.0.1/CONTRIBUTING.md +119 -0
  2. segtraq-0.0.1/HISTORY.md +5 -0
  3. segtraq-0.0.1/LICENSE +21 -0
  4. segtraq-0.0.1/MANIFEST.in +12 -0
  5. segtraq-0.0.1/PKG-INFO +54 -0
  6. segtraq-0.0.1/README.md +12 -0
  7. segtraq-0.0.1/pyproject.toml +100 -0
  8. segtraq-0.0.1/setup.cfg +4 -0
  9. segtraq-0.0.1/src/segtraq/__init__.py +9 -0
  10. segtraq-0.0.1/src/segtraq/bl/__init__.py +21 -0
  11. segtraq-0.0.1/src/segtraq/bl/baseline.py +372 -0
  12. segtraq-0.0.1/src/segtraq/cs/__init__.py +17 -0
  13. segtraq-0.0.1/src/segtraq/cs/clustering_stability.py +399 -0
  14. segtraq-0.0.1/src/segtraq/cs/utils.py +304 -0
  15. segtraq-0.0.1/src/segtraq/io/__init__.py +12 -0
  16. segtraq-0.0.1/src/segtraq/io/io.py +375 -0
  17. segtraq-0.0.1/src/segtraq/io/utils.py +988 -0
  18. segtraq-0.0.1/src/segtraq/nc/__init__.py +11 -0
  19. segtraq-0.0.1/src/segtraq/nc/__main__.py +4 -0
  20. segtraq-0.0.1/src/segtraq/nc/nuclear_correlation.py +560 -0
  21. segtraq-0.0.1/src/segtraq/pl/__init__.py +17 -0
  22. segtraq-0.0.1/src/segtraq/pl/plotting_functions.py +562 -0
  23. segtraq-0.0.1/src/segtraq/segtraq_metrics/SegtraqMetrics.py +334 -0
  24. segtraq-0.0.1/src/segtraq/segtraq_metrics/__init__.py +5 -0
  25. segtraq-0.0.1/src/segtraq/sp/__init__.py +21 -0
  26. segtraq-0.0.1/src/segtraq/sp/spillover_metrics.py +200 -0
  27. segtraq-0.0.1/src/segtraq/sp/spillover_metrics_supervised.py +539 -0
  28. segtraq-0.0.1/src/segtraq/utils.py +191 -0
  29. segtraq-0.0.1/src/segtraq.egg-info/PKG-INFO +54 -0
  30. segtraq-0.0.1/src/segtraq.egg-info/SOURCES.txt +32 -0
  31. segtraq-0.0.1/src/segtraq.egg-info/dependency_links.txt +1 -0
  32. segtraq-0.0.1/src/segtraq.egg-info/entry_points.txt +2 -0
  33. segtraq-0.0.1/src/segtraq.egg-info/requires.txt +29 -0
  34. segtraq-0.0.1/src/segtraq.egg-info/top_level.txt +1 -0
@@ -0,0 +1,119 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
4
+
5
+ You can contribute in many ways:
6
+
7
+ ## Types of Contributions
8
+
9
+ ### Report Bugs
10
+
11
+ Report bugs at https://github.com/LazDaria/segtraq/issues.
12
+
13
+ If you are reporting a bug, please include:
14
+
15
+ - Your operating system name and version.
16
+ - Any details about your local setup that might be helpful in troubleshooting.
17
+ - Detailed steps to reproduce the bug.
18
+
19
+ ### Fix Bugs
20
+
21
+ Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.
22
+
23
+ ### Implement Features
24
+
25
+ Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.
26
+
27
+ ### Write Documentation
28
+
29
+ SegTraQ could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such.
30
+
31
+ ### Submit Feedback
32
+
33
+ The best way to send feedback is to file an issue at https://github.com/LazDaria/segtraq/issues.
34
+
35
+ If you are proposing a feature:
36
+
37
+ - Explain in detail how it would work.
38
+ - Keep the scope as narrow as possible, to make it easier to implement.
39
+ - Remember that this is a volunteer-driven project, and that contributions are welcome :)
40
+
41
+ ## Get Started!
42
+
43
+ Ready to contribute? Here's how to set up `segtraq` for local development.
44
+
45
+ 1. Fork the `segtraq` repo on GitHub.
46
+ 2. Clone your fork locally:
47
+
48
+ ```sh
49
+ git clone git@github.com:your_name_here/segtraq.git
50
+ ```
51
+
52
+ 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
53
+
54
+ ```sh
55
+ mkvirtualenv segtraq
56
+ cd segtraq/
57
+ python setup.py develop
58
+ ```
59
+
60
+ 4. Create a branch for local development:
61
+
62
+ ```sh
63
+ git checkout -b name-of-your-bugfix-or-feature
64
+ ```
65
+
66
+ Now you can make your changes locally.
67
+
68
+ 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
69
+
70
+ ```sh
71
+ make lint
72
+ make test
73
+ # Or
74
+ make test-all
75
+ ```
76
+
77
+ To get flake8 and tox, just pip install them into your virtualenv.
78
+
79
+ 6. Commit your changes and push your branch to GitHub:
80
+
81
+ ```sh
82
+ git add .
83
+ git commit -m "Your detailed description of your changes."
84
+ git push origin name-of-your-bugfix-or-feature
85
+ ```
86
+
87
+ 7. Submit a pull request through the GitHub website.
88
+
89
+ ## Pull Request Guidelines
90
+
91
+ Before you submit a pull request, check that it meets these guidelines:
92
+
93
+ 1. The pull request should include tests.
94
+ 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.md.
95
+ 3. The pull request should work for Python 3.12 and 3.13. Tests run in GitHub Actions on every pull request to the main branch, make sure that the tests pass for all supported Python versions.
96
+
97
+ ## Tips
98
+
99
+ To run a subset of tests:
100
+
101
+ ```sh
102
+ pytest tests.test_segtraq
103
+ ```
104
+
105
+ ## Deploying
106
+
107
+ A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in HISTORY.md). Then run:
108
+
109
+ ```sh
110
+ bump2version patch # possible: major / minor / patch
111
+ git push
112
+ git push --tags
113
+ ```
114
+
115
+ You can set up a [GitHub Actions workflow](https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-python#publishing-to-pypi) to automatically deploy your package to PyPI when you push a new tag.
116
+
117
+ ## Code of Conduct
118
+
119
+ Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
@@ -0,0 +1,5 @@
1
+ # History
2
+
3
+ ## 0.1.0 (2025-07-29)
4
+
5
+ * First release on PyPI.
segtraq-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025, Daria Lazic, Matthias Meyer-Bender, Martin Emons
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ include README.md
2
+ include LICENSE
3
+ include HISTORY.md
4
+ include CONTRIBUTING.md
5
+
6
+ # Include all Python files and package data
7
+ recursive-include src/segtraq *.py
8
+ recursive-include src/segtraq *.json *.csv *.txt # any necessary package data
9
+
10
+ # Exclude tests, docs, and large files
11
+ recursive-exclude tests *
12
+ recursive-exclude docs *
segtraq-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: segtraq
3
+ Version: 0.0.1
4
+ Summary: SegTraQ - A Python toolkit for quantitative and visual quality control of segmentation and transcript assignment in spatial omics data.
5
+ Author-email: Daria Lazic <daria.lazic@embl.de>, Matthias Meyer-Bender <matthias.meyerbender@embl.de>, Martin Emons <martin.emons@uzh.ch>
6
+ Maintainer-email: Daria Lazic <daria.lazic@embl.de>, Matthias Meyer-Bender <matthias.meyerbender@embl.de>, Martin Emons <martin.emons@uzh.ch>
7
+ License: MIT
8
+ Project-URL: bugs, https://github.com/LazDaria/segtraq/issues
9
+ Project-URL: changelog, https://github.com/LazDaria/segtraq/blob/master/changelog.md
10
+ Project-URL: homepage, https://github.com/LazDaria/segtraq
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: typer
15
+ Requires-Dist: scanpy
16
+ Requires-Dist: spatialdata
17
+ Requires-Dist: joblib
18
+ Requires-Dist: geopandas
19
+ Requires-Dist: igraph
20
+ Requires-Dist: rtree
21
+ Requires-Dist: rasterio
22
+ Requires-Dist: squidpy
23
+ Requires-Dist: tqdm
24
+ Requires-Dist: anndata==0.11.4
25
+ Provides-Extra: test
26
+ Requires-Dist: coverage; extra == "test"
27
+ Requires-Dist: pytest; extra == "test"
28
+ Requires-Dist: ruff; extra == "test"
29
+ Requires-Dist: ty; extra == "test"
30
+ Requires-Dist: ipdb; extra == "test"
31
+ Requires-Dist: black[jupyter]; extra == "test"
32
+ Requires-Dist: pytest-cov; extra == "test"
33
+ Provides-Extra: docs
34
+ Requires-Dist: sphinx; extra == "docs"
35
+ Requires-Dist: sphinx-book-theme; extra == "docs"
36
+ Requires-Dist: myst-parser; extra == "docs"
37
+ Requires-Dist: nbsphinx; extra == "docs"
38
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
39
+ Requires-Dist: sphinx-copybutton; extra == "docs"
40
+ Requires-Dist: pandoc; extra == "docs"
41
+ Dynamic: license-file
42
+
43
+ # SegTraQ
44
+
45
+ [![PyPI version](https://badge.fury.io/py/segtraq.svg)](https://badge.fury.io/py/segtraq)
46
+
47
+ SegTraQ - **Seg**mentation and **Tra**nscript Assignment **Q**uality Control - A Python toolkit for quantitative and visual quality control of segmentation and transcript assignment in spatial omics data.
48
+
49
+ * PyPI package: https://pypi.org/search/segtraq
50
+ * Free software: MIT License
51
+ * Documentation: https://lazdaria.github.io/SegTraQ
52
+
53
+ > ⚠️ Note: SegTraQ is under active development.
54
+ > Features, interfaces, and functionality may change in upcoming releases.
@@ -0,0 +1,12 @@
1
+ # SegTraQ
2
+
3
+ [![PyPI version](https://badge.fury.io/py/segtraq.svg)](https://badge.fury.io/py/segtraq)
4
+
5
+ SegTraQ - **Seg**mentation and **Tra**nscript Assignment **Q**uality Control - A Python toolkit for quantitative and visual quality control of segmentation and transcript assignment in spatial omics data.
6
+
7
+ * PyPI package: https://pypi.org/search/segtraq
8
+ * Free software: MIT License
9
+ * Documentation: https://lazdaria.github.io/SegTraQ
10
+
11
+ > ⚠️ Note: SegTraQ is under active development.
12
+ > Features, interfaces, and functionality may change in upcoming releases.
@@ -0,0 +1,100 @@
1
+ [project]
2
+ name = "segtraq"
3
+ version = "0.0.1"
4
+ description = "SegTraQ - A Python toolkit for quantitative and visual quality control of segmentation and transcript assignment in spatial omics data."
5
+ readme = "README.md"
6
+ authors = [
7
+ {name = "Daria Lazic", email = "daria.lazic@embl.de"},
8
+ {name = "Matthias Meyer-Bender", email = "matthias.meyerbender@embl.de"},
9
+ {name = "Martin Emons", email = "martin.emons@uzh.ch"}
10
+ ]
11
+ maintainers = [
12
+ {name = "Daria Lazic", email = "daria.lazic@embl.de"},
13
+ {name = "Matthias Meyer-Bender", email = "matthias.meyerbender@embl.de"},
14
+ {name = "Martin Emons", email = "martin.emons@uzh.ch"}
15
+ ]
16
+ classifiers = [
17
+
18
+ ]
19
+ license = {text = "MIT"}
20
+ dependencies = [
21
+ "typer",
22
+ "scanpy",
23
+ "spatialdata",
24
+ "joblib",
25
+ "geopandas",
26
+ "igraph",
27
+ "rtree",
28
+ "rasterio",
29
+ "squidpy",
30
+ "tqdm",
31
+ "anndata==0.11.4"
32
+ ]
33
+ requires-python = ">= 3.11"
34
+
35
+ [project.optional-dependencies]
36
+ test = [
37
+ "coverage",
38
+ "pytest",
39
+ "ruff",
40
+ "ty",
41
+ "ipdb",
42
+ "black[jupyter]",
43
+ "pytest-cov",
44
+ ]
45
+
46
+ docs = [
47
+ "sphinx",
48
+ "sphinx-book-theme", # or another theme you prefer
49
+ "myst-parser", # if you want to support markdown in Sphinx
50
+ "nbsphinx", # for rendering Jupyter notebooks in Sphinx
51
+ "sphinx-autodoc-typehints", # for better type hint rendering in
52
+ "sphinx-copybutton", # for copy buttons in code blocks
53
+ "pandoc",
54
+ ]
55
+
56
+ [project.urls]
57
+
58
+ bugs = "https://github.com/LazDaria/segtraq/issues"
59
+ changelog = "https://github.com/LazDaria/segtraq/blob/master/changelog.md"
60
+ homepage = "https://github.com/LazDaria/segtraq"
61
+
62
+ [tool.setuptools]
63
+ package-dir = {"" = "src"}
64
+
65
+ [tool.setuptools.packages.find]
66
+ where = ["src"]
67
+ exclude = ["tests", "tests.*", "docs", "examples", "data", "data.*"]
68
+
69
+ [project.scripts]
70
+ segtraq = "segtraq.cli:app"
71
+
72
+ [tool.ty]
73
+ # All rules are enabled as "error" by default; no need to specify unless overriding.
74
+ # Example override: relax a rule for the entire project (uncomment if needed).
75
+ # rules.TY015 = "warn" # For invalid-argument-type, warn instead of error.
76
+
77
+ # Optional: Per-directory overrides for flexibility in boilerplates with tests or examples.
78
+ [[tool.ty.overrides]]
79
+ match = ["tests/**.py"]
80
+ rules.TY016 = "ignore" # Ignore invalid-assignment in tests, e.g., for dynamic fixtures.
81
+ rules.TY029 = "ignore" # Ignore invalid-return-type in tests.
82
+
83
+ [tool.ruff]
84
+ line-length = 120
85
+
86
+ [tool.black]
87
+ line-length = 120
88
+
89
+ [tool.ruff.lint]
90
+ select = [
91
+ "E", # pycodestyle errors
92
+ "W", # pycodestyle warnings
93
+ "F", # Pyflakes
94
+ "I", # isort
95
+ "B", # flake8-bugbear
96
+ "UP", # pyupgrade
97
+ ]
98
+
99
+ [tool.uv]
100
+ package = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,9 @@
1
+ """Top-level package for SegTraQ."""
2
+
3
+ __author__ = """Daria Lazic, Matthias Meyer-Bender, Martin Emons"""
4
+ __email__ = "daria.lazic@embl.de, matthias.meyerbender@embl.de, martin.emons@uzh.ch"
5
+
6
+ from . import bl, cs, io, nc, pl, segtraq_metrics, sp
7
+ from .utils import run_label_transfer # TODO - maybe move to baseline metrics later?
8
+
9
+ __all__ = ["bl", "cs", "nc", "io", "sp", "pl", "segtraq_metrics", "run_label_transfer"]
@@ -0,0 +1,21 @@
1
+ from .baseline import (
2
+ genes_per_cell,
3
+ morphological_features,
4
+ num_cells,
5
+ num_genes,
6
+ num_transcripts,
7
+ perc_unassigned_transcripts,
8
+ transcript_density,
9
+ transcripts_per_cell,
10
+ )
11
+
12
+ __all__ = [
13
+ "num_cells",
14
+ "num_transcripts",
15
+ "num_genes",
16
+ "perc_unassigned_transcripts",
17
+ "transcripts_per_cell",
18
+ "genes_per_cell",
19
+ "transcript_density",
20
+ "morphological_features",
21
+ ]