cellarr 0.4.1.dev2__tar.gz → 0.5.1__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 (68) hide show
  1. cellarr-0.5.1/.github/workflows/publish-pypi.yml +52 -0
  2. cellarr-0.5.1/.github/workflows/run-tests.yml +33 -0
  3. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/.pre-commit-config.yaml +1 -1
  4. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/CHANGELOG.md +10 -0
  5. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/PKG-INFO +8 -3
  6. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/README.md +7 -2
  7. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/utils_anndata.py +2 -2
  8. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/PKG-INFO +8 -3
  9. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/SOURCES.txt +2 -2
  10. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/test_build.py +58 -0
  11. cellarr-0.4.1.dev2/.github/workflows/pypi-publish.yml +0 -51
  12. cellarr-0.4.1.dev2/.github/workflows/pypi-test.yml +0 -40
  13. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/.coveragerc +0 -0
  14. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/.gitignore +0 -0
  15. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/.readthedocs.yml +0 -0
  16. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/AUTHORS.md +0 -0
  17. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/CONTRIBUTING.md +0 -0
  18. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/LICENSE.txt +0 -0
  19. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/assets/cellarr.jpg +0 -0
  20. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/assets/cellarr.png +0 -0
  21. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/assets/cellarr.svg +0 -0
  22. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/Makefile +0 -0
  23. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/_static/.gitignore +0 -0
  24. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/authors.md +0 -0
  25. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/changelog.md +0 -0
  26. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/conf.py +0 -0
  27. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/contributing.md +0 -0
  28. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/index.md +0 -0
  29. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/license.md +0 -0
  30. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/notes.md +0 -0
  31. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/readme.md +0 -0
  32. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/requirements.txt +0 -0
  33. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/docs/tutorial.md +0 -0
  34. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/pyproject.toml +0 -0
  35. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/setup.cfg +0 -0
  36. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/setup.py +0 -0
  37. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/CellArrDataset.py +0 -0
  38. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/CellArrDatasetSlice.py +0 -0
  39. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/__init__.py +0 -0
  40. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/autoencoder.py +0 -0
  41. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/build_cellarrdataset.py +0 -0
  42. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/build_options.py +0 -0
  43. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/buildutils_tiledb_array.py +0 -0
  44. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/buildutils_tiledb_frame.py +0 -0
  45. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/dataloader.py +0 -0
  46. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/queryutils_tiledb_frame.py +0 -0
  47. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/README.md +0 -0
  48. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/__init__.py +0 -0
  49. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/build_cellarr_steps.py +0 -0
  50. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/final_assembly.py +0 -0
  51. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/finalize_matrix.py +0 -0
  52. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/process_cell_metadata.py +0 -0
  53. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/process_gene_annotation.py +0 -0
  54. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/process_matrix.py +0 -0
  55. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/process_matrix_all.py +0 -0
  56. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr/slurm/process_sample_metadata.py +0 -0
  57. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/dependency_links.txt +0 -0
  58. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/entry_points.txt +0 -0
  59. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/not-zip-safe +0 -0
  60. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/requires.txt +0 -0
  61. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/src/cellarr.egg-info/top_level.txt +0 -0
  62. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/conftest.py +0 -0
  63. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/data/adata.h5ad +0 -0
  64. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/test_anndata_utils.py +0 -0
  65. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/test_custom_config.py +0 -0
  66. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/test_dataloader.py +0 -0
  67. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tests/test_query.py +0 -0
  68. {cellarr-0.4.1.dev2 → cellarr-0.5.1}/tox.ini +0 -0
@@ -0,0 +1,52 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a single version of Python
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: Publish to PyPI
5
+
6
+ on:
7
+ push:
8
+ tags: "*"
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python 3.11
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: 3.11
21
+
22
+ - name: Install dependencies
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install tox
26
+
27
+ - name: Test with tox
28
+ run: |
29
+ tox
30
+
31
+ - name: Build docs
32
+ run: |
33
+ tox -e docs
34
+
35
+ - run: touch ./docs/_build/html/.nojekyll
36
+
37
+ - name: GH Pages Deployment
38
+ uses: JamesIves/github-pages-deploy-action@v4
39
+ with:
40
+ branch: gh-pages # The branch the action should deploy to.
41
+ folder: ./docs/_build/html
42
+ clean: true # Automatically remove deleted files from the deploy branch
43
+
44
+ - name: Build Project and Publish
45
+ run: |
46
+ python -m tox -e clean,build
47
+
48
+ - name: Publish package
49
+ uses: pypa/gh-action-pypi-publish@v1.12.2
50
+ with:
51
+ user: __token__
52
+ password: ${{ secrets.PYPI_PASSWORD }}
@@ -0,0 +1,33 @@
1
+ name: Run tests
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15
+
16
+ name: Python ${{ matrix.python-version }}
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+ cache: "pip"
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install tox
30
+
31
+ - name: Test with tox
32
+ run: |
33
+ tox
@@ -33,7 +33,7 @@ repos:
33
33
 
