annotuneagent 0.1.5__tar.gz → 0.1.6__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 (77) hide show
  1. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/CHANGELOG.md +38 -0
  2. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/CITATION.cff +4 -6
  3. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/PKG-INFO +39 -34
  4. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/README.md +37 -32
  5. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/api/index.md +0 -1
  6. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/index.md +15 -15
  7. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/installation.md +3 -3
  8. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/quickstart.md +28 -28
  9. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/tutorials/gse266598_annotation.ipynb +25 -19
  10. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/tutorials/index.md +5 -5
  11. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/tutorials/load_model.ipynb +17 -16
  12. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/tutorials/pbmc8k_annotation.ipynb +7 -3
  13. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/tutorials/report.md +17 -20
  14. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/pyproject.toml +1 -1
  15. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/__init__.py +17 -19
  16. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/_version.py +1 -1
  17. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/cli.py +16 -10
  18. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/decide.py +68 -10
  19. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/local_lora.py +63 -39
  20. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/markers.tsv +431 -387
  21. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/ontology/ontology_map.jsonl +27 -0
  22. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/workflow.py +355 -212
  23. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_bugfixes_1111.py +3 -2
  24. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_cli.py +10 -28
  25. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_decide.py +79 -0
  26. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_local_lora.py +7 -6
  27. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_markers.py +10 -5
  28. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_version.py +2 -2
  29. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_workflow.py +85 -89
  30. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/.github/workflows/publish.yml +0 -0
  31. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/.github/workflows/tests.yml +0 -0
  32. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/.gitignore +0 -0
  33. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/.readthedocs.yaml +0 -0
  34. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/LICENSE +0 -0
  35. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/MANIFEST.in +0 -0
  36. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/SECURITY.md +0 -0
  37. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/_static/css/custom.css +0 -0
  38. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/_templates/README.md +0 -0
  39. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/conf.py +0 -0
  40. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/marker_sources.md +0 -0
  41. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/docs/requirements.txt +0 -0
  42. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/setup.cfg +0 -0
  43. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/__main__.py +0 -0
  44. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/annotate.py +0 -0
  45. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/arbitrate.py +0 -0
  46. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/evaluate.py +0 -0
  47. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/evidence.py +0 -0
  48. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/geo.py +0 -0
  49. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/granularity/__init__.py +0 -0
  50. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/granularity/cl_dag.py +0 -0
  51. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/granularity/ontology_map.py +0 -0
  52. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/granularity/relations.py +0 -0
  53. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/hypotheses.py +0 -0
  54. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/marker_plot.py +0 -0
  55. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/markers.py +0 -0
  56. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/mltools.py +0 -0
  57. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/ontology/cl_isa.json +0 -0
  58. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/ontology/granularity_policy.yaml +0 -0
  59. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/prepare.py +0 -0
  60. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/py.typed +0 -0
  61. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/read.py +0 -0
  62. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/tokenizer/LICENSE +0 -0
  63. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/tokenizer/merges.txt +0 -0
  64. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/tokenizer/tokenizer.json +0 -0
  65. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/tokenizer/tokenizer_config.json +0 -0
  66. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/tokenizer/vocab.json +0 -0
  67. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent/votes.py +0 -0
  68. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/src/annotuneagent.egg-info/SOURCES.txt +0 -0
  69. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_annotate.py +0 -0
  70. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_evaluate.py +0 -0
  71. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_evidence.py +0 -0
  72. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_geo.py +0 -0
  73. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_granularity.py +0 -0
  74. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_mltools.py +0 -0
  75. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_prepare.py +0 -0
  76. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_read.py +0 -0
  77. {annotuneagent-0.1.5 → annotuneagent-0.1.6}/tests/test_votes.py +0 -0
