Skip to content

Commit 11bf38c

Browse files
authored
Merge pull request #28 from srivarra/feature/marimo-dataset
2 parents de82932 + fd03866 commit 11bf38c

File tree

6 files changed

+82
-10
lines changed

6 files changed

+82
-10
lines changed

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### <!-- 0 --> 🏗️ Github Actions
11+
12+
- Merge pull request #25 from srivarra/feature/type_fixes by [@srivarra](https://github.com/srivarra) in [#25](https://github.com/srivarra/annsel/pull/25)
13+
14+
### <!-- 3 --> 📝 Documentation
15+
16+
- Merge pull request #24 from srivarra/docs/changelog-template-add-gh-account by [@srivarra](https://github.com/srivarra) in [#24](https://github.com/srivarra/annsel/pull/24)
17+
1018
### <!-- 4 --> 🧪 Dependencies
1119

1220
- Merge pull request #23 from srivarra/pre-commit-ci-update-config by [@srivarra](https://github.com/srivarra) in [#23](https://github.com/srivarra/annsel/pull/23)
@@ -15,7 +23,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1523

1624
### <!-- 5 --> 🌀 Miscellaneous
1725

18-
- 📝 Updated changelog template
26+
- Merge pull request #27 from srivarra/ci/revert-arm-runner by [@srivarra](https://github.com/srivarra) in [#27](https://github.com/srivarra/annsel/pull/27)
27+
- 💚 One day I'll get CI right by [@srivarra](https://github.com/srivarra)
28+
- Merge pull request #26 from srivarra/pre-commit-ci-update-config by [@srivarra](https://github.com/srivarra) in [#26](https://github.com/srivarra/annsel/pull/26)
29+
- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci[bot]](https://github.com/pre-commit-ci[bot])
30+
- 💚 Testing arm based ubuntu ci by [@srivarra](https://github.com/srivarra)
31+
- 🏷️ Update IntoExpr by [@srivarra](https://github.com/srivarra)
32+
- ⚗️ Marimo testing by [@srivarra](https://github.com/srivarra)
33+
- [pre-commit.ci] auto fixes from pre-commit.com hooks by [@pre-commit-ci[bot]](https://github.com/pre-commit-ci[bot])
34+
- Added github label commit parser by [@srivarra](https://github.com/srivarra)
35+
- 📝 Added github pr label commit parser by [@srivarra](https://github.com/srivarra)
36+
- 📝 Updated changelog template by [@srivarra](https://github.com/srivarra)
1937
- [pre-commit.ci] auto fixes from pre-commit.com hooks by [@pre-commit-ci[bot]](https://github.com/pre-commit-ci[bot])
2038
- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci[bot]](https://github.com/pre-commit-ci[bot])
2139
- [pre-commit.ci] pre-commit autoupdate by [@pre-commit-ci[bot]](https://github.com/pre-commit-ci[bot])

docs/api/datasets.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
:toctree: ../generated
1616
1717
leukemic_bone_marrow_dataset
18+
marimo_dataset
1819
```

src/annsel/datasets/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .basic import leukemic_bone_marrow_dataset
1+
from .basic import leukemic_bone_marrow_dataset, marimo_dataset
22

3-
__all__ = ["leukemic_bone_marrow_dataset"]
3+
__all__ = ["leukemic_bone_marrow_dataset", "marimo_dataset"]

src/annsel/datasets/basic.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,49 @@ def leukemic_bone_marrow_dataset(
119119
)
120120
adata.strings_to_categoricals()
121121
return adata
122+
123+
124+
def marimo_dataset() -> ad.AnnData:
125+
"""Generate a fake in memory dataset for Marimo, since it's not possible to load a dataset from a URL.
126+
127+
Returns
128+
-------
129+
A minimal dataset as an AnnData object.
130+
"""
131+
import numpy as np
132+
import pandas as pd
133+
134+
rng = np.random.default_rng(42)
135+
136+
X = rng.random((100, 100)) * 10
137+
log1p_X = np.log1p(X)
138+
139+
obs = pd.DataFrame(
140+
data={
141+
"cell_type": pd.Categorical(
142+
rng.choice(a=["A", "B", "C"], p=[0.3, 0.4, 0.3], size=100),
143+
),
144+
"batch": pd.Categorical(
145+
rng.choice(a=["1", "2", "3"], p=[0.3, 0.4, 0.3], size=100),
146+
),
147+
"development_stage": pd.Categorical(
148+
rng.choice(a=["embryonic", "adult"], p=[0.3, 0.7], size=100),
149+
),
150+
},
151+
index=pd.Index([f"cell_{i}" for i in range(100)], name="index"),
152+
)
153+
154+
var = pd.DataFrame(
155+
data={
156+
"feature_type": pd.Categorical(
157+
rng.choice(a=["protein", "rna"], p=[0.3, 0.7], size=100),
158+
),
159+
},
160+
index=pd.Index([f"gene_{i}" for i in range(100)], name="index"),
161+
)
162+
163+
adata = ad.AnnData(X=X, obs=obs, var=var, layers={"log1p": log1p_X})
164+
return adata
165+
166+
# adata = ad.AnnData(X=X, obs=obs, var=var)
167+
# return adata

tests/datasets/test_basic.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from annsel.datasets import marimo_dataset
2+
3+
4+
def test_marimo_dataset():
5+
adata = marimo_dataset()
6+
assert adata.n_obs == 100
7+
assert adata.n_vars == 100

uv.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)