34
34
  - repo: https://github.com/astral-sh/ruff-pre-commit
35
35
  # Ruff version.
36
- rev: v0.8.2
36
+ rev: v0.8.3
37
37
  hooks:
38
38
  - id: ruff
39
39
  args: [--fix, --exit-non-zero-on-fix]
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.5.1
4
+
5
+ - Support csc matrices in layers, although not common ran into a situation where the
6
+ anndata object was stored from R.
7
+
8
+ ## Version 0.5.0
9
+
10
+ - Construct cellarr TileDB files on HPC environments based on slurm
11
+ (reference: [#61](https://github.com/BiocPy/cellarr/pull/61))
12
+
3
13
  ## Version 0.4.0
4
14
 
5
15
  - chore: Remove Python 3.8 (EOL).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cellarr
3
- Version: 0.4.1.dev2
3
+ Version: 0.5.1
4
4
  Summary: TileDB-based array storage for genomics data collections.
5
5
  Home-page: https://github.com/BiocPy/cellarr
6
6
  Author: Jayaram Kancherla
@@ -166,7 +166,8 @@ A minimal manifest file (json) must contain the following fields
166
166
  - `"python_env"`: A set of commands to activate the Python environment containing this package and its dependencies.
167
167
 
168
168
  Here’s an example of the manifest file:
169
- ```json
169
+
170
+ ```py
170
171
  manifest = {
171
172
  "files": your/list/of/files,
172
173
  "python_env": """
@@ -187,14 +188,18 @@ which python
187
188
  }
188
189
  ],
189
190
  }
191
+
192
+ import json
193
+ json.dump(manifest, open("your/path/to/manifest.json", "w"))
190
194
  ```
195
+
191
196
  For more options, check out the [README](./src/cellarr/slurm/README.md).
192
197
 
193
198
  - Step 2: Submit the job
194
199
  Once your manifest file is ready, you can submit the necessary jobs using the `cellarr_build` CLI. Run the following command:
195
200
 
196
201
  ```sh
197
- cellarr_build --input-manifest your/path/to/test_manifest.json --output-dir your/path/to/output --memory-per-job 8 --cpus-per-task 2
202
+ cellarr_build --input-manifest your/path/to/manifest.json --output-dir your/path/to/output --memory-per-job 8 --cpus-per-task 2
198
203
  ```
199
204
 
200
205
  ### Query a `CellArrDataset`
@@ -133,7 +133,8 @@ A minimal manifest file (json) must contain the following fields
133
133
  - `"python_env"`: A set of commands to activate the Python environment containing this package and its dependencies.
134
134
 
135
135
  Here’s an example of the manifest file:
136
- ```json
136
+
137
+ ```py
137
138
  manifest = {
138
139
  "files": your/list/of/files,
139
140
  "python_env": """
@@ -154,14 +155,18 @@ which python
154
155
  }
155
156
  ],
156
157
  }
158
+
159
+ import json
160
+ json.dump(manifest, open("your/path/to/manifest.json", "w"))
157
161
  ```
162
+
158
163
  For more options, check out the [README](./src/cellarr/slurm/README.md).
159
164
 
160
165
  - Step 2: Submit the job
161
166
  Once your manifest file is ready, you can submit the necessary jobs using the `cellarr_build` CLI. Run the following command:
162
167
 
163
168
  ```sh