@@ -2,6 +2,44 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ## [0.1.6] - 2026-11-19
8
+
9
+ ### Changed
10
+
11
+ - `run` calls the name model only. The check rule keeps that name, replaces
12
+ it with the one other supported candidate, or drops it. A supporting marker
13
+ has logfc above 0.5 and pct_in of at least 0.25. A blocking negative has
14
+ pct_in of at least 0.25 and logfc of at least 1. A cluster whose name the
15
+ check rule accepted is not split.
16
+ - The name prompt lists the top 35 Wilcoxon genes. An enriched support gene
17
+ is appended only after a positive marker already qualifies. Low or
18
+ undetected genes stay out.
19
+ - The name weight is one merged GGUF,
20
+ `Qwen3.5-4B-annotune-v9k-name.Q6_K.gguf`. Pass it as `TaskEndpoint(base=...)`
21
+ or `--base`. The server context for that call is 2048.
22
+ - `adata` gains `annotune_label`, and `annotune_sub` only when a cluster
23
+ stays split. Status, hints, and merged cluster ids stay on the report.
24
+ - `write_h5ad` is no longer part of the public API. `--output-h5ad` still
25
+ writes the file and stores the QC report as JSON.
26
+ - The marker dictionary adds rare types, including plasmablast,
27
+ myofibroblast, BEST4+ enterocyte, mouse ILC1, muscle fiber subtypes,
28
+ bone-marrow stroma, juxtaglomerular cells, urothelial basal and umbrella
29
+ cells, spermatogenic stages, mammary luminal subsets, adrenal zones,
30
+ decidual stroma, mouse trophoblast, and thymic epithelium. Human prostate
31
+ luminal cells use ACP3. Human non-peptidergic nociceptors no longer treat
32
+ CALCA as a negative. Mouse corneal epithelium uses Krt12 and Krt5.
33
+ Colonocyte keeps CL:1000347.
34
+
35
+ ### Fixed
36
+
37
+ - A cluster removed as `ribosomal genes only` still prints its enriched-gene
38
+ paragraph.
39
+ - A later split can write `parent.child` ids after the subcluster column has
40
+ been turned into a categorical.
41
+ - Subcluster PCA on a sparse matrix uses `arpack`.
42
+
5
43
  ## [0.1.5] - 2026-11-17
6
44
 
7
45
  ### Changed
@@ -4,11 +4,9 @@ message: >-
4
4
  If you use this software, please cite the software record below and pin
5
5
  the package version used in the analysis.
6
6
  abstract: >-
7
- Collects a marker score, a name-model result, and an ML-model result for
8
- each cluster. A judgment reads the three results and writes the title.
9
- The title is a dictionary name. The name model reads dictionary marker
10
- hits. The ML model is trained on differential expression and marker-panel
11
- statistics.
7
+ Collects a marker score and a name-model result for each cluster. A check
8
+ rule keeps that name, replaces it, or drops it. The title is a dictionary
9
+ name. The name model reads dictionary marker hits.
12
10
  type: software
13
11
  authors:
14
12
  - family-names: "Li"
@@ -17,7 +15,7 @@ authors:
17
15
  orcid: "https://orcid.org/0000-0002-9276-9129"
18
16
  repository-code: "https://github.com/leelieber2025/AnnoTuneAgent"
19
17
  license: Apache-2.0
20
- version: 0.1.5
18
+ version: 0.1.6
21
19
  date-released: "2026-11-17"
22
20
  keywords:
23
21
  - single-cell
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annotuneagent
3
- Version: 0.1.5
4
- Summary: Cluster-level cell-type annotation from marker, name, and ML results
3
+ Version: 0.1.6
4
+ Summary: Cluster-level cell-type annotation from a marker score and a name model
5
5
  Author-email: "Zhao Li (李钊)" <leelieber@gmail.com>
6
6
  License-Expression: Apache-2.0
7
7
  Project-URL: Homepage, https://github.com/leelieber2025/AnnoTuneAgent
@@ -64,29 +64,33 @@ Dynamic: license-file
64
64
 
