pyadata-cli 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.
Files changed (41) hide show
  1. pyadata_cli-0.5.0/LICENSE +21 -0
  2. pyadata_cli-0.5.0/PKG-INFO +135 -0
  3. pyadata_cli-0.5.0/README.md +95 -0
  4. pyadata_cli-0.5.0/pyproject.toml +90 -0
  5. pyadata_cli-0.5.0/src/adata/__init__.py +10 -0
  6. pyadata_cli-0.5.0/src/adata/cli.py +1139 -0
  7. pyadata_cli-0.5.0/src/adata/commands/__init__.py +8 -0
  8. pyadata_cli-0.5.0/src/adata/commands/concat.py +21 -0
  9. pyadata_cli-0.5.0/src/adata/commands/create.py +93 -0
  10. pyadata_cli-0.5.0/src/adata/commands/export.py +105 -0
  11. pyadata_cli-0.5.0/src/adata/commands/import_data.py +144 -0
  12. pyadata_cli-0.5.0/src/adata/commands/info.py +199 -0
  13. pyadata_cli-0.5.0/src/adata/commands/ls.py +114 -0
  14. pyadata_cli-0.5.0/src/adata/commands/split.py +152 -0
  15. pyadata_cli-0.5.0/src/adata/commands/subset.py +17 -0
  16. pyadata_cli-0.5.0/src/adata/core/__init__.py +1 -0
  17. pyadata_cli-0.5.0/src/adata/core/concat.py +1084 -0
  18. pyadata_cli-0.5.0/src/adata/core/info.py +276 -0
  19. pyadata_cli-0.5.0/src/adata/core/query.py +268 -0
  20. pyadata_cli-0.5.0/src/adata/core/read.py +28 -0
  21. pyadata_cli-0.5.0/src/adata/core/select.py +122 -0
  22. pyadata_cli-0.5.0/src/adata/core/subset.py +767 -0
  23. pyadata_cli-0.5.0/src/adata/elements/__init__.py +10 -0
  24. pyadata_cli-0.5.0/src/adata/elements/read.py +310 -0
  25. pyadata_cli-0.5.0/src/adata/elements/spec.py +125 -0
  26. pyadata_cli-0.5.0/src/adata/elements/strings.py +90 -0
  27. pyadata_cli-0.5.0/src/adata/elements/write.py +255 -0
  28. pyadata_cli-0.5.0/src/adata/formats/__init__.py +1 -0
  29. pyadata_cli-0.5.0/src/adata/formats/array.py +109 -0
  30. pyadata_cli-0.5.0/src/adata/formats/common.py +51 -0
  31. pyadata_cli-0.5.0/src/adata/formats/dataframe.py +234 -0
  32. pyadata_cli-0.5.0/src/adata/formats/image.py +85 -0
  33. pyadata_cli-0.5.0/src/adata/formats/json_data.py +196 -0
  34. pyadata_cli-0.5.0/src/adata/formats/sparse.py +253 -0
  35. pyadata_cli-0.5.0/src/adata/formats/validate.py +180 -0
  36. pyadata_cli-0.5.0/src/adata/info.py +3 -0
  37. pyadata_cli-0.5.0/src/adata/py.typed +0 -0
  38. pyadata_cli-0.5.0/src/adata/read.py +19 -0
  39. pyadata_cli-0.5.0/src/adata/storage/__init__.py +529 -0
  40. pyadata_cli-0.5.0/src/adata/util/__init__.py +1 -0
  41. pyadata_cli-0.5.0/src/adata/util/path.py +9 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cellular Genomics Informatics
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.
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyadata-cli
3
+ Version: 0.5.0
4
+ Summary: Streaming CLI for exploring and editing large AnnData .h5ad and .zarr stores
5
+ Keywords: anndata,h5ad,zarr,bioinformatics,single-cell,cli
6
+ Author: Aljes Binkevich
7
+ Author-email: Aljes Binkevich <ab76@sanger.ac.uk>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Classifier: Typing :: Typed
20
+ Requires-Dist: h5py>=3.15.1
21
+ Requires-Dist: numpy>=2.3.5
22
+ Requires-Dist: pillow>=12.1.0
23
+ Requires-Dist: rich>=14.2.0
24
+ Requires-Dist: typer>=0.20.0
25
+ Requires-Dist: zarr>=3.1.5
26
+ Requires-Dist: pytest>=8.3.4 ; extra == 'dev'
27
+ Requires-Dist: pytest-cov>=6.0.0 ; extra == 'dev'
28
+ Requires-Dist: pytest-timeout>=2.3.0 ; extra == 'dev'
29
+ Requires-Dist: anndata>=0.13 ; extra == 'dev'
30
+ Maintainer: Aljes Binkevich
31
+ Maintainer-email: Aljes Binkevich <ab76@sanger.ac.uk>
32
+ Requires-Python: >=3.12
33
+ Project-URL: Changelog, https://github.com/cellgeni/adata-cli/blob/main/CHANGELOG.md
34
+ Project-URL: Documentation, https://cellgeni.github.io/adata-cli/
35
+ Project-URL: Homepage, https://github.com/cellgeni/adata-cli
36
+ Project-URL: Issues, https://github.com/cellgeni/adata-cli/issues
37
+ Project-URL: Repository, https://github.com/cellgeni/adata-cli
38
+ Provides-Extra: dev
39
+ Description-Content-Type: text/markdown
40
+
41
+ # adata CLI
42
+
43
+ A command-line tool for exploring huge AnnData stores (`.h5ad` and `.zarr`) without loading them fully into memory. Streams data directly from disk for efficient inspection of structure, metadata, and matrices.
44
+
45
+ ## Features
46
+
47
+ - Streaming access to very large `.h5ad` and `.zarr` stores
48
+ - Auto-detects `.h5ad` files vs `.zarr` directories
49
+ - Chunked processing for dense and sparse matrices (CSR/CSC)
50
+ - Reads every AnnData on-disk layout, from 0.7.x through the current spec, and always writes the current one
51
+ - Converts between HDF5 and Zarr (v2 and v3) in either direction
52
+ - Rich terminal output with progress indicators, kept on stderr so results pipe cleanly
53
+
54
+ **Documentation: [cellgeni.github.io/adata-cli](https://cellgeni.github.io/adata-cli/)**
55
+
56
+ ## Installation
57
+
58
+ ```bash
59
+ pip install pyadata-cli
60
+ ```
61
+
62
+ The command is `adata`. The distribution is named `pyadata-cli` because
63
+ `adata-cli` was already taken on PyPI by an unrelated project.
64
+
65
+ From source with [uv](https://docs.astral.sh/uv/):
66
+ ```bash
67
+ git clone https://github.com/cellgeni/adata-cli.git
68
+ cd adata-cli
69
+ uv sync
70
+ ```
71
+
72
+ For development and testing:
73
+ ```bash
74
+ uv sync --extra dev
75
+ ```
76
+
77
+ Alternative with pip:
78
+ ```bash
79
+ git clone https://github.com/cellgeni/adata-cli.git
80
+ cd adata-cli
81
+ pip install .
82
+ ```
83
+
84
+ For development and testing with pip:
85
+ ```bash
86
+ pip install -e ".[dev]"
87
+ ```
88
+
89
+ ## Commands (Overview)
90
+
91
+ Run help at any level (e.g. `adata --help`, `adata export --help`).
92
+
93
+ - `view` – AnnData-aware inspection: store layout, shapes, and encodings; supports drilling into paths like `obsm/X_pca` or `uns`.
94
+ - `ls` – list the contents of any HDF5 or Zarr store as a tree, with no AnnData assumptions (works on `.loom` and plain `.h5`); `-1` emits bare paths for piping.
95
+ - `create` – write a new, empty AnnData store for `import` to fill in.
96
+ - `subset` – stream and write a filtered copy, selected by obs/var name lists (`--obs`/`--var`) or by expression (`--obs-query`/`--var-query`).
97
+ - `split` – write one store per distinct value of an annotation column, with a CSV manifest.
98
+ - `concat` – concatenate stores along the obs axis, with `--join inner|outer` and merge strategies for var and uns.
99
+ - `export` – extract data from a store; subcommands: `dataframe` (any dataframe group to CSV), `array` (dense to `.npy`), `sparse` (CSR/CSC to `.mtx`), `dict` (JSON), `image` (PNG). Results go to stdout when no `--output` is given.
100
+ - `import` – write new data into a store at any path; subcommands: `dataframe` (CSV), `array` (`.npy`), `sparse` (`.mtx`), `dict` (JSON), `image` (PNG/JPEG/TIFF).
101
+
102
+ ### Building a store from scratch
103
+
104
+ ```bash
105
+ adata create out.h5ad --obs-names cells.txt --var-names genes.txt
106
+ adata import sparse out.h5ad X counts.mtx --inplace
107
+ adata import dataframe out.h5ad obs cells.csv --inplace -i cell_id
108
+ adata import array out.h5ad obsm/X_umap umap.npy --inplace
109
+ adata import dict out.h5ad uns/params params.json --inplace
110
+ ```
111
+
112
+ ### Filtering without a name list
113
+
114
+ ```bash
115
+ adata subset data.h5ad -o cortex.h5ad --obs-query "cluster == Cortex_2"
116
+ adata subset data.h5ad -o big.h5ad -q "n_counts > 1000 and cluster in A,B"
117
+ adata split data.h5ad --by sample -o per_sample/
118
+ adata concat per_sample/*.h5ad -o merged.h5ad --join outer --label sample
119
+ ```
120
+
121
+ ## Documentation
122
+
123
+ - [Get started](docs/GET_STARTED.md) — a short tutorial
124
+ - [Command reference](docs/COMMANDS.md) — every command and flag
125
+ - [Element spec: HDF5](docs/ELEMENTS_h5ad.md) / [Zarr](docs/ELEMENTS_zarr.md) — the on-disk format, and what this tool does with it
126
+ - [Testing](docs/TESTING.md) — how the suite is organised, and how compatibility is verified against six anndata releases
127
+ - [Changelog](CHANGELOG.md)
128
+
129
+ ## Docker
130
+
131
+ A docker image is available on QUAY: `quay.io/cellgeni/adata-cli:latest`. Pull and run with:
132
+
133
+ ```bash
134
+ docker run --rm -it -v /path/to/data:/data quay.io/cellgeni/adata-cli:latest view /data/your_file.h5ad
135
+ ```
@@ -0,0 +1,95 @@
1
+ # adata CLI
2
+
3
+ A command-line tool for exploring huge AnnData stores (`.h5ad` and `.zarr`) without loading them fully into memory. Streams data directly from disk for efficient inspection of structure, metadata, and matrices.
4
+
5
+ ## Features
6
+
7
+ - Streaming access to very large `.h5ad` and `.zarr` stores
8
+ - Auto-detects `.h5ad` files vs `.zarr` directories
9
+ - Chunked processing for dense and sparse matrices (CSR/CSC)
10
+ - Reads every AnnData on-disk layout, from 0.7.x through the current spec, and always writes the current one
11
+ - Converts between HDF5 and Zarr (v2 and v3) in either direction
12
+ - Rich terminal output with progress indicators, kept on stderr so results pipe cleanly
13
+
14
+ **Documentation: [cellgeni.github.io/adata-cli](https://cellgeni.github.io/adata-cli/)**
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install pyadata-cli
20
+ ```
21
+
22
+ The command is `adata`. The distribution is named `pyadata-cli` because
23
+ `adata-cli` was already taken on PyPI by an unrelated project.
24
+
25
+ From source with [uv](https://docs.astral.sh/uv/):
26
+ ```bash
27
+ git clone https://github.com/cellgeni/adata-cli.git
28
+ cd adata-cli
29
+ uv sync
30
+ ```
31
+
32
+ For development and testing:
33
+ ```bash
34
+ uv sync --extra dev
35
+ ```
36
+
37
+ Alternative with pip:
38
+ ```bash
39
+ git clone https://github.com/cellgeni/adata-cli.git
40
+ cd adata-cli
41
+ pip install .
42
+ ```
43
+
44
+ For development and testing with pip:
45
+ ```bash
46
+ pip install -e ".[dev]"
47
+ ```
48
+
49
+ ## Commands (Overview)
50
+
51
+ Run help at any level (e.g. `adata --help`, `adata export --help`).
52
+
53
+ - `view` – AnnData-aware inspection: store layout, shapes, and encodings; supports drilling into paths like `obsm/X_pca` or `uns`.
54
+ - `ls` – list the contents of any HDF5 or Zarr store as a tree, with no AnnData assumptions (works on `.loom` and plain `.h5`); `-1` emits bare paths for piping.
55
+ - `create` – write a new, empty AnnData store for `import` to fill in.
56
+ - `subset` – stream and write a filtered copy, selected by obs/var name lists (`--obs`/`--var`) or by expression (`--obs-query`/`--var-query`).
57
+ - `split` – write one store per distinct value of an annotation column, with a CSV manifest.
58
+ - `concat` – concatenate stores along the obs axis, with `--join inner|outer` and merge strategies for var and uns.
59
+ - `export` – extract data from a store; subcommands: `dataframe` (any dataframe group to CSV), `array` (dense to `.npy`), `sparse` (CSR/CSC to `.mtx`), `dict` (JSON), `image` (PNG). Results go to stdout when no `--output` is given.
60
+ - `import` – write new data into a store at any path; subcommands: `dataframe` (CSV), `array` (`.npy`), `sparse` (`.mtx`), `dict` (JSON), `image` (PNG/JPEG/TIFF).
61
+
62
+ ### Building a store from scratch
63
+
64
+ ```bash
65
+ adata create out.h5ad --obs-names cells.txt --var-names genes.txt
66
+ adata import sparse out.h5ad X counts.mtx --inplace
67
+ adata import dataframe out.h5ad obs cells.csv --inplace -i cell_id
68
+ adata import array out.h5ad obsm/X_umap umap.npy --inplace
69
+ adata import dict out.h5ad uns/params params.json --inplace
70
+ ```
71
+
72
+ ### Filtering without a name list
73
+
74
+ ```bash
75
+ adata subset data.h5ad -o cortex.h5ad --obs-query "cluster == Cortex_2"
76
+ adata subset data.h5ad -o big.h5ad -q "n_counts > 1000 and cluster in A,B"
77
+ adata split data.h5ad --by sample -o per_sample/
78
+ adata concat per_sample/*.h5ad -o merged.h5ad --join outer --label sample
79
+ ```
80
+
81
+ ## Documentation
82
+
83
+ - [Get started](docs/GET_STARTED.md) — a short tutorial
84
+ - [Command reference](docs/COMMANDS.md) — every command and flag
85
+ - [Element spec: HDF5](docs/ELEMENTS_h5ad.md) / [Zarr](docs/ELEMENTS_zarr.md) — the on-disk format, and what this tool does with it
86
+ - [Testing](docs/TESTING.md) — how the suite is organised, and how compatibility is verified against six anndata releases
87
+ - [Changelog](CHANGELOG.md)
88
+
89
+ ## Docker
90
+
91
+ A docker image is available on QUAY: `quay.io/cellgeni/adata-cli:latest`. Pull and run with:
92
+
93
+ ```bash
94
+ docker run --rm -it -v /path/to/data:/data quay.io/cellgeni/adata-cli:latest view /data/your_file.h5ad
95
+ ```
@@ -0,0 +1,90 @@
1
+ [project]
2
+ # The short name `adata-cli` was taken on PyPI by an unrelated project,
3
+ # so the distribution is published as `pyadata-cli`. The import package
4
+ # and the command are both still `adata`.
5
+ name = "pyadata-cli"
6
+ version = "0.5.0"
7
+ description = "Streaming CLI for exploring and editing large AnnData .h5ad and .zarr stores"
8
+ readme = "README.md"
9
+ requires-python = ">=3.12"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ { name = "Aljes Binkevich", email = "ab76@sanger.ac.uk" },
14
+ ]
15
+ maintainers = [
16
+ { name = "Aljes Binkevich", email = "ab76@sanger.ac.uk" },
17
+ ]
18
+ keywords = [
19
+ "anndata",
20
+ "h5ad",
21
+ "zarr",
22
+ "bioinformatics",
23
+ "single-cell",
24
+ "cli",
25
+ ]
26
+ classifiers = [
27
+ "Development Status :: 4 - Beta",
28
+ "Environment :: Console",
29
+ "Intended Audience :: Science/Research",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Programming Language :: Python :: 3.13",
35
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
36
+ "Typing :: Typed",
37
+ ]
38
+
39
+ dependencies = [
40
+ "h5py>=3.15.1",
41
+ "numpy>=2.3.5",
42
+ "pillow>=12.1.0",
43
+ "rich>=14.2.0",
44
+ "typer>=0.20.0",
45
+ "zarr>=3.1.5",
46
+ ]
47
+
48
+ [project.urls]
49
+ Homepage = "https://github.com/cellgeni/adata-cli"
50
+ Repository = "https://github.com/cellgeni/adata-cli"
51
+ Documentation = "https://cellgeni.github.io/adata-cli/"
52
+ Issues = "https://github.com/cellgeni/adata-cli/issues"
53
+ Changelog = "https://github.com/cellgeni/adata-cli/blob/main/CHANGELOG.md"
54
+
55
+ [project.optional-dependencies]
56
+ dev = [
57
+ "pytest>=8.3.4",
58
+ "pytest-cov>=6.0.0",
59
+ # Turns a hang into a failure with a traceback. Without it a stuck test
60
+ # burns the CI job's whole timeout and reports nothing useful.
61
+ "pytest-timeout>=2.3.0",
62
+ # Used only by tests/test_anndata_roundtrip.py, to check that what this
63
+ # tool reads and writes matches what anndata itself produces.
64
+ "anndata>=0.13",
65
+ ]
66
+
67
+ [build-system]
68
+ requires = ["uv_build>=0.8.0,<0.9.0"]
69
+ build-backend = "uv_build"
70
+
71
+ [tool.uv.build-backend]
72
+ module-name = "adata"
73
+
74
+
75
+ [project.scripts]
76
+ adata = "adata.cli:main"
77
+ # Deprecated alias, removed in 1.0.0
78
+ h5ad = "adata.cli:main_deprecated"
79
+
80
+ [tool.coverage.run]
81
+ source = ["src/adata"]
82
+ omit = [
83
+ "*/tests/*",
84
+ "*/__pycache__/*",
85
+ ]
86
+
87
+ [tool.coverage.report]
88
+ precision = 2
89
+ show_missing = true
90
+ skip_covered = false
@@ -0,0 +1,10 @@
1
+ """adata-cli: streaming CLI for large AnnData .h5ad and .zarr stores."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version as _version
4
+
5
+ try:
6
+ __version__ = _version("pyadata-cli")
7
+ except PackageNotFoundError: # pragma: no cover - running from a source tree
8
+ __version__ = "0.0.0+unknown"
9
+
10
+ __all__ = ["__version__"]