164
- cellarr_build --input-manifest your/path/to/test_manifest.json --output-dir your/path/to/output --memory-per-job 8 --cpus-per-task 2
169
+ cellarr_build --input-manifest your/path/to/manifest.json --output-dir your/path/to/output --memory-per-job 8 --cpus-per-task 2
165
170
  ```
166
171
 
167
172
  ### Query a `CellArrDataset`
@@ -6,7 +6,7 @@ import anndata
6
6
  import mopsy
7
7
  import numpy as np
8
8
  import pandas as pd
9
- from scipy.sparse import coo_matrix, csr_array, csr_matrix
9
+ from scipy.sparse import coo_matrix, csc_array, csc_matrix, csr_array, csr_matrix
10
10
 
11
11
  __author__ = "Jayaram Kancherla"
12
12
  __copyright__ = "Jayaram Kancherla"
@@ -119,7 +119,7 @@ def remap_anndata(
119
119
 
120
120
  if isinstance(mat, np.ndarray):
121
121
  mat_coo = coo_matrix(mat)
122
- elif isinstance(mat, (csr_array, csr_matrix)):
122
+ elif isinstance(mat, (csr_array, csr_matrix, csc_matrix, csc_array)):
123
123
  mat_coo = mat.tocoo()
124
124
  else:
125
125
  raise TypeError(f"Unknown matrix type: {type(mat)}.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cellarr
3
- Version: 0.4.1.dev2
3
+ Version: 0.5.1
4
4
  Summary: TileDB-based array storage for genomics data collections.
5
5
  Home-page: https://github.com/BiocPy/cellarr
6
6
  Author: Jayaram Kancherla
@@ -166,7 +166,8 @@ A minimal manifest file (json) must contain the following fields
166
166
  - `"python_env"`: A set of commands to activate the Python environment containing this package and its dependencies.
167
167
 
168
168
  Here’s an example of the manifest file:
169
- ```json
169
+
170
+ ```py
170
171
  manifest = {
171
172
  "files": your/list/of/files,
172
173
  "python_env": """
@@ -187,14 +188,18 @@ which python
187
188
  }
188
189
  ],
189
190
  }
191
+
192
+ import json
193
+ json.dump(manifest, open("your/path/to/manifest.json", "w"))
190
194
  ```
195
+
191
196
  For more options, check out the [README](./src/cellarr/slurm/README.md).
192
197
 
193
198
  - Step 2: Submit the job
194
199
  Once your manifest file is ready, you can submit the necessary jobs using the `cellarr_build` CLI. Run the following command:
195
200
 
196
201
  ```sh
197
- cellarr_build --input-manifest your/path/to/test_manifest.json --output-dir your/path/to/output --memory-per-job 8 --cpus-per-task 2
202
+ cellarr_build --input-manifest your/path/to/manifest.json --output-dir your/path/to/output --memory-per-job 8 --cpus-per-task 2
198
203
  ```
199
204
 
200
205
  ### Query a `CellArrDataset`
@@ -11,8 +11,8 @@ pyproject.toml
11
11
  setup.cfg
12
12
  setup.py
13
13
  tox.ini
14
- .github/workflows/pypi-publish.yml
15
- .github/workflows/pypi-test.yml
14
+ .github/workflows/publish-pypi.yml
15
+ .github/workflows/run-tests.yml
16
16
  assets/cellarr.jpg
17
17
  assets/cellarr.png
18
18
  assets/cellarr.svg
@@ -13,6 +13,7 @@ from cellarr import (
13
13
  CellMetadataOptions,
14
14
  )
15
15
  import cellarr
16
+ from scipy import sparse as sp
16
17
 
17
18
  __author__ = "Jayaram Kancherla"
18
19
  __copyright__ = "Jayaram Kancherla"
@@ -460,3 +461,60 @@ def test_build_cellarrdataset_from_frame_withsubset_columns():
460
461
  )
461
462
  == 0
462
463
  )