65
65
  Documentation: [Read the Docs](https://annotuneagent.readthedocs.io/en/latest/).
66
66
 
67
- **Cluster-level cell-type annotation for single-cell RNA-seq, with two
68
- fine-tuned language models that run locally.**
67
+ **Cluster-level cell-type annotation for single-cell RNA-seq. One fine-tuned
68
+ language model runs locally, and a check rule reads the marker measurements.**
69
69
 
70
- Each cluster gets a marker score, a name-model result, and an ML-model
71
- result. A rule-based judgment reads all three and writes the title, so every
72
- call stays auditable.
70
+ Each cluster gets a marker score and a name-model result. The check rule
71
+ keeps that name, replaces it, or drops it. The marker score can still name
72
+ the cluster when the check drops the proposal. Every call stays auditable.
73
73
 
74
74
  ## What is fine-tuned
75
75
 
76
- One Qwen3.5-4B base (Q6_K GGUF) is shared by two independent LoRA adapters.
77
- The adapters are not merged into the base, so they load together on a single
78
- local `llama-server` and can be replaced without touching the base. If that
79
- server was started with `--api-key`, set `ANNOTUNE_API_KEY`. The same value
80
- is sent as a bearer token.
76
+ The current name model is one Q6_K GGUF,
77
+ `Qwen3.5-4B-annotune-v9k-name.Q6_K.gguf`. It is loaded with `-m` and no
78
+ LoRA. If that server was started with `--api-key`, set `ANNOTUNE_API_KEY`.
79
+ The same value is sent as a bearer token.
81
80
 
82
- | Model | Task it was fine-tuned for | Input | Output |
81
+ | Step | What it does | Input | Output |
83
82
  | --- | --- | --- | --- |
84
- | **name** | Choose a cell-type name from the marker dictionary | Cluster marker evidence and `dictionary_hits` | A name copied from `dictionary_hits` when that type's markers support the cluster |
85
- | **ML** | Choose a name from measured cluster statistics | Differential expression, candidate marker panels, log fold change, fraction of cells expressing each gene inside and outside the cluster, panel summaries | A name copied from those candidates |
86
-
87
- Both models are trained to **copy** a name from the candidates they are
88
- shown, not to free-write one. A name outside the candidate list cannot become
89
- a title, and a name with no marker that passes expression and specificity
83
+ | **name** | Choose a cell-type name from the marker dictionary | Cluster marker evidence and `dictionary_hits` | A name copied from `dictionary_hits` |
84
+ | **check** | A fixed rule, not a model | The proposed name and each candidate's marker measurements | Keep the name, replace it with the one supported candidate, or drop it |
85
+
86
+ The name model is trained to **copy** a name from `dictionary_hits`, not to
87
+ free-write one. A positive marker supports a type when its log fold change is
88
+ above 0.5 and it is detected in at least 25% of the cluster. A negative
89
+ marker blocks a type only when it is that common and its log fold change is
90
+ at least 1. The proposal stays when at least two markers support it and none
91
+ block it. It is replaced only when it is not supported and exactly one other
92
+ candidate is. Otherwise it is dropped, and the marker score can still name
93
+ the cluster. A name with no marker that passes expression and specificity
90
94
  validation is flagged (`no_marker_passed`) instead of being trusted silently.
91
95
 
92
96
  The weights are on the Hugging Face Hub:
@@ -99,26 +103,26 @@ The weights are on the Hugging Face Hub:
99
103
  raw counts ─ prepare ─▶ QC, doublets, normalization, batch correction, Leiden
100
104
  ─ run ─────▶ per cluster:
101
105
  1. marker score (built-in human / mouse dictionary)
102
- 2. name model (LoRA, copies from dictionary_hits)
103
- 3. ML model (LoRA, copies from measured candidates)
106
+ 2. name model (one GGUF, copies from dictionary_hits)
107
+ 3. check rule (keeps, replaces, or drops that name)
104
108
  ▼
105
- judgment ─▶ title + status + reason + hint
109
+ title + status + reason + hint
106
110
  ▼
107
111
  validated marker panels, dotplot, report, annotated h5ad
108
112
  ```
109
113
 
110
- - **Judgment, not voting.** Agreement among the three results gives a clear
111
- title. Disagreement, mixed programs, and unvalidated names are kept and
112
- flagged with a reason (`mixed_programs`, `near_clear_cluster`,
113
- `subcluster_labels`, `no_marker_passed`) so you can review them.
114
+ - **A rule, not a second model.** The check reads the measurements. It does
115
+ not call another adapter. Mixed programs and unvalidated names stay flagged
116
+ (`mixed_programs`, `near_clear_cluster`, `subcluster_labels`,
117
+ `no_marker_passed`, `check_rule`) so you can review them.
114
118
  - **Marker evidence is checked, not quoted.** Panels are selected from cited
115
119
  dictionary markers and validated against measured expression and
116
120
  specificity in your data.
117
- - **Every title is traceable.** The report records each model's answer, the
118
- panel, and the reason a cluster was or was not settled.
121
+ - **Every title is traceable.** The report records the name-model answer, the
122
+ check result, the panel, and the reason a cluster was or was not settled.
119
123
 
120
- The models run when `models` is passed (or the CLI adapter flags are given).
121
- Without them, `run` uses the marker score alone.
124
+ The name model runs when `models` is passed (or `--name-adapter` / `--name-url`
125
+ is given). Without it, `run` uses the marker score alone.
122
126
 
123
127
  ## Install
124
128
 
@@ -210,20 +214,21 @@ annotuneagent \
210
214
  --output result.json
211
215
  ```
212
216
 
213
- `--name-adapter`, `--ml-adapter`, and `--base` run the name and ML models on
214
- one local server and require `--output-h5ad`. The weights are on the Hugging
217
+ `--base` with the merged GGUF runs the name model on one local server and
218
+ requires `--output-h5ad`. The check rule then reads the marker measurements.
219
+ The weights are on the Hugging
215
220
  Face Hub: [lieberlee/annotune-qwen3.5-4b-gguf](https://huggingface.co/lieberlee/annotune-qwen3.5-4b-gguf).
216
221
  The tokenizer is installed with the package. See
217
222
  [docs/tutorials/load_model.ipynb](docs/tutorials/load_model.ipynb).
218
223
 
219
224
  ## Status
220
225
 
221
- **0.1.5 (Alpha).** Import as `import annotuneagent as ata`.
226
+ **0.1.6 (Alpha).** Import as `import annotuneagent as ata`.
222
227
 
223
228
  ## Citation
224
229
 
225
230
  For the software record, cite the [Zenodo DOI](https://doi.org/10.5281/zenodo.24092828).
226
- Pin the package version used in the analysis, for example `annotuneagent==0.1.5`.
231
+ Pin the package version used in the analysis, for example `annotuneagent==0.1.6`.
227
232
 
228
233
  ## License
229
234
 
@@ -10,29 +10,33 @@
10
10
 
11
11
  Documentation: [Read the Docs](https://annotuneagent.readthedocs.io/en/latest/).
12
12
 
13
- **Cluster-level cell-type annotation for single-cell RNA-seq, with two
14
- fine-tuned language models that run locally.**
13
+ **Cluster-level cell-type annotation for single-cell RNA-seq. One fine-tuned
14
+ language model runs locally, and a check rule reads the marker measurements.**
15
15
 
16
- Each cluster gets a marker score, a name-model result, and an ML-model
17
- result. A rule-based judgment reads all three and writes the title, so every
18
- call stays auditable.
16
+ Each cluster gets a marker score and a name-model result. The check rule
17
+ keeps that name, replaces it, or drops it. The marker score can still name
18
+ the cluster when the check drops the proposal. Every call stays auditable.
19
19
 
20
20
  ## What is fine-tuned
21
21
 
22
- One Qwen3.5-4B base (Q6_K GGUF) is shared by two independent LoRA adapters.
23
- The adapters are not merged into the base, so they load together on a single
24
- local `llama-server` and can be replaced without touching the base. If that
25
- server was started with `--api-key`, set `ANNOTUNE_API_KEY`. The same value
26
- is sent as a bearer token.
22
+ The current name model is one Q6_K GGUF,
23
+ `Qwen3.5-4B-annotune-v9k-name.Q6_K.gguf`. It is loaded with `-m` and no
24
+ LoRA. If that server was started with `--api-key`, set `ANNOTUNE_API_KEY`.
25
+ The same value is sent as a bearer token.
27
26
 
28
- | Model | Task it was fine-tuned for | Input | Output |
27
+ | Step | What it does | Input | Output |
29
28
  | --- | --- | --- | --- |
30
- | **name** | Choose a cell-type name from the marker dictionary | Cluster marker evidence and `dictionary_hits` | A name copied from `dictionary_hits` when that type's markers support the cluster |
31
- | **ML** | Choose a name from measured cluster statistics | Differential expression, candidate marker panels, log fold change, fraction of cells expressing each gene inside and outside the cluster, panel summaries | A name copied from those candidates |
32
-
33
- Both models are trained to **copy** a name from the candidates they are
34
- shown, not to free-write one. A name outside the candidate list cannot become
35
- a title, and a name with no marker that passes expression and specificity
29
+ | **name** | Choose a cell-type name from the marker dictionary | Cluster marker evidence and `dictionary_hits` | A name copied from `dictionary_hits` |
30
+ | **check** | A fixed rule, not a model | The proposed name and each candidate's marker measurements | Keep the name, replace it with the one supported candidate, or drop it |
31
+
32
+ The name model is trained to **copy** a name from `dictionary_hits`, not to
33
+ free-write one. A positive marker supports a type when its log fold change is
34
+ above 0.5 and it is detected in at least 25% of the cluster. A negative
35
+ marker blocks a type only when it is that common and its log fold change is
36
+ at least 1. The proposal stays when at least two markers support it and none
37
+ block it. It is replaced only when it is not supported and exactly one other
38
+ candidate is. Otherwise it is dropped, and the marker score can still name
39
+ the cluster. A name with no marker that passes expression and specificity
36
40
  validation is flagged (`no_marker_passed`) instead of being trusted silently.
37
41
 
38
42
  The weights are on the Hugging Face Hub:
@@ -45,26 +49,26 @@ The weights are on the Hugging Face Hub:
45
49
  raw counts ─ prepare ─▶ QC, doublets, normalization, batch correction, Leiden
46
50
  ─ run ─────▶ per cluster:
47
51
  1. marker score (built-in human / mouse dictionary)
48
- 2. name model (LoRA, copies from dictionary_hits)
49
- 3. ML model (LoRA, copies from measured candidates)
52
+ 2. name model (one GGUF, copies from dictionary_hits)
53
+ 3. check rule (keeps, replaces, or drops that name)
50
54
  ▼
51
- judgment ─▶ title + status + reason + hint
55
+ title + status + reason + hint
52
56
  ▼
53
57
  validated marker panels, dotplot, report, annotated h5ad
54
58
  ```
55
59
 
56
- - **Judgment, not voting.** Agreement among the three results gives a clear
57
- title. Disagreement, mixed programs, and unvalidated names are kept and
58
- flagged with a reason (`mixed_programs`, `near_clear_cluster`,
59
- `subcluster_labels`, `no_marker_passed`) so you can review them.
60
+ - **A rule, not a second model.** The check reads the measurements. It does
61
+ not call another adapter. Mixed programs and unvalidated names stay flagged
62
+ (`mixed_programs`, `near_clear_cluster`, `subcluster_labels`,
63
+ `no_marker_passed`, `check_rule`) so you can review them.
60
64
  - **Marker evidence is checked, not quoted.** Panels are selected from cited
61
65
  dictionary markers and validated against measured expression and
62
66
  specificity in your data.
63
- - **Every title is traceable.** The report records each model's answer, the
64
- panel, and the reason a cluster was or was not settled.
67
+ - **Every title is traceable.** The report records the name-model answer, the
68
+ check result, the panel, and the reason a cluster was or was not settled.
65
69
 
66
- The models run when `models` is passed (or the CLI adapter flags are given).
67
- Without them, `run` uses the marker score alone.
70
+ The name model runs when `models` is passed (or `--name-adapter` / `--name-url`
71
+ is given). Without it, `run` uses the marker score alone.
68
72
 
69
73
  ## Install
70
74
 
@@ -156,20 +160,21 @@ annotuneagent \
156
160
  --output result.json
157
161
  ```
158
162
 
159
- `--name-adapter`, `--ml-adapter`, and `--base` run the name and ML models on
160
- one local server and require `--output-h5ad`. The weights are on the Hugging
163
+ `--base` with the merged GGUF runs the name model on one local server and
164
+ requires `--output-h5ad`. The check rule then reads the marker measurements.
165
+ The weights are on the Hugging
161
166
  Face Hub: [lieberlee/annotune-qwen3.5-4b-gguf](https://huggingface.co/lieberlee/annotune-qwen3.5-4b-gguf).
162
167
  The tokenizer is installed with the package. See
163
168
  [docs/tutorials/load_model.ipynb](docs/tutorials/load_model.ipynb).
164
169
 
165
170
  ## Status
166
171
 
167
- **0.1.5 (Alpha).** Import as `import annotuneagent as ata`.
172
+ **0.1.6 (Alpha).** Import as `import annotuneagent as ata`.
168
173
 
169
174
  ## Citation
170
175
 
171
176
  For the software record, cite the [Zenodo DOI](https://doi.org/10.5281/zenodo.24092828).
172
- Pin the package version used in the analysis, for example `annotuneagent==0.1.5`.
177
+ Pin the package version used in the analysis, for example `annotuneagent==0.1.6`.
173
178
 
174
179
  ## License
175
180
 
@@ -19,7 +19,6 @@ The public API is the names below and `annotuneagent.__version__`.
19
19
  GeoSeries
20
20
  GeoSample
21
21
  prepare
22
- write_h5ad
23
22
  run
24
23
  annotate
25
24
  evaluate
@@ -8,22 +8,22 @@
8
8
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24092828.svg)](https://doi.org/10.5281/zenodo.24092828)
9
9
 
10
10
  AnnoTuneAgent annotates clustered scRNA-seq. `prepare` runs QC, gene
11
- selection, and Leiden clustering. `run` collects three results for each
12
- cluster: a marker score, a name-model result, and an ML-model result. A
13
- judgment reads the three results and writes the title. A cluster can stay
14
- unnamed. Clusters with the same title are merged.
11
+ selection, and Leiden clustering. `run` collects a marker score and a
12
+ name-model result. The check rule then keeps that name, replaces it, or drops
13
+ it. The marker score can still name the cluster when the check drops the
14
+ proposal. A cluster can stay unnamed. Clusters with the same title are merged.
15
15
 
16
- The name model and the ML model are LoRA adapters fine-tuned on one shared
17
- Qwen3.5-4B base. They run locally. Each copies a name from the candidates it is
18
- shown:
16
+ The name model is one merged Q6_K GGUF, `Qwen3.5-4B-annotune-v9k-name.Q6_K.gguf`.
17
+ It runs locally and copies
18
+ a name from the marker dictionary hits (`dictionary_hits`). The check is not
19
+ a model. A positive marker supports a type when its log fold change is above
20
+ 0.5 and it is detected in at least 25% of the cluster. A negative marker
21
+ blocks a type only when it is that common and its log fold change is at least
22
+ 1. The proposal stays when at least two markers support it and none block it.
23
+ It is replaced only when it is not supported and exactly one other candidate
24
+ is.
19
25
 
20
- - The **name model** copies from the marker dictionary hits
21
- (`dictionary_hits`) when that type's markers support the cluster.
22
- - The **ML model** copies from measured candidates: differential expression
23
- and marker-panel statistics, including log fold change and the fraction of
24
- cells expressing each gene inside and outside the cluster.
25
-
26
- Both models run when `models` is passed. Without it, `run` uses the marker
26
+ The name model runs when `models` is passed. Without it, `run` uses the marker
27
27
  score only. The weights are on the Hugging Face Hub:
28
28
  [lieberlee/annotune-qwen3.5-4b-gguf](https://huggingface.co/lieberlee/annotune-qwen3.5-4b-gguf).
29
29
 
@@ -57,7 +57,7 @@ scFair supplies the gene list and the resolution is half of its suggestion.
57
57
  | Page | Contents |
58
58
  |------|----------|
59
59
  | {doc}`installation`, {doc}`quickstart` | Install, then a first call |
60
- | {doc}`tutorials/pbmc8k_annotation` | PBMC 8k: `prepare`, then the name and ML models |
60
+ | {doc}`tutorials/pbmc8k_annotation` | PBMC 8k: `prepare`, then the name model and the check rule |
61
61
  | {doc}`tutorials/gse266598_annotation` | GEO GSE266598: download, then `prepare` and annotation |
62
62
  | {doc}`tutorials/load_model` | Download the weights and run a local or remote model server |
63
63
  | {doc}`tutorials/report` | What each part of the `run` report is for, including the text to paste |
@@ -11,7 +11,7 @@ import annotuneagent as ata
11
11
  print(ata.__version__)
12
12
  ```
13
13
 
14
- The version is set in `src/annotuneagent/_version.py` (currently **0.1.5**).
14
+ The version is set in `src/annotuneagent/_version.py` (currently **0.1.6**).
15
15
 
16
16
  From a checkout:
17
17
 
@@ -44,8 +44,8 @@ the install command and leaves the matrix unchanged. ComBat is part of Scanpy.
44
44
  The GGUF weights are not in the Python package. Download them from the
45
45
  Hugging Face Hub:
46
46
  [lieberlee/annotune-qwen3.5-4b-gguf](https://huggingface.co/lieberlee/annotune-qwen3.5-4b-gguf).
47
- {doc}`tutorials/load_model` shows the download and passes the folder to
48
- `local_models(root)`. If the server was started with `--api-key`, set
47
+ {doc}`tutorials/load_model` shows the download. Pass the merged file as
48
+ `TaskEndpoint(base=...)`. If the server was started with `--api-key`, set
49
49
  `ANNOTUNE_API_KEY` to the same value. It is sent as a bearer token.
50
50
 
51
51
  The package includes the Qwen tokenizer files, the Cell Ontology snapshot, and
@@ -53,10 +53,10 @@ adata = ata.prepare(adata, species="mouse", batch_key="sample")
53
53
  read the series page, download the two calvarial samples, then `prepare` and
54
54
  `run`.
55
55
 
56
- ## Run the name and ML models
56
+ ## Run the name model
57
57
 
58
- The call above collects the marker score only. To also run the name and ML
59
- models, download the weights from the Hub
58
+ The call above collects the marker score only. To also run the name model,
59
+ download the weights from the Hub
60
60
  ([lieberlee/annotune-qwen3.5-4b-gguf](https://huggingface.co/lieberlee/annotune-qwen3.5-4b-gguf))
61
61
  and pass them to `run`. {doc}`tutorials/load_model` covers the download, the
62
62
  `llama-server` install, and remote servers. If that server was started with
@@ -64,7 +64,11 @@ and pass them to `run`. {doc}`tutorials/load_model` covers the download, the
64
64
  token.
65
65
 
66
66
  ```python
67
- models = ata.local_models("/path/to/annotune-models")
67
+ model = "/path/to/Qwen3.5-4B-annotune-v9k-name.Q6_K.gguf"
68
+ models = ata.ModelChain(
69
+ name=ata.TaskEndpoint(base=model, maxlen=2048, server="http://127.0.0.1:8080"),
70
+ ml=ata.TaskEndpoint(),
71
+ )
68
72
  report = ata.run(adata, "leiden", species="human", models=models)
69
73
  ```
70
74
 
@@ -167,9 +171,7 @@ annotuneagent --input counts.h5ad --output report.json --output-h5ad prepared.h5
167
171
 
168
172
  When the CLI writes a prepared `.h5ad`, it stores `uns["annotune_prep"]` as a
169
173
  JSON string so AnnData can write the nested QC report. After reloading, use
170
- `json.loads(adata.uns["annotune_prep"])`. From Python, save with
171
- `ata.write_h5ad(adata, "prepared.h5ad")`; `adata.write_h5ad` raises on that
172
- report.
174
+ `json.loads(adata.uns["annotune_prep"])`.
173
175
 
174
176
  ## Outputs
175
177
 
@@ -208,8 +210,7 @@ panel, not to each gene separately.
208
210
  - `dropped_hypotheses`: each dictionary type left out because none of its
209
211
  positive markers are in the matrix. One missing positive gene stays in the
210
212
  panel and scores 0, and the type stays. A missing support gene is omitted.
211
- A missing negative gene stays on the panel, is not scored, and is counted
212
- as unmeasured for the ML call.
213
+ A missing negative gene stays on the panel and is not scored.
213
214
  - `review`: clusters that still need a look. The order is not an accuracy
214
215
  score.
215
216
  - `annotation_code`: an editable cluster mapping, `fine_order`, a `marker_dict`,
@@ -225,7 +226,7 @@ with the marker judgment and the genes enriched against the other cells.
225
226
  A Cell Ontology id is the exact map row for the written label. An unreviewed id
226
227
  is marked pending.
227
228
 
228
- Clusters with the same written title share one id in `obs["annotune_cluster"]`.
229
+ Clusters with the same written title are listed together in `report["merged"]`.
229
230
  The original Leiden column is kept. A cluster with no title stays on its own.
230
231
 
231
232
  ## Ambient RNA
@@ -263,10 +264,12 @@ same way when it has the `batch_key` column.
263
264
 
264
265
  ## How a cluster gets its name
265
266
 
266
- A judgment reads the marker score, the name-model result, and the ML-model
267
- result. It writes a dictionary name, or it leaves the cluster unnamed and
268
- records why. A hint, when there is one, is stored on `annotune_hint`. The
269
- record's `final_reason` says why the title was written or withheld.
267
+ A judgment reads the marker score and the name-model result. The check rule
268
+ keeps that name, replaces it with the one supported candidate, or drops it.
269
+ The marker score can still name the cluster when the check drops the
270
+ proposal. The record's `hint` and `final_reason` say why the title was
271
+ written or withheld. Those fields stay on the report.
272
+ `check_rule` means the check wrote or withheld the title.
270
273
 
271
274
  - `cytotoxic_mixture`: the NK panel and the T panel are both specific. The
272
275
  cluster stays unnamed so it can be split. A top-ranked `mature NK T cell`
@@ -275,20 +278,17 @@ record's `final_reason` says why the title was written or withheld.
275
278
 
276
279
  - `no_marker_passed`: none of the name's cited markers passed the expression
277
280
  check. The name stays, the hint reads `no marker passed`, and the dotplot
278
- shows the best-measured cited genes. When the name and ML models already
279
- agree on that name, a different marker call does not replace it. Otherwise
280
- a marker call that passed is written, and an unchecked marker call is tried
281
- once. If that call fails, and the two models agree on another lineage, that
282
- agreed name is written instead.
283
- - `mixed_programs`: a cluster under 40 cells shows two programs. It is named
284
- only when the marker score, name model, and ML model give the same name. The
285
- hint lists the programs. Otherwise the cluster stays unnamed.
281
+ shows the best-measured cited genes. When the check rule kept that name, a
282
+ different marker call does not replace it. Otherwise a marker call that
283
+ passed is written, and an unchecked marker call is tried once.
284
+ - `mixed_programs`: a cluster under 40 cells shows two programs. It stays
285
+ unnamed. The hint lists the programs.
286
286
  - `near_clear_cluster`: a cluster with an unclear name takes the title of the
287
287
  one clear cluster it touches on the neighbor graph or the UMAP. A title is
288
- clear when the name and ML models wrote the same name, or, when no model ran,
289
- when the marker rule wrote it without a hint. A name a model already wrote on
290
- the same lineage stays, and the hint names the neighboring cluster. A cluster
291
- that touches two lineages is not renamed.
288
+ clear when the check rule wrote it, or, when no model ran, when the marker
289
+ rule wrote it without a hint. A name the model already wrote on the same
290
+ lineage stays, and the hint names the neighboring cluster. A cluster that
291
+ touches two lineages is not renamed.
292
292
  - `low_quality`: a cluster is removed only when it has no title of its own
293
293
  and at least half of its 20 leading enriched genes are ribosomal
294
294
  proteins detected in at least 70% of the other cells. The hint is
@@ -297,5 +297,5 @@ record's `final_reason` says why the title was written or withheld.
297
297
 
298
298
  `report["queue"]` lists clusters that still have at least one cell without a
299
299
  title. A cluster whose cells are all named, including by a subcluster split,
300
- is not in `queue`. To find a titled cluster that still carries a question,
301
- filter on `annotune_hint`.
300
+ is not in `queue`. A titled cluster that still carries a question is in
301
+ `report["review"]`.