scatrans 0.9.2.dev0__tar.gz → 0.9.4.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.
Files changed (36) hide show
  1. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/CHANGELOG.md +52 -0
  2. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/MANIFEST.in +1 -0
  3. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/PKG-INFO +312 -123
  4. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/README.md +309 -120
  5. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/examples/real_data_template.py +4 -3
  6. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/pyproject.toml +14 -4
  7. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/__init__.py +19 -1
  8. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/_de.py +122 -34
  9. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/_permutation.py +52 -11
  10. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/_utils.py +67 -13
  11. scatrans-0.9.4.dev0/src/scatrans/_velocity.py +418 -0
  12. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/_version.py +3 -3
  13. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/README.md +22 -0
  14. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/enrich.py +826 -58
  15. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/generate_gene_features.py +7 -6
  16. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/pl.py +903 -93
  17. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/pp_bias.py +73 -15
  18. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/qc.py +10 -5
  19. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/tl.py +855 -176
  20. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/tests/test_basic.py +190 -62
  21. scatrans-0.9.2.dev0/src/scatrans/_velocity.py +0 -181
  22. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/.github/workflows/ci.yml +0 -0
  23. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/.github/workflows/publish.yml +0 -0
  24. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/.gitignore +0 -0
  25. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/LICENSE +0 -0
  26. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/examples/memento_de_example.py +0 -0
  27. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/examples/synthetic_active_transcription.py +0 -0
  28. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/scatrans.egg-info/SOURCES.txt +0 -0
  29. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/setup.cfg +0 -0
  30. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/_bias.py +0 -0
  31. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/Hs_GO_Biological_Process_2026.txt +0 -0
  32. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/Hs_KEGG_2026.txt +0 -0
  33. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/Mm_GO_Biological_Process_2026.txt +0 -0
  34. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/Mm_KEGG_2026.txt +0 -0
  35. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/Mus_musculus.GRCm39.115_gene_features.parquet +0 -0
  36. {scatrans-0.9.2.dev0 → scatrans-0.9.4.dev0}/src/scatrans/data/mouse_2020A_gene_features.parquet +0 -0
