scfair 0.5.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.
- scfair-0.5.0/.github/workflows/publish.yml +62 -0
- scfair-0.5.0/.github/workflows/tests.yml +119 -0
- scfair-0.5.0/.gitignore +71 -0
- scfair-0.5.0/.readthedocs.yaml +20 -0
- scfair-0.5.0/CHANGELOG.md +82 -0
- scfair-0.5.0/CITATION.cff +21 -0
- scfair-0.5.0/LICENSE +202 -0
- scfair-0.5.0/MANIFEST.in +51 -0
- scfair-0.5.0/PKG-INFO +121 -0
- scfair-0.5.0/README.md +78 -0
- scfair-0.5.0/SECURITY.md +31 -0
- scfair-0.5.0/docs/_static/css/custom.css +74 -0
- scfair-0.5.0/docs/api/index.md +39 -0
- scfair-0.5.0/docs/changelog.md +2 -0
- scfair-0.5.0/docs/conf.py +143 -0
- scfair-0.5.0/docs/faq.md +65 -0
- scfair-0.5.0/docs/index.md +64 -0
- scfair-0.5.0/docs/installation.md +64 -0
- scfair-0.5.0/docs/license.md +5 -0
- scfair-0.5.0/docs/quickstart.md +104 -0
- scfair-0.5.0/docs/requirements.txt +5 -0
- scfair-0.5.0/docs/tutorials/index.md +61 -0
- scfair-0.5.0/docs/tutorials/pbmc10k_hvg_compare.ipynb +812 -0
- scfair-0.5.0/docs/user_guide/index.md +40 -0
- scfair-0.5.0/docs/user_guide/method.md +86 -0
- scfair-0.5.0/docs/user_guide/outputs.md +47 -0
- scfair-0.5.0/docs/user_guide/parameters.md +86 -0
- scfair-0.5.0/examples/ablation_scale_logfc.py +244 -0
- scfair-0.5.0/examples/adt14_res_sweep.py +143 -0
- scfair-0.5.0/examples/adt_auto_k_protein_gold.py +371 -0
- scfair-0.5.0/examples/adt_crossval_shadowed.py +152 -0
- scfair-0.5.0/examples/adt_gold_benchmark.py +411 -0
- scfair-0.5.0/examples/adt_multi_validation.py +328 -0
- scfair-0.5.0/examples/adt_neighbor_contrast.py +85 -0
- scfair-0.5.0/examples/adt_resolution_check.py +179 -0
- scfair-0.5.0/examples/adt_tuning_sweep.py +150 -0
- scfair-0.5.0/examples/alpha_panel.py +156 -0
- scfair-0.5.0/examples/alpha_panel_cap_probe.py +177 -0
- scfair-0.5.0/examples/auto_n_benchmark.py +356 -0
- scfair-0.5.0/examples/auto_n_holdout_eval.py +475 -0
- scfair-0.5.0/examples/auto_n_k_inventory.py +241 -0
- scfair-0.5.0/examples/auto_n_populations.py +226 -0
- scfair-0.5.0/examples/auto_n_separability_probe.py +158 -0
- scfair-0.5.0/examples/auto_n_structure_solve.py +683 -0
- scfair-0.5.0/examples/auto_n_v2_benchmark.py +386 -0
- scfair-0.5.0/examples/auto_n_vote_spread.py +139 -0
- scfair-0.5.0/examples/blend_global_deprivation.py +180 -0
- scfair-0.5.0/examples/build_gold_panel_extra.py +191 -0
- scfair-0.5.0/examples/cap_allocation_validate.py +252 -0
- scfair-0.5.0/examples/cap_merge_threshold_calibration.py +128 -0
- scfair-0.5.0/examples/cap_merge_threshold_sweep_real.py +158 -0
- scfair-0.5.0/examples/cap_merge_validate.py +187 -0
- scfair-0.5.0/examples/cellbrf_style_benchmark.py +219 -0
- scfair-0.5.0/examples/cluster_pool_analysis.py +141 -0
- scfair-0.5.0/examples/cluster_pool_extend.py +118 -0
- scfair-0.5.0/examples/cluster_pool_panel.py +276 -0
- scfair-0.5.0/examples/cluster_pool_table.py +174 -0
- scfair-0.5.0/examples/coverage_allocation_panel.py +252 -0
- scfair-0.5.0/examples/crafted_recall_panel.py +513 -0
- scfair-0.5.0/examples/deficit_probe.py +195 -0
- scfair-0.5.0/examples/deprivation_topup.py +575 -0
- scfair-0.5.0/examples/duo_res_sweep.py +92 -0
- scfair-0.5.0/examples/final_comparison.py +198 -0
- scfair-0.5.0/examples/fine_gene_budget_probe.py +269 -0
- scfair-0.5.0/examples/fine_res_and_shortk_probe.py +350 -0
- scfair-0.5.0/examples/gold15_auto_k_exact_eval.py +136 -0
- scfair-0.5.0/examples/gold15_ksweep_missing.py +131 -0
- scfair-0.5.0/examples/gold_expansion_probe.py +189 -0
- scfair-0.5.0/examples/hard_task_benchmark.py +666 -0
- scfair-0.5.0/examples/hvg_baselines.py +222 -0
- scfair-0.5.0/examples/iterate_rounds.py +191 -0
- scfair-0.5.0/examples/l1_k_budget_panel.py +351 -0
- scfair-0.5.0/examples/merge_tolerant_metric.py +171 -0
- scfair-0.5.0/examples/mixhvg_comparison.py +250 -0
- scfair-0.5.0/examples/p1_multi_dataset_benchmark.py +397 -0
- scfair-0.5.0/examples/p2_benchmark.py +435 -0
- scfair-0.5.0/examples/p3_public_validation.py +420 -0
- scfair-0.5.0/examples/paper_extra_metrics.py +527 -0
- scfair-0.5.0/examples/pbmc3k_benchmark.py +212 -0
- scfair-0.5.0/examples/pool_comparison.py +334 -0
- scfair-0.5.0/examples/quota_allocation.py +350 -0
- scfair-0.5.0/examples/run_alpha_panel.sh +9 -0
- scfair-0.5.0/examples/run_followups.sh +12 -0
- scfair-0.5.0/examples/signal_hunt.py +180 -0
- scfair-0.5.0/examples/sorted_gold_panel.py +422 -0
- scfair-0.5.0/examples/split_support_probe.py +163 -0
- scfair-0.5.0/examples/structure_vs_scanpy_probe.py +181 -0
- scfair-0.5.0/examples/umap3d_bestk_probe.py +472 -0
- scfair-0.5.0/examples/umap3d_cores.py +314 -0
- scfair-0.5.0/examples/umap3d_knn_density.py +159 -0
- scfair-0.5.0/examples/umap3d_sensitivity.py +136 -0
- scfair-0.5.0/examples/umap3d_smoke.py +184 -0
- scfair-0.5.0/examples/unit_boundary_probe.py +329 -0
- scfair-0.5.0/examples/unit_spec_panel.py +267 -0
- scfair-0.5.0/examples/v4_alpha_sweep.py +173 -0
- scfair-0.5.0/examples/v4_consensus_alpha.py +175 -0
- scfair-0.5.0/examples/v4_deficit_dissect.py +234 -0
- scfair-0.5.0/examples/zheng_k_sweep_probe.py +199 -0
- scfair-0.5.0/pyproject.toml +109 -0
- scfair-0.5.0/setup.cfg +4 -0
- scfair-0.5.0/src/scfair/__init__.py +25 -0
- scfair-0.5.0/src/scfair/_utils.py +287 -0
- scfair-0.5.0/src/scfair/_version.py +21 -0
- scfair-0.5.0/src/scfair/pp/__init__.py +43 -0
- scfair-0.5.0/src/scfair/pp/_auto_n.py +1842 -0
- scfair-0.5.0/src/scfair/pp/_diagnosis.py +1345 -0
- scfair-0.5.0/src/scfair/pp/_granularity.py +659 -0
- scfair-0.5.0/src/scfair/pp/_highly_variable_genes.py +4922 -0
- scfair-0.5.0/src/scfair/pp/_options.py +215 -0
- scfair-0.5.0/src/scfair/pp/_raw_counts.py +502 -0
- scfair-0.5.0/src/scfair/py.typed +0 -0
- scfair-0.5.0/src/scfair.egg-info/SOURCES.txt +116 -0
- scfair-0.5.0/tests/conftest.py +30 -0
- scfair-0.5.0/tests/test_auto_n.py +898 -0
- scfair-0.5.0/tests/test_diagnosis.py +485 -0
- scfair-0.5.0/tests/test_granularity.py +235 -0
- scfair-0.5.0/tests/test_highly_variable_genes.py +2435 -0
- scfair-0.5.0/tests/test_rare_marker_recovery.py +323 -0
- scfair-0.5.0/tests/test_raw_counts.py +389 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Manual only — creating a GitHub Release / tag does NOT upload to PyPI.
|
|
4
|
+
# Publish via: Actions → "Publish to PyPI" → Run workflow
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: publish-pypi-${{ github.run_id }}
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Build distribution 📦
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
|
|
24
|
+
- name: Install build tools
|
|
25
|
+
run: python -m pip install --upgrade build
|
|
26
|
+
|
|
27
|
+
- name: Build source and wheel distributions
|
|
28
|
+
# Version is read from src/scfair/_version.py (single source of truth).
|
|
29
|
+
run: python -m build
|
|
30
|
+
|
|
31
|
+
- name: Upload distribution artifacts
|
|
32
|
+
uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: python-package-distributions
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
publish:
|
|
38
|
+
name: Publish to PyPI
|
|
39
|
+
needs: build
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
|
|
42
|
+
# Trusted Publishing (OIDC). Configure the "pypi" environment in repo
|
|
43
|
+
# Settings → Environments with required reviewers before first publish.
|
|
44
|
+
permissions:
|
|
45
|
+
id-token: write
|
|
46
|
+
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: Download all dists
|
|
52
|
+
uses: actions/download-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: python-package-distributions
|
|
55
|
+
path: dist/
|
|
56
|
+
|
|
57
|
+
- name: Publish distribution 📦 to PyPI
|
|
58
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
59
|
+
# For publishing to TestPyPI instead (for testing the workflow):
|
|
60
|
+
# with:
|
|
61
|
+
# repository-url: https://test.pypi.org/legacy/
|
|
62
|
+
# verbose: true
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
# Must stay in sync with requires-python in pyproject.toml (">=3.10").
|
|
21
|
+
# 3.9 was dropped rather than left declared-but-untested: recent scanpy
|
|
22
|
+
# releases no longer support it, so a 3.9 job would have pinned an old
|
|
23
|
+
# scanpy and tested a configuration nobody runs.
|
|
24
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
cache: pip
|
|
33
|
+
cache-dependency-path: pyproject.toml
|
|
34
|
+
|
|
35
|
+
- name: Install
|
|
36
|
+
run: |
|
|
37
|
+
python -m pip install --upgrade pip
|
|
38
|
+
pip install -e ".[dev]"
|
|
39
|
+
|
|
40
|
+
- name: Import check
|
|
41
|
+
# Catches a missing runtime dependency that the test suite might mask by
|
|
42
|
+
# importing something else first.
|
|
43
|
+
run: python -c "import scfair; print(scfair.__version__)"
|
|
44
|
+
|
|
45
|
+
- name: Leiden backend check
|
|
46
|
+
# Every balanced method needs sc.tl.leiden(flavor="igraph"). This failed
|
|
47
|
+
# once because igraph was not a declared dependency.
|
|
48
|
+
run: python -c "import igraph; print('igraph', igraph.__version__)"
|
|
49
|
+
|
|
50
|
+
- name: Direct sklearn / skmisc import check
|
|
51
|
+
# Function-local imports; package import alone does not exercise them.
|
|
52
|
+
run: |
|
|
53
|
+
python -c "import sklearn; from sklearn.cluster import KMeans; from sklearn.metrics import adjusted_rand_score; print('sklearn', sklearn.__version__)"
|
|
54
|
+
python -c "from skmisc.loess import loess; print('skmisc loess OK')"
|
|
55
|
+
|
|
56
|
+
- name: Tests
|
|
57
|
+
run: pytest -q --cov=scfair --cov-report=term-missing
|
|
58
|
+
|
|
59
|
+
min-versions:
|
|
60
|
+
# Installs the exact floors declared in pyproject.toml and runs the suite
|
|
61
|
+
# against them. Without this the floors are assertions, not facts — and two of
|
|
62
|
+
# them were wrong before this job existed: `scanpy>=1.9` could not run
|
|
63
|
+
# sc.tl.leiden(flavor="igraph") at all (1.10+ only), and `scikit-misc` was
|
|
64
|
+
# missing entirely while being required by the default flavor="seurat_v3".
|
|
65
|
+
# If this job fails, raise the floor in pyproject.toml — do not delete the job.
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v4
|
|
69
|
+
- uses: actions/setup-python@v5
|
|
70
|
+
with:
|
|
71
|
+
python-version: "3.10"
|
|
72
|
+
- name: Install declared floors
|
|
73
|
+
run: |
|
|
74
|
+
python -m pip install --upgrade pip
|
|
75
|
+
pip install \
|
|
76
|
+
"anndata==0.10.*" "numpy==1.24.*" "pandas==2.0.*" \
|
|
77
|
+
"scanpy==1.10.*" "scipy==1.10.*" "igraph==0.10.*" \
|
|
78
|
+
"scikit-misc==0.3.*" "scikit-learn==1.2.*"
|
|
79
|
+
pip install --no-deps -e .
|
|
80
|
+
pip install "pytest>=7.0" "pytest-cov>=4.0"
|
|
81
|
+
- name: Show resolved versions
|
|
82
|
+
run: pip list | grep -Ei "anndata|scanpy|numpy|pandas|scipy|igraph|scikit-misc|scikit-learn"
|
|
83
|
+
- name: seurat_v3 must really be available at the floor
|
|
84
|
+
# scFair falls back to flavor="seurat" if seurat_v3 raises, so a missing
|
|
85
|
+
# skmisc would look like a pass. Assert the real path is reachable.
|
|
86
|
+
run: python -c "from skmisc.loess import loess; print('skmisc loess OK')"
|
|
87
|
+
- name: Leiden flavor must exist at the floor
|
|
88
|
+
run: |
|
|
89
|
+
python -c "
|
|
90
|
+
import inspect, scanpy as sc
|
|
91
|
+
assert 'flavor' in inspect.signature(sc.tl.leiden).parameters, \
|
|
92
|
+
'sc.tl.leiden lacks flavor= at the declared scanpy floor'
|
|
93
|
+
print('leiden flavor OK')"
|
|
94
|
+
- name: Tests
|
|
95
|
+
run: pytest -q
|
|
96
|
+
|
|
97
|
+
lint:
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
steps:
|
|
100
|
+
- uses: actions/checkout@v4
|
|
101
|
+
- uses: actions/setup-python@v5
|
|
102
|
+
with:
|
|
103
|
+
python-version: "3.12"
|
|
104
|
+
cache: pip
|
|
105
|
+
cache-dependency-path: pyproject.toml
|
|
106
|
+
# Pin ruff major.minor: unpinned installs pick latest defaults and break
|
|
107
|
+
# lint when the rule set expands. Rule set is also explicit in pyproject.toml.
|
|
108
|
+
- run: pip install "ruff>=0.4.0,<0.17"
|
|
109
|
+
# examples/ is optional in slim checkouts / release zips; only lint if present.
|
|
110
|
+
- run: |
|
|
111
|
+
if [ -d examples ]; then
|
|
112
|
+
ruff check src tests examples
|
|
113
|
+
else
|
|
114
|
+
ruff check src tests
|
|
115
|
+
fi
|
|
116
|
+
# `ruff format --check` is deliberately NOT gated yet: the existing source
|
|
117
|
+
# predates the formatter and enforcing it would mean a repo-wide reformat.
|
|
118
|
+
# To adopt it, run `ruff format src tests` once, review that diff on its
|
|
119
|
+
# own, then add the check here.
|
scfair-0.5.0/.gitignore
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# --- Python ---
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
*.egg
|
|
6
|
+
.eggs/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.mypy_cache/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
.coverage
|
|
13
|
+
coverage.xml
|
|
14
|
+
htmlcov/
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
.ipynb_checkpoints/
|
|
18
|
+
|
|
19
|
+
# --- Third-party datasets: never committed, cited instead ---
|
|
20
|
+
# These come from 10x Genomics, CELLxGENE, figshare/scIB, Zenodo (Zhao et al.
|
|
21
|
+
# 2025), CraftedExperiment (Liu et al. 2025) and CellBRF. We have no right to
|
|
22
|
+
# redistribute them, several files exceed GitHub's 100 MB per-file limit, and the
|
|
23
|
+
# tree is ~5.6 GB. Sources and accessions: docs/DATA_SOURCES.md
|
|
24
|
+
data/
|
|
25
|
+
examples/data/
|
|
26
|
+
|
|
27
|
+
# Belt and braces: raw matrix / archive formats anywhere in the tree.
|
|
28
|
+
*.h5ad
|
|
29
|
+
*.h5
|
|
30
|
+
*.rds
|
|
31
|
+
*.RData
|
|
32
|
+
*.mtx
|
|
33
|
+
*.mtx.gz
|
|
34
|
+
*.loom
|
|
35
|
+
*.zip
|
|
36
|
+
*.tar
|
|
37
|
+
*.tar.gz
|
|
38
|
+
*.tgz
|
|
39
|
+
*.txt.gz
|
|
40
|
+
*.csv.gz
|
|
41
|
+
*.xlsx
|
|
42
|
+
|
|
43
|
+
# --- Locally generated outputs: not committed ---
|
|
44
|
+
# Every table, figure and log under here is produced by the benchmark scripts.
|
|
45
|
+
examples/results/
|
|
46
|
+
|
|
47
|
+
# --- Local research notes (not part of the public docs site / release) ---
|
|
48
|
+
# Keep on disk for development; do not publish to GitHub / RTD / PyPI sdist.
|
|
49
|
+
docs/PAPER_*
|
|
50
|
+
docs/DEVELOPMENT_LOG.md
|
|
51
|
+
docs/PACKAGE_VALUE.md
|
|
52
|
+
docs/gold.md
|
|
53
|
+
docs/review.md
|
|
54
|
+
docs/AUTO_N_*
|
|
55
|
+
docs/CELLBRF_*
|
|
56
|
+
docs/DATA_SOURCES.md
|
|
57
|
+
docs/**/*.csv
|
|
58
|
+
|
|
59
|
+
# Sphinx build products
|
|
60
|
+
docs/_build/
|
|
61
|
+
docs/api/generated/
|
|
62
|
+
|
|
63
|
+
# --- Editors / OS ---
|
|
64
|
+
.DS_Store
|
|
65
|
+
*.swp
|
|
66
|
+
*~
|
|
67
|
+
.idea/
|
|
68
|
+
.vscode/
|
|
69
|
+
|
|
70
|
+
# Claude Code harness internals
|
|
71
|
+
.claude/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# .readthedocs.yaml
|
|
2
|
+
# Read the Docs configuration file
|
|
3
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
4
|
+
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
build:
|
|
8
|
+
os: ubuntu-22.04
|
|
9
|
+
tools:
|
|
10
|
+
python: "3.11"
|
|
11
|
+
|
|
12
|
+
sphinx:
|
|
13
|
+
configuration: docs/conf.py
|
|
14
|
+
fail_on_warning: false
|
|
15
|
+
|
|
16
|
+
python:
|
|
17
|
+
install:
|
|
18
|
+
- requirements: docs/requirements.txt
|
|
19
|
+
- method: pip
|
|
20
|
+
path: .
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
Versions follow [Semantic Versioning](https://semver.org/). While the package
|
|
7
|
+
is in the `0.x` series, defaults may still change in a minor release when new
|
|
8
|
+
evidence warrants it.
|
|
9
|
+
|
|
10
|
+
## [0.5.0] - 2026-08-02
|
|
11
|
+
|
|
12
|
+
First public release prepared for PyPI and Read the Docs.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `scfair.pp.highly_variable_genes` — fair / balanced HVG selection with a short
|
|
17
|
+
product surface and optional research knobs via `HVGOptions`.
|
|
18
|
+
- Default `balance_method="append"`: freeze the global top-`k` list, then
|
|
19
|
+
append the next `append_budget` genes from the same ranking (default 200).
|
|
20
|
+
- `balance_method="none"` reproduces a single global scanpy-style pass.
|
|
21
|
+
- Opt-in cluster-aware methods: `hybrid`, `score`, `reweight`.
|
|
22
|
+
- `n_top_genes="auto"` (structure-aware) and product `mode` presets
|
|
23
|
+
(`compact` / `balanced` / `fine`, or `mode="auto"`).
|
|
24
|
+
- `scfair.pp.HVGOptions` — secondary controls (append budget, clustering pool,
|
|
25
|
+
neighbor contrast, raw-count snapshot policy, and related fields).
|
|
26
|
+
- `scfair.pp.diagnose_from_labels` — pre-call imbalance tips from known labels
|
|
27
|
+
(does not run HVG).
|
|
28
|
+
- `scfair.pp.estimate_n_populations` — label-free estimate of how many
|
|
29
|
+
populations a density field supports (advisory).
|
|
30
|
+
- Downstream helpers: `recommend_cluster_resolution`,
|
|
31
|
+
`resolve_cluster_resolution`, `resolve_hvg_mode`, and structure-based auto-`k`
|
|
32
|
+
utilities under `scfair.pp`.
|
|
33
|
+
- Sphinx documentation (installation, quickstart, user guide, API, FAQ,
|
|
34
|
+
changelog) and a PBMC 10k tutorial comparing standard HVG with scFair.
|
|
35
|
+
- CI matrix for Python 3.10–3.12, a min-versions job for declared dependency
|
|
36
|
+
floors, and a manual PyPI publish workflow (Trusted Publishing).
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- Default path is append-on-global-rank (no intermediate clustering). Final
|
|
41
|
+
list size is `n_top_genes + append_budget`, capped at `n_vars`.
|
|
42
|
+
- Intermediate clustering (when used) scales genes before PCA by default
|
|
43
|
+
(`HVGOptions.scale_clustering=True`).
|
|
44
|
+
- Structure auto-`k` applies a soft buffer and an anti-SHORT floor when density
|
|
45
|
+
confidence is low, so under-powered short lists are less common on large,
|
|
46
|
+
multi-type PBMCs.
|
|
47
|
+
- Non-selected genes use `NaN` in `var["highly_variable_rank"]` (scanpy
|
|
48
|
+
seurat_v3 convention).
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- Count-layer handling no longer overwrites a user `layers["counts"]` when it
|
|
53
|
+
disagrees with integer `.X`; staging uses an internal layer and is cleaned up
|
|
54
|
+
after the call.
|
|
55
|
+
- Repeated HVG calls on the same object do not leak scanpy score columns or
|
|
56
|
+
redirect later default calls to a previous `layer=`.
|
|
57
|
+
- Explicit `append_budget` (including `0`) is never replaced by mode defaults.
|
|
58
|
+
- seurat_v3 loess path falls back on tiny gene sets before a hard crash.
|
|
59
|
+
- Empty or all-zero counts raise a clear error before PCA.
|
|
60
|
+
- Ribosomal filter no longer matches kinase names such as `RPS6KA*`.
|
|
61
|
+
- Failed HVG runs roll back partial `var` HVG columns and record
|
|
62
|
+
`uns["scfair"]["hvg_failed"]`.
|
|
63
|
+
|
|
64
|
+
### Documentation
|
|
65
|
+
|
|
66
|
+
- README oriented for PyPI / GitHub (install, first run, status).
|
|
67
|
+
- User-facing docs in American English; research notes and paper tables stay
|
|
68
|
+
local and are not part of the published documentation tree.
|
|
69
|
+
|
|
70
|
+
## [0.3.0] - 2026-08-01
|
|
71
|
+
|
|
72
|
+
Internal pre-release: API hygiene, structure auto-`k` anti-SHORT floor, scaled
|
|
73
|
+
intermediate PCA, and reliability fixes for empty counts and filter rules.
|
|
74
|
+
|
|
75
|
+
## [0.2.0] - 2026-08-01
|
|
76
|
+
|
|
77
|
+
Internal pre-release: product default moved to append, `HVGOptions` introduced,
|
|
78
|
+
and the experimental `cap` allocation path removed.
|
|
79
|
+
|
|
80
|
+
## [0.1.0] - 2026-07-29
|
|
81
|
+
|
|
82
|
+
Initial private package scaffold and core HVG entry point.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: "scFair: Fair highly variable gene selection for single-cell RNA-seq"
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the metadata below.
|
|
5
|
+
type: software
|
|
6
|
+
authors:
|
|
7
|
+
# Display form used elsewhere: Zhao Li (李钊)
|
|
8
|
+
- family-names: "Li"
|
|
9
|
+
given-names: "Zhao (李钊)"
|
|
10
|
+
email: "leelieber@gmail.com"
|
|
11
|
+
repository-code: "https://github.com/leelieber2025/scFair"
|
|
12
|
+
url: "https://github.com/leelieber2025/scFair"
|
|
13
|
+
license: Apache-2.0
|
|
14
|
+
version: 0.5.0
|
|
15
|
+
keywords:
|
|
16
|
+
- single-cell
|
|
17
|
+
- RNA-seq
|
|
18
|
+
- HVG
|
|
19
|
+
- highly variable genes
|
|
20
|
+
- fairness
|
|
21
|
+
- bioinformatics
|
scfair-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Zhao Li (李钊)
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
scfair-0.5.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Source distribution (sdist) contents for PyPI / GitHub source installs.
|
|
2
|
+
# The wheel only ships the runtime package (src/scfair + package data).
|
|
3
|
+
|
|
4
|
+
include LICENSE
|
|
5
|
+
include README.md
|
|
6
|
+
include CHANGELOG.md
|
|
7
|
+
include SECURITY.md
|
|
8
|
+
include CITATION.cff
|
|
9
|
+
include pyproject.toml
|
|
10
|
+
include MANIFEST.in
|
|
11
|
+
include .gitignore
|
|
12
|
+
include .readthedocs.yaml
|
|
13
|
+
|
|
14
|
+
graft tests
|
|
15
|
+
graft docs
|
|
16
|
+
prune docs/_build
|
|
17
|
+
# Local research notes and paper tables are not part of the public docs site.
|
|
18
|
+
global-exclude docs/PAPER_*
|
|
19
|
+
global-exclude docs/DEVELOPMENT_LOG.md
|
|
20
|
+
global-exclude docs/PACKAGE_VALUE.md
|
|
21
|
+
global-exclude docs/gold.md
|
|
22
|
+
global-exclude docs/review.md
|
|
23
|
+
global-exclude docs/AUTO_N_*
|
|
24
|
+
global-exclude docs/CELLBRF_*
|
|
25
|
+
global-exclude docs/DATA_SOURCES.md
|
|
26
|
+
|
|
27
|
+
graft examples
|
|
28
|
+
# Never ship large or regenerable example outputs / data
|
|
29
|
+
prune examples/data
|
|
30
|
+
prune examples/results
|
|
31
|
+
global-exclude examples/**/__pycache__/*
|
|
32
|
+
|
|
33
|
+
graft .github/workflows
|
|
34
|
+
|
|
35
|
+
recursive-exclude src/scfair.egg-info *
|
|
36
|
+
prune build
|
|
37
|
+
prune dist
|
|
38
|
+
prune data
|
|
39
|
+
prune .git
|
|
40
|
+
prune .mypy_cache
|
|
41
|
+
prune .pytest_cache
|
|
42
|
+
prune .ruff_cache
|
|
43
|
+
prune .tox
|
|
44
|
+
prune htmlcov
|
|
45
|
+
global-exclude *.pyc
|
|
46
|
+
global-exclude __pycache__/*
|
|
47
|
+
global-exclude *.egg-info
|
|
48
|
+
global-exclude *.egg-info/*
|
|
49
|
+
global-exclude *.h5ad
|
|
50
|
+
global-exclude *.zip
|
|
51
|
+
global-exclude .DS_Store
|