scatrans 0.7.0.dev0__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.
- scatrans-0.7.0.dev0/.github/workflows/ci.yml +56 -0
- scatrans-0.7.0.dev0/.github/workflows/pypi-publish.yml +28 -0
- scatrans-0.7.0.dev0/.gitignore +172 -0
- scatrans-0.7.0.dev0/CHANGELOG.md +56 -0
- scatrans-0.7.0.dev0/LICENSE +21 -0
- scatrans-0.7.0.dev0/PKG-INFO +826 -0
- scatrans-0.7.0.dev0/README.md +784 -0
- scatrans-0.7.0.dev0/examples/memento_de_example.py +191 -0
- scatrans-0.7.0.dev0/examples/real_data_template.py +177 -0
- scatrans-0.7.0.dev0/examples/synthetic_active_transcription.py +114 -0
- scatrans-0.7.0.dev0/pyproject.toml +120 -0
- scatrans-0.7.0.dev0/setup.cfg +4 -0
- scatrans-0.7.0.dev0/src/scatrans/__init__.py +56 -0
- scatrans-0.7.0.dev0/src/scatrans/_bias.py +24 -0
- scatrans-0.7.0.dev0/src/scatrans/_de.py +555 -0
- scatrans-0.7.0.dev0/src/scatrans/_permutation.py +229 -0
- scatrans-0.7.0.dev0/src/scatrans/_utils.py +343 -0
- scatrans-0.7.0.dev0/src/scatrans/_velocity.py +152 -0
- scatrans-0.7.0.dev0/src/scatrans/_version.py +24 -0
- scatrans-0.7.0.dev0/src/scatrans/data/Hs_KEGG_2026.txt +223 -0
- scatrans-0.7.0.dev0/src/scatrans/data/Mm_KEGG_2026.txt +219 -0
- scatrans-0.7.0.dev0/src/scatrans/data/Mus_musculus.GRCm39.115_gene_features.parquet +0 -0
- scatrans-0.7.0.dev0/src/scatrans/data/README.md +94 -0
- scatrans-0.7.0.dev0/src/scatrans/data/mouse_2020A_gene_features.parquet +0 -0
- scatrans-0.7.0.dev0/src/scatrans/enrich.py +735 -0
- scatrans-0.7.0.dev0/src/scatrans/generate_gene_features.py +99 -0
- scatrans-0.7.0.dev0/src/scatrans/pl.py +1168 -0
- scatrans-0.7.0.dev0/src/scatrans/pp_bias.py +261 -0
- scatrans-0.7.0.dev0/src/scatrans/qc.py +41 -0
- scatrans-0.7.0.dev0/src/scatrans/tl.py +1618 -0
- scatrans-0.7.0.dev0/src/scatrans.egg-info/PKG-INFO +826 -0
- scatrans-0.7.0.dev0/src/scatrans.egg-info/SOURCES.txt +35 -0
- scatrans-0.7.0.dev0/src/scatrans.egg-info/dependency_links.txt +1 -0
- scatrans-0.7.0.dev0/src/scatrans.egg-info/entry_points.txt +2 -0
- scatrans-0.7.0.dev0/src/scatrans.egg-info/requires.txt +31 -0
- scatrans-0.7.0.dev0/src/scatrans.egg-info/top_level.txt +1 -0
- scatrans-0.7.0.dev0/tests/test_basic.py +600 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
16
|
+
# Core + each optional extra (some may be heavy / have native deps)
|
|
17
|
+
install-extra:
|
|
18
|
+
- ""
|
|
19
|
+
- "advanced"
|
|
20
|
+
- "pseudobulk"
|
|
21
|
+
- "gene_features"
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python-version }}
|
|
30
|
+
cache: "pip"
|
|
31
|
+
|
|
32
|
+
- name: Install package with extras
|
|
33
|
+
run: |
|
|
34
|
+
pip install --upgrade pip
|
|
35
|
+
EXTRA="${{ matrix.install-extra }}"
|
|
36
|
+
if [ -n "$EXTRA" ]; then
|
|
37
|
+
pip install -e ".[dev,$EXTRA]"
|
|
38
|
+
else
|
|
39
|
+
pip install -e ".[dev]"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
- name: Ruff lint
|
|
43
|
+
run: |
|
|
44
|
+
ruff check src/scatrans tests
|
|
45
|
+
ruff format --check src/scatrans tests
|
|
46
|
+
|
|
47
|
+
- name: Run tests (with coverage when possible)
|
|
48
|
+
run: |
|
|
49
|
+
pytest --cov=src/scatrans --cov-report=xml -q || pytest -q
|
|
50
|
+
|
|
51
|
+
- name: Upload coverage (optional)
|
|
52
|
+
if: matrix.python-version == '3.11' && matrix.install-extra == ''
|
|
53
|
+
uses: codecov/codecov-action@v4
|
|
54
|
+
with:
|
|
55
|
+
files: ./coverage.xml
|
|
56
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish Python Dist to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- name: Set up Python
|
|
13
|
+
uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: '3.x'
|
|
16
|
+
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: |
|
|
19
|
+
python -m pip install --upgrade pip
|
|
20
|
+
pip install build
|
|
21
|
+
|
|
22
|
+
- name: Build package
|
|
23
|
+
run: python -m build
|
|
24
|
+
|
|
25
|
+
- name: Publish package to PyPI
|
|
26
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
27
|
+
with:
|
|
28
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
*.manifest
|
|
30
|
+
*.spec
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
|
|
36
|
+
# Unit test / coverage reports
|
|
37
|
+
htmlcov/
|
|
38
|
+
.tox/
|
|
39
|
+
.nox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*.cover
|
|
46
|
+
*.py,cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
cover/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
local_settings.py
|
|
58
|
+
db.sqlite3
|
|
59
|
+
db.sqlite3-journal
|
|
60
|
+
|
|
61
|
+
# Flask stuff:
|
|
62
|
+
instance/
|
|
63
|
+
.webassets-cache
|
|
64
|
+
|
|
65
|
+
# Scrapy stuff:
|
|
66
|
+
.scrapy
|
|
67
|
+
|
|
68
|
+
# Sphinx documentation
|
|
69
|
+
docs/_build/
|
|
70
|
+
|
|
71
|
+
# PyBuilder
|
|
72
|
+
.pybuilder/
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter Notebook
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# IPython
|
|
79
|
+
profile_default/
|
|
80
|
+
ipython_config.py
|
|
81
|
+
|
|
82
|
+
# pyenv
|
|
83
|
+
.python-version
|
|
84
|
+
|
|
85
|
+
# pipenv
|
|
86
|
+
Pipfile.lock
|
|
87
|
+
|
|
88
|
+
# poetry
|
|
89
|
+
poetry.lock
|
|
90
|
+
|
|
91
|
+
# pdm
|
|
92
|
+
.pdm.toml
|
|
93
|
+
.pdm-python
|
|
94
|
+
.pdm-build/
|
|
95
|
+
|
|
96
|
+
# PEP 582
|
|
97
|
+
__pypackages__/
|
|
98
|
+
|
|
99
|
+
# Celery stuff
|
|
100
|
+
celerybeat-schedule
|
|
101
|
+
celerybeat.pid
|
|
102
|
+
|
|
103
|
+
# SageMath parsed files
|
|
104
|
+
*.sage.py
|
|
105
|
+
|
|
106
|
+
# Environments
|
|
107
|
+
.env
|
|
108
|
+
.venv
|
|
109
|
+
env/
|
|
110
|
+
venv/
|
|
111
|
+
ENV/
|
|
112
|
+
env.bak/
|
|
113
|
+
venv.bak/
|
|
114
|
+
|
|
115
|
+
# Spyder project settings
|
|
116
|
+
.spyderproject
|
|
117
|
+
.spyproject
|
|
118
|
+
|
|
119
|
+
# Rope project settings
|
|
120
|
+
.ropeproject
|
|
121
|
+
|
|
122
|
+
# mkdocs documentation
|
|
123
|
+
/site
|
|
124
|
+
|
|
125
|
+
# mypy
|
|
126
|
+
.mypy_cache/
|
|
127
|
+
.dmypy.json
|
|
128
|
+
dmypy.json
|
|
129
|
+
|
|
130
|
+
# Pyre type checker
|
|
131
|
+
.pyre/
|
|
132
|
+
|
|
133
|
+
# pytype static type analyzer
|
|
134
|
+
.pytype/
|
|
135
|
+
|
|
136
|
+
# Cython debug symbols
|
|
137
|
+
cython_debug/
|
|
138
|
+
|
|
139
|
+
# Ruff
|
|
140
|
+
.ruff_cache/
|
|
141
|
+
|
|
142
|
+
# IDE / editors
|
|
143
|
+
.idea/
|
|
144
|
+
.vscode/
|
|
145
|
+
*.swp
|
|
146
|
+
*.swo
|
|
147
|
+
*~
|
|
148
|
+
|
|
149
|
+
# OS generated files
|
|
150
|
+
.DS_Store
|
|
151
|
+
.DS_Store?
|
|
152
|
+
._*
|
|
153
|
+
.Spotlight-V100
|
|
154
|
+
.Trashes
|
|
155
|
+
ehthumbs.db
|
|
156
|
+
Thumbs.db
|
|
157
|
+
|
|
158
|
+
# Project specific
|
|
159
|
+
# Bundled large data is committed intentionally (gene features)
|
|
160
|
+
# but do not add user-generated .parquet outputs here by mistake
|
|
161
|
+
*.h5ad
|
|
162
|
+
*.loom
|
|
163
|
+
*.zarr
|
|
164
|
+
# Keep source data/ but ignore generated outputs at root
|
|
165
|
+
gene_features.parquet
|
|
166
|
+
*_gene_features.parquet
|
|
167
|
+
*_features.parquet
|
|
168
|
+
# Temporary analysis outputs
|
|
169
|
+
*.pdf
|
|
170
|
+
*.png
|
|
171
|
+
*.svg
|
|
172
|
+
active_results/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Rich runtime diagnostics** (high priority improvement): `active_score` now automatically computes global unspliced fraction (via integrated `qc.unspliced_global`), captures detailed bias-correction fit results (coefficients, n_genes_used, fallback status), stores per-gene `effective_gamma`, and records everything under `adata.uns["scatrans"]["diagnostics"]`. A concise run summary is logged at completion.
|
|
12
|
+
- New public helper `scat.pl.velocity_phase_portraits(adata, genes, groupby=...)` for quick visual inspection of U vs S relationships on top hits (lower-priority diagnostic aid).
|
|
13
|
+
- `examples/real_data_template.py` — heavily commented, non-runnable but copy-adaptable template demonstrating the full recommended real-data workflow, QC, diagnostics inspection, and publication plotting.
|
|
14
|
+
- Explicit documentation of the permutation approximation (velocity layers fixed from original data; only labels shuffled) in code metadata, logs, and the new "Choosing mode" section of the README.
|
|
15
|
+
- `effective_gamma` column is now added to `adata.var` (and included in result tables when present) for transparency of the gamma used in the delta calculation.
|
|
16
|
+
|
|
17
|
+
### Changed / Improved
|
|
18
|
+
- Major usability & paper-readiness upgrade to diagnostics, metadata, and user guidance.
|
|
19
|
+
- `qc.unspliced_global` is now called automatically inside `active_score` (result stored); the function remains directly usable as a pre-flight check (`scat.qc.unspliced_global(adata)`).
|
|
20
|
+
- Added prominent "Choosing `mode`: heuristic vs advanced (and common pitfalls)" section + decision guide to README.
|
|
21
|
+
|
|
22
|
+
### Added (0609 refactor)
|
|
23
|
+
- Mixed model support (`use_mixed_model=True` + `sample_col`): statsmodels LMM (~ condition + (1 | sample)) as cell-level replicate-aware DE backend (lightweight Python analogue to dreamlet/variancePartition/dreampy LMM + Libra mixed options). Replaces scanpy/pydeseq2 p/logFC when enabled.
|
|
24
|
+
- Delta Variance: `delta_variance` (condition-attributable variance fraction, 0-1, variancePartition-style) and `delta_var_pval` (LRT) computed during mixed fit; always surfaced in `all_results` / adata.var / diagnostics when mixed used.
|
|
25
|
+
- New `active_score` options: `use_delta_variance_pval` (bool) + `delta_var_pval_cutoff` to optionally include the delta LRT pval as supplementary filter in significant gene selection.
|
|
26
|
+
- Full backward compat; mixed path documented vs. pseudobulk; guidance + references to Libra, dreampy, NEBULA, dreamlet in README.
|
|
27
|
+
- Existing package backed up to `backup/backup0609/`.
|
|
28
|
+
- Tests + direct verification cover mixed, delta col, filter option, incompatibility with pseudobulk, and no regression on legacy paths. All tests pass.
|
|
29
|
+
- Enhanced `README.md` with real-data workflow pointers and stronger emphasis on inspecting diagnostics.
|
|
30
|
+
- `scat.pl` now documents the new phase-portrait helper; all existing `ax=` support preserved.
|
|
31
|
+
- Internal: `_fit_huber_bias_correction` and velocity helpers now return extra fit/quality information (used for the new diagnostics) while preserving full backward compatibility of public results.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- **Major internal refactor** (2025): Core logic in `tl.py` (`active_score`) was extracted into private supporting modules (`_utils.py`, `_de.py`, `_velocity.py`, `_bias.py`, `_permutation.py`). The public `active_score` function is now a thin, readable orchestrator while preserving 100% identical behavior, return values, and side effects on `adata`.
|
|
35
|
+
- Logging discipline: Library code in `pp_bias.py` and the gene-features generator now uses the `scatrans` logger instead of direct `print()` calls with emojis. CLI entrypoint configures basic logging for user-friendly output.
|
|
36
|
+
- Package data access (`add_gene_features`, etc.) now uses `importlib.resources` (with backport for Python < 3.9) for robustness across wheel, sdist, and editable installs.
|
|
37
|
+
- Plotting module docstrings and a few source comments cleaned of exaggerated language.
|
|
38
|
+
- `set_style` and plot functions now produce more consistent, vector-friendly output by default (pdf/ps fonttype 42, clean spines, etc.).
|
|
39
|
+
- README completely rewritten in calm, scientific English with detailed parameter tables, plotting settings, and usage guidance. All hype language removed.
|
|
40
|
+
- Test suite significantly expanded (heuristic + permutation, layer remapping, enrichment, plotting headless, error paths, etc.). All tests pass when using local source.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
- `pydeseq2` is now properly declared as an optional dependency under the `pseudobulk` extra (was previously only imported dynamically).
|
|
44
|
+
- Various minor style and unused-variable issues addressed via ruff.
|
|
45
|
+
- Namespace pollution in `scat.*` reduced (internal modules are still importable for advanced use but top-level `dir(scat)` is cleaner).
|
|
46
|
+
|
|
47
|
+
### Deprecated / Notes
|
|
48
|
+
- The previous "review fixes applied" comment in `tl.py` was removed as part of the refactor.
|
|
49
|
+
- Old code is preserved in the `backup/` directory for reference.
|
|
50
|
+
|
|
51
|
+
## [0.7.0] - Previous release (pre-refactor baseline)
|
|
52
|
+
|
|
53
|
+
See git history and the original README for prior changes. The 0.7 series introduced the dual-track (heuristic/advanced) engine, kb_python layer support, permutation testing, and the current public API surface.
|
|
54
|
+
|
|
55
|
+
[Unreleased]: https://github.com/scATrans/scatrans/compare/v0.7.0...HEAD
|
|
56
|
+
[0.7.0]: https://github.com/scATrans/scatrans/releases/tag/v0.7.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 scATrans Developers
|
|
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.
|