@@ -5,6 +5,58 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased / Review 2026-06-27]
9
+ ### Added / Improved
10
+ - Clarified and documented the `gamma_method="empirical_bayes"` implementation as **hierarchical (分层) gamma estimation** for the reference U/S ratio (README keeps the CN term; source now English-only).
11
+ - Stronger emphasis on "always pass explicit target_group/reference_group".
12
+
13
+ ### Changed / Fixed (critical)
14
+ - **Bug 1**: Eliminated dead code — `tl.py` now calls the canonical `run_permutation_test(...)` in `_permutation.py` instead of duplicating the Parallel loop. Removed ~duplicated logic and the maintenance trap. `valid_expr` is passed explicitly for consistent behavior.
15
+ - **Bug 2**: Fixed double normalization (double log1p) in permutations. When `de_preprocess="normalize_log1p"` (or auto that applies), the value passed to permutation tasks is forced to "none" so that perm copies of the already-transformed adata are not re-normalized. Prevents systematically biased FDR.
16
+ - **Scientific Error 1**: Fixed EB gamma: `sigma2` in `_apply_empirical_bayes_gamma` now correctly includes the `n_ref` factor: `1.0 / (n_ref * U_r + c) + ...`. This was causing n_r-fold over-estimate of observation noise and excessive shrinkage (especially bad for the small-ref case EB is meant to help). `n_ref` is computed from r_mask in the caller.
17
+ - **Scientific Error 2**: Clarified `robust_median` docs in code/README: it is a heuristic variant of `heuristic_shrink` (different base_gamma estimator) and is **not** Bayesian/EB/hierarchical. Renamed descriptions to prevent user confusion.
18
+ - **Design fixes**:
19
+ - Tightened Memento raw counts check from `>=` to exact `== n_vars` + `var_names` equality (prevents misaligned HVG/raw usage).
20
+ - Renamed shadowing local `ad = ...` in `active_score_simple` / `differential_expression_simple` (avoids hiding `import anndata as ad`).
21
+ - Made `min_cells_per_sample` private (`_min_cells_per_sample`) + doc note (was public but did nothing).
22
+ - Removed all Chinese comments ("分层") from source (tl.py, _velocity.py); retained in README only.
23
+ - Replaced risky bare `except TypeError` for PyDESeq2 design_factors/design compat with explicit `_pydeseq2_uses_design_factors()` using `importlib.metadata` version check.
24
+
25
+ - Reduced anndata category storage log noise during internal DE/perm (narrow logger level bump).
26
+ - All tests + targeted EB/perm/explicit-norm cases pass after fixes.
27
+
28
+ ### Additional fixes (2026-06-27 round 2)
29
+ - **Scientific Error 3**: `generate_gene_features_from_gtf()` now computes **true exon union length per gene** (merge overlapping intervals) instead of naively summing all exons across all transcripts. Prevents ~N_transcript-fold overestimation of gene_length for multi-isoform genes (affects only users who generate their own tables; bundled .parquet files are unaffected).
30
+ - **Scientific Error 4**: `logFC` is now normalized toward consistent **log2 scale** across backends inside `_run_de_wrapper`:
31
+ - wilcoxon, mixedlm, memento: divided by ln(2)
32
+ - t-test / PyDESeq2: left as native log2
33
+ - Updated docstring. Makes `logfc_cutoff` semantically comparable.
34
+ - **Bug 3**: `_pseudobulk_with_layers` now uses a **per-run UUID-based private separator** (instead of fragile "||") to build internal keys. Completely eliminates split errors when sample names contain "||".
35
+ - **Bug 4**: Removed redundant `import warnings as _w` inside `with warnings.catch_warnings()` in `_fit_huber_bias_correction`.
36
+ - **Design 6**: `pval_cutoff` deprecation warning now fires **on every use** of the legacy name (previously only when != 0.05).
37
+ - **Design 7**: `run_go(ontology="CC"/"MF")` now emits a clear INFO log explaining that only BP is bundled and the others require gseapy + network.
38
+ - **Design 8**: Made the "max > 50" heuristic in `_prepare_log_normalized_expression` (mixed model prep) more robust: checks for negatives, uses lower threshold (20), better warning message.
39
+ - **Design 9**: `valid_expr` is now **explicitly passed** from `tl.py` into `run_permutation_test` (no more hidden reliance on adata.var after the fact).
40
+
41
+ ### Post-review hardening (2026-06-27)
42
+ - **Fragility fix (high)**: Added explicit schema validation + safe column access + clear warning in `_run_memento_de` for expected 'de_coef'/'de_pval' from memento.binary_test_1d. Prevents silent fallback (or crash) if upstream memento-de changes column names/structure. Updated optional dep pin to "memento-de>=0.1.0,<0.3.0".
43
+ - **Cleanup + consistency (high)**: `run_permutation_test` now owns the small-space FDR decision (use_fdr=False + disabled_reason="small_permutation_space" when n_perm < 100). Removed vestigial dead `if not perm_use_fdr` and useless max_perm check/assign in tl.py. `disabled_reason` (and `perm_disabled_reason`) now properly returned and stored in adata.uns["scatrans"] metadata.
44
+ - **Diagnostics improvement**: MixedLM per-gene fits now count genes hitting the neutral-except fallback (`n_genes_failed_fit`). Recorded in diagnostics["mixed_model"] (active_score) and DE metadata (differential_expression). Warning emitted when >0 so users are not unaware of silent neutral (delta_var=0, p=1) genes.
45
+ - Only confirmed high-impact issues from the review list were addressed; medium/nuance items (e.g. EB small-ref prior, advanced fallback diag completeness) were already mitigated by existing diagnostics/fallbacks or not correctness bugs.
46
+
47
+ All new issues addressed. Full test suite green.
48
+
49
+ ## [0.9.2] - 2026-06-20
50
+
51
+ ### Added / Changed
52
+ - `filter_active_genes` now accepts `logfc_direction="up"|"down"|"both"` (default remains `"up"` for backward compatibility and "active" semantics).
53
+ - `logfc_cutoff` is interpreted as a positive magnitude in all modes.
54
+ - `"down"`: selects logFC < -cutoff (downregulated genes from differential_expression results).
55
+ - `"both"`: selects |logFC| > cutoff.
56
+ - Sorting for pure-DE tables is now direction-aware (most-negative-first for down, largest |logFC| for both).
57
+ - This directly supports the common request for downregulated candidates in standalone DE workflows.
58
+ - Updated docstrings, tests, and examples.
59
+
8
60
  ## [0.9.0] - 2026-06-19
9
61
 
10
62
  ### Added
@@ -5,6 +5,7 @@
5
5
  include LICENSE
6
6
  include README.md
7
7
  include CHANGELOG.md
8
+ include CITATION.cff
8
9
  include pyproject.toml
9
10
 
10
11
  # Include the GitHub Actions workflows (requested)