pyvark 0.1.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.
- pyvark-0.1.0/LICENSE +21 -0
- pyvark-0.1.0/PKG-INFO +171 -0
- pyvark-0.1.0/README.md +138 -0
- pyvark-0.1.0/pyproject.toml +57 -0
- pyvark-0.1.0/pyvark.egg-info/PKG-INFO +171 -0
- pyvark-0.1.0/pyvark.egg-info/SOURCES.txt +13 -0
- pyvark-0.1.0/pyvark.egg-info/dependency_links.txt +1 -0
- pyvark-0.1.0/pyvark.egg-info/requires.txt +9 -0
- pyvark-0.1.0/pyvark.egg-info/top_level.txt +1 -0
- pyvark-0.1.0/setup.cfg +4 -0
- pyvark-0.1.0/tests/test_offline.py +313 -0
- pyvark-0.1.0/tests/test_smoke.py +195 -0
- pyvark-0.1.0/vark/__init__.py +31 -0
- pyvark-0.1.0/vark/client.py +910 -0
- pyvark-0.1.0/vark/helpers.py +119 -0
pyvark-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Fiers
|
|
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.
|
pyvark-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyvark
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python REST client for the Anthive single-cell RNA-seq browser (sibling of the Go `vark` CLI)
|
|
5
|
+
Author-email: Mark Fiers <mark.fiers@kuleuven.be>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://codeberg.org/mfiers/pyvark
|
|
8
|
+
Project-URL: Repository, https://codeberg.org/mfiers/pyvark
|
|
9
|
+
Project-URL: Go CLI, https://codeberg.org/mfiers/vark
|
|
10
|
+
Project-URL: Bug Tracker, https://codeberg.org/mfiers/pyvark/issues
|
|
11
|
+
Keywords: bioinformatics,single-cell,rna-seq,anthive,rest-client
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: requests>=2.25.0
|
|
26
|
+
Provides-Extra: pandas
|
|
27
|
+
Requires-Dist: pandas>=1.3.0; extra == "pandas"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pandas>=1.3.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
<p align="center"><img src="https://codeberg.org/mfiers/pyvark/raw/branch/main/doc/logo.png" alt="pyvark" width="200"></p>
|
|
35
|
+
|
|
36
|
+
# pyvark
|
|
37
|
+
|
|
38
|
+
Python client for the [Anthive](https://codeberg.org/mfiers/anthive4)
|
|
39
|
+
single-cell RNA-seq REST API. Sibling of the Go [`vark`](https://codeberg.org/mfiers/vark)
|
|
40
|
+
CLI — same backend, two front ends.
|
|
41
|
+
|
|
42
|
+
API surface verified against **anthive REST API 2.7.2** (2026-06-20).
|
|
43
|
+
|
|
44
|
+
## Why the dual name?
|
|
45
|
+
|
|
46
|
+
The Go CLI ships as a binary called `vark`. To avoid clobbering it on
|
|
47
|
+
the user's `$PATH` and to keep the PyPI / Codeberg slug obvious, the
|
|
48
|
+
**distribution name** is `pyvark` but the **importable name** is `vark`.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pip install pyvark # distribution
|
|
52
|
+
python -c "from vark import AnthiveClient; print('ok')" # usage
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
(Both CLI and library live next to each other in the same Anthive setup
|
|
56
|
+
with no shell collision: `vark` = the Go binary, `vark` = the Python
|
|
57
|
+
import.)
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
From Codeberg (no PyPI publish yet):
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
pip install git+ssh://git@codeberg.org/mfiers/pyvark.git
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Editable from a local checkout:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
git clone ssh://git@codeberg.org/mfiers/pyvark.git
|
|
71
|
+
cd pyvark
|
|
72
|
+
pip install -e .
|
|
73
|
+
# with pandas for `format='dataframe'` support:
|
|
74
|
+
pip install -e ".[pandas]"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Pyodide / JupyterLite:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import micropip
|
|
81
|
+
await micropip.install("pyvark")
|
|
82
|
+
from vark import AnthiveClient
|
|
83
|
+
client = AnthiveClient() # auto-detects {origin}/api/ in the browser
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Minimal example
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from vark import AnthiveClient
|
|
90
|
+
|
|
91
|
+
client = AnthiveClient(
|
|
92
|
+
"https://my.anthive.example/api",
|
|
93
|
+
auth=("user", "password"),
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# What's on this server?
|
|
97
|
+
print(client.get_version()["version"])
|
|
98
|
+
databases = client.get_databases()
|
|
99
|
+
print(f"{len(databases)} datasets available")
|
|
100
|
+
|
|
101
|
+
# Pick a dataset and show its metadata fields
|
|
102
|
+
info = client.get_database_info(databases[0]["id"])
|
|
103
|
+
print(info["title"], info["n_cells"], "cells")
|
|
104
|
+
|
|
105
|
+
# Render a UMAP scatter server-side and write the PNG
|
|
106
|
+
plot = client.get_plot(
|
|
107
|
+
info["id"], "scatter",
|
|
108
|
+
color="cell_type",
|
|
109
|
+
palette_categorical="tab20",
|
|
110
|
+
width=6, height=5, dpi=150,
|
|
111
|
+
)
|
|
112
|
+
open("umap.png", "wb").write(plot["bytes"])
|
|
113
|
+
|
|
114
|
+
# The X-Plot-Caption header carries anthive's prose figure legend —
|
|
115
|
+
# this is the ONLY place the multi-sentence caption exists.
|
|
116
|
+
print(plot["caption"])
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## API coverage (highlights)
|
|
120
|
+
|
|
121
|
+
* `get_root`, `get_health`, `get_metrics`, `get_version`,
|
|
122
|
+
`get_changelog` — version + latency telemetry (`/health` exposes
|
|
123
|
+
`mean_response_ms` / `p50_response_ms` / `n_samples`).
|
|
124
|
+
* `get_databases`, `get_database_info`, `get_group(group_id)` —
|
|
125
|
+
catalog + per-collection landing-page data (API 2.5+).
|
|
126
|
+
* `get_plot(db_id, geom, ...)` — every server-side geom: `scatter`,
|
|
127
|
+
`hexbin`, `kde2d`, `violin`, `box`, `bar`, `histogram`, `ecdf`,
|
|
128
|
+
`kde`, `heatmap`, `rolling`, `volcano`, `ma`, `forest`, `de_heatmap`.
|
|
129
|
+
Captures the `X-Plot-Caption` response header (the multi-sentence
|
|
130
|
+
figure legend — API 2.7.2+). Supports `color_scale=auto|sequential|
|
|
131
|
+
divergent`, plot clamps (`log2fc_clip`, `neglog10p_clip`,
|
|
132
|
+
`logmean_clip`), bar `group_by`, hexbin auto-clip
|
|
133
|
+
(`vmin_quantile` / `vmax_quantile`), per-axis transforms
|
|
134
|
+
(`transform_x` / `transform_y`, `asinh_scale`), KDE knobs
|
|
135
|
+
(`kde_n`, `kde_bw`, `n_levels`, `iso_overlay`, `point_overlay`),
|
|
136
|
+
marginals / regline overlays. Data export via `format="csv"` /
|
|
137
|
+
`"tsv"` returns the dataframe the plot was built from (API 2.6+).
|
|
138
|
+
* `list_de_studies`, `get_de_study`, `list_de_contrasts`,
|
|
139
|
+
`get_de_rows`, `get_de_by_gene` — DE data flow (API 2.3+).
|
|
140
|
+
* `analytics_schema`, `analytics_query`, `analytics_viz` —
|
|
141
|
+
SELECT-only SQL sandbox + Parquet-backed visualisation.
|
|
142
|
+
* `module_score`, `list_module_scores` — on-the-fly and pre-computed
|
|
143
|
+
module scores.
|
|
144
|
+
* `list_genesets`, `get_geneset`, `rescan_genesets`.
|
|
145
|
+
* `pick_fastest(base_urls, ...)` — server-selection helper that
|
|
146
|
+
consumes `/health` latency telemetry.
|
|
147
|
+
|
|
148
|
+
## Tests
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
# Offline (no server needed):
|
|
152
|
+
uv run --with pytest --with requests python -m pytest tests/test_offline.py -v
|
|
153
|
+
|
|
154
|
+
# Live smoke (round-trip):
|
|
155
|
+
ANTHIVE_TEST_URL=https://my.anthive/api \
|
|
156
|
+
ANTHIVE_TEST_USER=user ANTHIVE_TEST_PASSWORD=pass \
|
|
157
|
+
uv run --with pytest --with requests --with pandas \
|
|
158
|
+
python -m pytest tests/test_smoke.py -v
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Versioning
|
|
162
|
+
|
|
163
|
+
`pyvark` starts at **0.1.0** as a clean break from the legacy
|
|
164
|
+
`antclient` 1.x history that previously lived under
|
|
165
|
+
`anthive4/antclient/`. The Anthive REST API uses its own semver
|
|
166
|
+
(`X.Y.Z`) — see `client.AnthiveClient.API_TARGET` for the version this
|
|
167
|
+
release was last verified against.
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT — see `LICENSE`.
|
pyvark-0.1.0/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<p align="center"><img src="https://codeberg.org/mfiers/pyvark/raw/branch/main/doc/logo.png" alt="pyvark" width="200"></p>
|
|
2
|
+
|
|
3
|
+
# pyvark
|
|
4
|
+
|
|
5
|
+
Python client for the [Anthive](https://codeberg.org/mfiers/anthive4)
|
|
6
|
+
single-cell RNA-seq REST API. Sibling of the Go [`vark`](https://codeberg.org/mfiers/vark)
|
|
7
|
+
CLI — same backend, two front ends.
|
|
8
|
+
|
|
9
|
+
API surface verified against **anthive REST API 2.7.2** (2026-06-20).
|
|
10
|
+
|
|
11
|
+
## Why the dual name?
|
|
12
|
+
|
|
13
|
+
The Go CLI ships as a binary called `vark`. To avoid clobbering it on
|
|
14
|
+
the user's `$PATH` and to keep the PyPI / Codeberg slug obvious, the
|
|
15
|
+
**distribution name** is `pyvark` but the **importable name** is `vark`.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pip install pyvark # distribution
|
|
19
|
+
python -c "from vark import AnthiveClient; print('ok')" # usage
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
(Both CLI and library live next to each other in the same Anthive setup
|
|
23
|
+
with no shell collision: `vark` = the Go binary, `vark` = the Python
|
|
24
|
+
import.)
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
From Codeberg (no PyPI publish yet):
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install git+ssh://git@codeberg.org/mfiers/pyvark.git
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Editable from a local checkout:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
git clone ssh://git@codeberg.org/mfiers/pyvark.git
|
|
38
|
+
cd pyvark
|
|
39
|
+
pip install -e .
|
|
40
|
+
# with pandas for `format='dataframe'` support:
|
|
41
|
+
pip install -e ".[pandas]"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Pyodide / JupyterLite:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import micropip
|
|
48
|
+
await micropip.install("pyvark")
|
|
49
|
+
from vark import AnthiveClient
|
|
50
|
+
client = AnthiveClient() # auto-detects {origin}/api/ in the browser
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Minimal example
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from vark import AnthiveClient
|
|
57
|
+
|
|
58
|
+
client = AnthiveClient(
|
|
59
|
+
"https://my.anthive.example/api",
|
|
60
|
+
auth=("user", "password"),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# What's on this server?
|
|
64
|
+
print(client.get_version()["version"])
|
|
65
|
+
databases = client.get_databases()
|
|
66
|
+
print(f"{len(databases)} datasets available")
|
|
67
|
+
|
|
68
|
+
# Pick a dataset and show its metadata fields
|
|
69
|
+
info = client.get_database_info(databases[0]["id"])
|
|
70
|
+
print(info["title"], info["n_cells"], "cells")
|
|
71
|
+
|
|
72
|
+
# Render a UMAP scatter server-side and write the PNG
|
|
73
|
+
plot = client.get_plot(
|
|
74
|
+
info["id"], "scatter",
|
|
75
|
+
color="cell_type",
|
|
76
|
+
palette_categorical="tab20",
|
|
77
|
+
width=6, height=5, dpi=150,
|
|
78
|
+
)
|
|
79
|
+
open("umap.png", "wb").write(plot["bytes"])
|
|
80
|
+
|
|
81
|
+
# The X-Plot-Caption header carries anthive's prose figure legend —
|
|
82
|
+
# this is the ONLY place the multi-sentence caption exists.
|
|
83
|
+
print(plot["caption"])
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## API coverage (highlights)
|
|
87
|
+
|
|
88
|
+
* `get_root`, `get_health`, `get_metrics`, `get_version`,
|
|
89
|
+
`get_changelog` — version + latency telemetry (`/health` exposes
|
|
90
|
+
`mean_response_ms` / `p50_response_ms` / `n_samples`).
|
|
91
|
+
* `get_databases`, `get_database_info`, `get_group(group_id)` —
|
|
92
|
+
catalog + per-collection landing-page data (API 2.5+).
|
|
93
|
+
* `get_plot(db_id, geom, ...)` — every server-side geom: `scatter`,
|
|
94
|
+
`hexbin`, `kde2d`, `violin`, `box`, `bar`, `histogram`, `ecdf`,
|
|
95
|
+
`kde`, `heatmap`, `rolling`, `volcano`, `ma`, `forest`, `de_heatmap`.
|
|
96
|
+
Captures the `X-Plot-Caption` response header (the multi-sentence
|
|
97
|
+
figure legend — API 2.7.2+). Supports `color_scale=auto|sequential|
|
|
98
|
+
divergent`, plot clamps (`log2fc_clip`, `neglog10p_clip`,
|
|
99
|
+
`logmean_clip`), bar `group_by`, hexbin auto-clip
|
|
100
|
+
(`vmin_quantile` / `vmax_quantile`), per-axis transforms
|
|
101
|
+
(`transform_x` / `transform_y`, `asinh_scale`), KDE knobs
|
|
102
|
+
(`kde_n`, `kde_bw`, `n_levels`, `iso_overlay`, `point_overlay`),
|
|
103
|
+
marginals / regline overlays. Data export via `format="csv"` /
|
|
104
|
+
`"tsv"` returns the dataframe the plot was built from (API 2.6+).
|
|
105
|
+
* `list_de_studies`, `get_de_study`, `list_de_contrasts`,
|
|
106
|
+
`get_de_rows`, `get_de_by_gene` — DE data flow (API 2.3+).
|
|
107
|
+
* `analytics_schema`, `analytics_query`, `analytics_viz` —
|
|
108
|
+
SELECT-only SQL sandbox + Parquet-backed visualisation.
|
|
109
|
+
* `module_score`, `list_module_scores` — on-the-fly and pre-computed
|
|
110
|
+
module scores.
|
|
111
|
+
* `list_genesets`, `get_geneset`, `rescan_genesets`.
|
|
112
|
+
* `pick_fastest(base_urls, ...)` — server-selection helper that
|
|
113
|
+
consumes `/health` latency telemetry.
|
|
114
|
+
|
|
115
|
+
## Tests
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
# Offline (no server needed):
|
|
119
|
+
uv run --with pytest --with requests python -m pytest tests/test_offline.py -v
|
|
120
|
+
|
|
121
|
+
# Live smoke (round-trip):
|
|
122
|
+
ANTHIVE_TEST_URL=https://my.anthive/api \
|
|
123
|
+
ANTHIVE_TEST_USER=user ANTHIVE_TEST_PASSWORD=pass \
|
|
124
|
+
uv run --with pytest --with requests --with pandas \
|
|
125
|
+
python -m pytest tests/test_smoke.py -v
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Versioning
|
|
129
|
+
|
|
130
|
+
`pyvark` starts at **0.1.0** as a clean break from the legacy
|
|
131
|
+
`antclient` 1.x history that previously lived under
|
|
132
|
+
`anthive4/antclient/`. The Anthive REST API uses its own semver
|
|
133
|
+
(`X.Y.Z`) — see `client.AnthiveClient.API_TARGET` for the version this
|
|
134
|
+
release was last verified against.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT — see `LICENSE`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyvark"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python REST client for the Anthive single-cell RNA-seq browser (sibling of the Go `vark` CLI)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Mark Fiers", email = "mark.fiers@kuleuven.be" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"bioinformatics",
|
|
17
|
+
"single-cell",
|
|
18
|
+
"rna-seq",
|
|
19
|
+
"anthive",
|
|
20
|
+
"rest-client",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Science/Research",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
26
|
+
"License :: OSI Approved :: MIT License",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.9",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
"requests>=2.25.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
pandas = ["pandas>=1.3.0"]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=7.0.0",
|
|
42
|
+
"pytest-cov>=4.0.0",
|
|
43
|
+
"pandas>=1.3.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://codeberg.org/mfiers/pyvark"
|
|
48
|
+
Repository = "https://codeberg.org/mfiers/pyvark"
|
|
49
|
+
"Go CLI" = "https://codeberg.org/mfiers/vark"
|
|
50
|
+
"Bug Tracker" = "https://codeberg.org/mfiers/pyvark/issues"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools]
|
|
53
|
+
packages = ["vark"]
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
testpaths = ["tests"]
|
|
57
|
+
python_files = ["test_*.py"]
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyvark
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python REST client for the Anthive single-cell RNA-seq browser (sibling of the Go `vark` CLI)
|
|
5
|
+
Author-email: Mark Fiers <mark.fiers@kuleuven.be>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://codeberg.org/mfiers/pyvark
|
|
8
|
+
Project-URL: Repository, https://codeberg.org/mfiers/pyvark
|
|
9
|
+
Project-URL: Go CLI, https://codeberg.org/mfiers/vark
|
|
10
|
+
Project-URL: Bug Tracker, https://codeberg.org/mfiers/pyvark/issues
|
|
11
|
+
Keywords: bioinformatics,single-cell,rna-seq,anthive,rest-client
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: requests>=2.25.0
|
|
26
|
+
Provides-Extra: pandas
|
|
27
|
+
Requires-Dist: pandas>=1.3.0; extra == "pandas"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pandas>=1.3.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
<p align="center"><img src="https://codeberg.org/mfiers/pyvark/raw/branch/main/doc/logo.png" alt="pyvark" width="200"></p>
|
|
35
|
+
|
|
36
|
+
# pyvark
|
|
37
|
+
|
|
38
|
+
Python client for the [Anthive](https://codeberg.org/mfiers/anthive4)
|
|
39
|
+
single-cell RNA-seq REST API. Sibling of the Go [`vark`](https://codeberg.org/mfiers/vark)
|
|
40
|
+
CLI — same backend, two front ends.
|
|
41
|
+
|
|
42
|
+
API surface verified against **anthive REST API 2.7.2** (2026-06-20).
|
|
43
|
+
|
|
44
|
+
## Why the dual name?
|
|
45
|
+
|
|
46
|
+
The Go CLI ships as a binary called `vark`. To avoid clobbering it on
|
|
47
|
+
the user's `$PATH` and to keep the PyPI / Codeberg slug obvious, the
|
|
48
|
+
**distribution name** is `pyvark` but the **importable name** is `vark`.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pip install pyvark # distribution
|
|
52
|
+
python -c "from vark import AnthiveClient; print('ok')" # usage
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
(Both CLI and library live next to each other in the same Anthive setup
|
|
56
|
+
with no shell collision: `vark` = the Go binary, `vark` = the Python
|
|
57
|
+
import.)
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
From Codeberg (no PyPI publish yet):
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
pip install git+ssh://git@codeberg.org/mfiers/pyvark.git
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Editable from a local checkout:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
git clone ssh://git@codeberg.org/mfiers/pyvark.git
|
|
71
|
+
cd pyvark
|
|
72
|
+
pip install -e .
|
|
73
|
+
# with pandas for `format='dataframe'` support:
|
|
74
|
+
pip install -e ".[pandas]"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Pyodide / JupyterLite:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import micropip
|
|
81
|
+
await micropip.install("pyvark")
|
|
82
|
+
from vark import AnthiveClient
|
|
83
|
+
client = AnthiveClient() # auto-detects {origin}/api/ in the browser
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Minimal example
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from vark import AnthiveClient
|
|
90
|
+
|
|
91
|
+
client = AnthiveClient(
|
|
92
|
+
"https://my.anthive.example/api",
|
|
93
|
+
auth=("user", "password"),
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# What's on this server?
|
|
97
|
+
print(client.get_version()["version"])
|
|
98
|
+
databases = client.get_databases()
|
|
99
|
+
print(f"{len(databases)} datasets available")
|
|
100
|
+
|
|
101
|
+
# Pick a dataset and show its metadata fields
|
|
102
|
+
info = client.get_database_info(databases[0]["id"])
|
|
103
|
+
print(info["title"], info["n_cells"], "cells")
|
|
104
|
+
|
|
105
|
+
# Render a UMAP scatter server-side and write the PNG
|
|
106
|
+
plot = client.get_plot(
|
|
107
|
+
info["id"], "scatter",
|
|
108
|
+
color="cell_type",
|
|
109
|
+
palette_categorical="tab20",
|
|
110
|
+
width=6, height=5, dpi=150,
|
|
111
|
+
)
|
|
112
|
+
open("umap.png", "wb").write(plot["bytes"])
|
|
113
|
+
|
|
114
|
+
# The X-Plot-Caption header carries anthive's prose figure legend —
|
|
115
|
+
# this is the ONLY place the multi-sentence caption exists.
|
|
116
|
+
print(plot["caption"])
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## API coverage (highlights)
|
|
120
|
+
|
|
121
|
+
* `get_root`, `get_health`, `get_metrics`, `get_version`,
|
|
122
|
+
`get_changelog` — version + latency telemetry (`/health` exposes
|
|
123
|
+
`mean_response_ms` / `p50_response_ms` / `n_samples`).
|
|
124
|
+
* `get_databases`, `get_database_info`, `get_group(group_id)` —
|
|
125
|
+
catalog + per-collection landing-page data (API 2.5+).
|
|
126
|
+
* `get_plot(db_id, geom, ...)` — every server-side geom: `scatter`,
|
|
127
|
+
`hexbin`, `kde2d`, `violin`, `box`, `bar`, `histogram`, `ecdf`,
|
|
128
|
+
`kde`, `heatmap`, `rolling`, `volcano`, `ma`, `forest`, `de_heatmap`.
|
|
129
|
+
Captures the `X-Plot-Caption` response header (the multi-sentence
|
|
130
|
+
figure legend — API 2.7.2+). Supports `color_scale=auto|sequential|
|
|
131
|
+
divergent`, plot clamps (`log2fc_clip`, `neglog10p_clip`,
|
|
132
|
+
`logmean_clip`), bar `group_by`, hexbin auto-clip
|
|
133
|
+
(`vmin_quantile` / `vmax_quantile`), per-axis transforms
|
|
134
|
+
(`transform_x` / `transform_y`, `asinh_scale`), KDE knobs
|
|
135
|
+
(`kde_n`, `kde_bw`, `n_levels`, `iso_overlay`, `point_overlay`),
|
|
136
|
+
marginals / regline overlays. Data export via `format="csv"` /
|
|
137
|
+
`"tsv"` returns the dataframe the plot was built from (API 2.6+).
|
|
138
|
+
* `list_de_studies`, `get_de_study`, `list_de_contrasts`,
|
|
139
|
+
`get_de_rows`, `get_de_by_gene` — DE data flow (API 2.3+).
|
|
140
|
+
* `analytics_schema`, `analytics_query`, `analytics_viz` —
|
|
141
|
+
SELECT-only SQL sandbox + Parquet-backed visualisation.
|
|
142
|
+
* `module_score`, `list_module_scores` — on-the-fly and pre-computed
|
|
143
|
+
module scores.
|
|
144
|
+
* `list_genesets`, `get_geneset`, `rescan_genesets`.
|
|
145
|
+
* `pick_fastest(base_urls, ...)` — server-selection helper that
|
|
146
|
+
consumes `/health` latency telemetry.
|
|
147
|
+
|
|
148
|
+
## Tests
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
# Offline (no server needed):
|
|
152
|
+
uv run --with pytest --with requests python -m pytest tests/test_offline.py -v
|
|
153
|
+
|
|
154
|
+
# Live smoke (round-trip):
|
|
155
|
+
ANTHIVE_TEST_URL=https://my.anthive/api \
|
|
156
|
+
ANTHIVE_TEST_USER=user ANTHIVE_TEST_PASSWORD=pass \
|
|
157
|
+
uv run --with pytest --with requests --with pandas \
|
|
158
|
+
python -m pytest tests/test_smoke.py -v
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Versioning
|
|
162
|
+
|
|
163
|
+
`pyvark` starts at **0.1.0** as a clean break from the legacy
|
|
164
|
+
`antclient` 1.x history that previously lived under
|
|
165
|
+
`anthive4/antclient/`. The Anthive REST API uses its own semver
|
|
166
|
+
(`X.Y.Z`) — see `client.AnthiveClient.API_TARGET` for the version this
|
|
167
|
+
release was last verified against.
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT — see `LICENSE`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
pyvark.egg-info/PKG-INFO
|
|
5
|
+
pyvark.egg-info/SOURCES.txt
|
|
6
|
+
pyvark.egg-info/dependency_links.txt
|
|
7
|
+
pyvark.egg-info/requires.txt
|
|
8
|
+
pyvark.egg-info/top_level.txt
|
|
9
|
+
tests/test_offline.py
|
|
10
|
+
tests/test_smoke.py
|
|
11
|
+
vark/__init__.py
|
|
12
|
+
vark/client.py
|
|
13
|
+
vark/helpers.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vark
|
pyvark-0.1.0/setup.cfg
ADDED