Skip to content

Commit

Permalink
Add Artifact fetching for pseudotemporal and lamindb default text (#344)
Browse files Browse the repository at this point in the history
* Add pseudotemporal registration script

Signed-off-by: Lukas Heumos <[email protected]>

* Add lamindb pseudotime

* Fix envs

* Pin jupyterbook

* dropdown

* Polish

* Polish

---------

Signed-off-by: Lukas Heumos <[email protected]>
  • Loading branch information
Zethson authored Mar 9, 2025
1 parent 76dd78a commit dcd3a0e
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade uv
uv pip install --system jupyter-book jupytext beautifulsoup4 playwright
uv pip install --system jupyter-book==1.0.4.post1 jupytext beautifulsoup4 playwright
- name: Install Playwright browsers
run: playwright install --with-deps
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ channels:
- conda-forge
dependencies:
- conda-forge::python==3.12
- conda-forge::jupyter-book==1.0.4
- conda-forge::jupyter-book==1.0.4.post1
- conda-forge::jupytext==1.16.7
- conda-forge::beautifulsoup4==4.13.3
- conda-forge::playwright==1.50.1
- conda-forge::sphinx==7.*
- pip
- pip:
- lamindb[bionty,jupyter]
- lamindb[bionty,jupyter,zarr]
66 changes: 66 additions & 0 deletions jupyter-book/_static/default_text_lamindb_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
This book uses [lamindb](https://github.com/laminlabs/lamindb) to store, share, and load datasets and notebooks using the [theislab/sc-best-practices instance](https://lamin.ai/theislab/sc-best-practices).
We acknowledge free hosting from [Lamin Labs](https://lamin.ai/).

1. **Install lamindb**

- Install the lamindb Python package:

```bash
pip install lamindb[bionty,jupyter,zarr]
```

2. **Optionally create a lamin account**

- Sign up and log in following [the instructions](https://docs.lamin.ai/setup#sign-up-log-in)

3. **Connect to the [theislab/sc-best-practices instance](https://lamin.ai/theislab/sc-best-practices)**

- Run the `lamin connect` command:

```bash
lamin connect theislab/sc-best-practices
```

You should now see `→ connected lamindb: theislab/sc-best-practices`.

4. **Verify your setup**

- Run the `lamin connect` command:

```python
import lamindb as ln

ln.Artifact.df()
```

You should now see up to 100 of the stored datasets.

5. **Accessing datasets (Artifacts)**

- Search for the datasets on the [Artifacts page](https://lamin.ai/theislab/sc-best-practices/artifacts)
- Load an Artifact and the corresponding object:

```python
import lamindb as ln
af = ln.Artifact.get(key="key_of_dataset", is_latest=True) # or ln.Artifact("SOMEID").get()
obj = af.load()
```

The object is now accessible in memory and is ready for analysis.
Adapt the `ln.Artifact("SOMEID").get()` suffix to get older versions like `ln.Artifact("SOMEID0001").get()` to get the second uploaded version.

6. **Accessing notebooks (Transforms)**

- Search for the notebook on the [Transforms page](https://lamin.ai/theislab/sc-best-practices/transforms)
- Load the notebook:

```bash
lamin load <notebook url>
```

which will download the notebook to the current working directory.
Analogously to `Artifacts`, you can adapt the suffix ID to get older versions.

7. **On `ln.track()` and `ln.finish()`**

- These functions are currently only available for users with write access and may error. Please comment them out for now.
6 changes: 3 additions & 3 deletions jupyter-book/trajectories/lineage_tracing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ channels:
- defaults
- conda-forge
dependencies:
- conda-forge::python=3.9.15
- conda-forge::scanpy=1.9.1
- conda-forge::jupyterlab=3.5.0
- conda-forge::python=3.12.9
- pip:
- git+https://github.com/YosefLab/Cassiopeia@master#egg=cassiopeia-lineage
- scanpy==1.11.0
- session_info
- lamindb[bionty,jupyter]
121 changes: 73 additions & 48 deletions jupyter-book/trajectories/pseudotemporal.ipynb

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions jupyter-book/trajectories/pseudotemporal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: pseudotemporal
channels:
- conda-forge
dependencies:
- conda-forge::python=3.9.16
- conda-forge::scanpy=1.9.1
- conda-forge::jupyterlab=3.5.3
- conda-forge::python=3.12.9
- pip
- pip:
- scanpy==1.11.0
- lamindb[bionty,jupyter]
2 changes: 2 additions & 0 deletions jupyter-book/trajectories/rna_velocity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dependencies:
- conda-forge::python=3.9.16
- conda-forge::jupyterlab=3.5.3
- bioconda::scvelo=0.2.5
- pip:
- lamindb[bionty,jupyter]

0 comments on commit dcd3a0e

Please sign in to comment.