464
+
465
+ def test_with_sparse():
466
+ tempdir = tempfile.mkdtemp()
467
+
468
+ adata1 = generate_adata(1000, 100, 10)
469
+ adata1.layers["counts"] = sp.csr_matrix(adata1.layers["counts"])
470
+
471
+ adata2 = generate_adata(100, 1000, 100)
472
+ adata2.layers["counts"] = sp.csc_matrix(adata2.layers["counts"])
473
+
474
+ build_cellarrdataset(
475
+ output_path=tempdir,
476
+ files=[adata1, adata2],
477
+ matrix_options=MatrixOptions(dtype=np.float32),
478
+ )
479
+
480
+ cfp = tiledb.open(f"{tempdir}/assays/counts", "r")
481
+ gfp = tiledb.open(f"{tempdir}/gene_annotation", "r")
482
+
483
+ genes = gfp.df[:]
484
+
485
+ assert len(genes) == 1000
486
+
487
+ gene_list = ["gene_1", "gene_95", "gene_50"]
488
+ _genes_from_tile = genes["cellarr_gene_index"].tolist()
489
+ gene_indices_tdb = sorted([_genes_from_tile.index(x) for x in gene_list])
490
+
491
+ adata1_gene_indices = sorted(
492
+ [adata1.var.index.tolist().index(x) for x in gene_list]
493
+ )
494
+
495
+ adata2_gene_indices = sorted(
496
+ [adata2.var.index.tolist().index(x) for x in gene_list]
497
+ )
498
+
499
+ assert np.allclose(
500
+ cfp.multi_index[0, gene_indices_tdb]["data"],
501
+ adata1.layers["counts"][0, adata1_gene_indices].todense(),
502
+ )
503
+ assert np.allclose(
504
+ cfp.multi_index[1000, gene_indices_tdb]["data"],
505
+ adata2.layers["counts"][0, adata2_gene_indices].todense(),
506
+ )
507
+
508
+ sfp = tiledb.open(f"{tempdir}/sample_metadata", "r")
509
+ samples = sfp.df[:]
510
+ assert len(samples) == 2
511
+ assert "cellarr_sample_start_index" in samples.columns
512
+ assert "cellarr_sample_end_index" in samples.columns
513
+ assert "cellarr_cell_counts" in samples.columns
514
+ assert "cellarr_original_gene_set" in samples.columns
515
+
516
+ cellfp = tiledb.open(f"{tempdir}/cell_metadata", "r")
517
+ cell_df = cellfp.df[:]
518
+ assert len(cell_df) == 1100
519
+ assert "cellarr_sample" in cell_df.columns
520
+ assert "cellarr_cell_index_in_sample" in cell_df.columns
@@ -1,51 +0,0 @@
1
- # This workflow will install Python dependencies, run tests and lint with a single version of Python
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
-
4
- name: Publish to PyPI
5
-
6
- on:
7
- push:
8
- tags: "*"
9
-
10
- jobs:
11
- build:
12
-
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - uses: actions/checkout@v4
17
- - name: Set up Python 3.11
18
- uses: actions/setup-python@v5
19
- with:
20
- python-version: 3.11
21
- - name: Install dependencies
22
- run: |
23
- python -m pip install --upgrade pip
24
- pip install flake8 pytest tox
25
- # - name: Lint with flake8
26
- # run: |
27
- # # stop the build if there are Python syntax errors or undefined names
28
- # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29
- # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30
- # # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31
- - name: Test with tox
32
- run: |
33
- tox
34
- - name: Build docs
35
- run: |
36
- tox -e docs
37
- - run: touch ./docs/_build/html/.nojekyll
38
- - name: GH Pages Deployment
39
- uses: JamesIves/github-pages-deploy-action@4.1.3
40
- with:
41
- branch: gh-pages # The branch the action should deploy to.
42
- folder: ./docs/_build/html
43
- clean: true # Automatically remove deleted files from the deploy branch
44
- - name: Build Project and Publish
45
- run: |
46
- python -m tox -e clean,build
47
- - name: Publish package
48
- uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
49
- with:
50
- user: __token__
51
- password: ${{ secrets.PYPI_PASSWORD }}
@@ -1,40 +0,0 @@
1
- # This workflow will install Python dependencies, run tests and lint with a single version of Python
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
-
4
- name: Test the library
5
-
6
- on:
7
- push:
8
- branches: [ master ]
9
- pull_request:
10
- branches: [ master ]
11
-
12
- jobs:
13
- build:
14
-
15
- runs-on: ubuntu-latest
16
- strategy:
17
- matrix:
18
- python-version: [ '3.9', '3.10', '3.11', '3.12' ]
19
-
20
- name: Python ${{ matrix.python-version }}
21
- steps:
22
- - uses: actions/checkout@v4
23
- - name: Setup Python
24
- uses: actions/setup-python@v5
25
- with:
26
- python-version: ${{ matrix.python-version }}
27
- cache: 'pip'
28
- - name: Install dependencies
29
- run: |
30
- python -m pip install --upgrade pip
31
- pip install flake8 pytest tox
32
- # - name: Lint with flake8
33
- # run: |
34
- # # stop the build if there are Python syntax errors or undefined names
35
- # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36
- # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37
- # # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38
- - name: Test with tox
39
- run: |
40
- tox
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes