|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Pseudotemporal dataset" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "code", |
| 12 | + "execution_count": 1, |
| 13 | + "metadata": {}, |
| 14 | + "outputs": [ |
| 15 | + { |
| 16 | + "name": "stdout", |
| 17 | + "output_type": "stream", |
| 18 | + "text": [ |
| 19 | + "\u001b[92m→\u001b[0m connected lamindb: theislab/sc-best-practices\n" |
| 20 | + ] |
| 21 | + } |
| 22 | + ], |
| 23 | + "source": [ |
| 24 | + "import lamindb as ln\n", |
| 25 | + "import scanpy as sc" |
| 26 | + ] |
| 27 | + }, |
| 28 | + { |
| 29 | + "cell_type": "code", |
| 30 | + "execution_count": 2, |
| 31 | + "metadata": {}, |
| 32 | + "outputs": [], |
| 33 | + "source": [ |
| 34 | + "assert ln.setup.settings.instance.slug == \"theislab/sc-best-practices\"" |
| 35 | + ] |
| 36 | + }, |
| 37 | + { |
| 38 | + "cell_type": "code", |
| 39 | + "execution_count": 3, |
| 40 | + "metadata": {}, |
| 41 | + "outputs": [ |
| 42 | + { |
| 43 | + "name": "stdout", |
| 44 | + "output_type": "stream", |
| 45 | + "text": [ |
| 46 | + "\u001b[92m→\u001b[0m loaded Transform('6QcwslTJCWhW0001'), re-started Run('gunbofig...') at 2025-02-19 09:12:59 UTC\n", |
| 47 | + "\u001b[92m→\u001b[0m notebook imports: lamindb==1.1.0 scanpy==1.11.0\n" |
| 48 | + ] |
| 49 | + } |
| 50 | + ], |
| 51 | + "source": [ |
| 52 | + "ln.track()" |
| 53 | + ] |
| 54 | + }, |
| 55 | + { |
| 56 | + "cell_type": "code", |
| 57 | + "execution_count": 4, |
| 58 | + "metadata": {}, |
| 59 | + "outputs": [ |
| 60 | + { |
| 61 | + "data": { |
| 62 | + "text/plain": [ |
| 63 | + "AnnData object with n_obs × n_vars = 5780 × 27876\n", |
| 64 | + " obs: 'clusters', 'palantir_pseudotime', 'palantir_diff_potential'\n", |
| 65 | + " var: 'palantir'\n", |
| 66 | + " uns: 'clusters_colors', 'palantir_branch_probs_cell_types'\n", |
| 67 | + " obsm: 'MAGIC_imputed_data', 'X_tsne', 'palantir_branch_probs'\n", |
| 68 | + " layers: 'spliced', 'unspliced'" |
| 69 | + ] |
| 70 | + }, |
| 71 | + "execution_count": 4, |
| 72 | + "metadata": {}, |
| 73 | + "output_type": "execute_result" |
| 74 | + } |
| 75 | + ], |
| 76 | + "source": [ |
| 77 | + "adata = sc.read(\n", |
| 78 | + " filename=\"bonemarrow.h5ad\",\n", |
| 79 | + " backup_url=\"https://figshare.com/ndownloader/files/35826944\",\n", |
| 80 | + ")\n", |
| 81 | + "adata" |
| 82 | + ] |
| 83 | + }, |
| 84 | + { |
| 85 | + "cell_type": "code", |
| 86 | + "execution_count": 5, |
| 87 | + "metadata": {}, |
| 88 | + "outputs": [ |
| 89 | + { |
| 90 | + "name": "stdout", |
| 91 | + "output_type": "stream", |
| 92 | + "text": [ |
| 93 | + "\u001b[92m→\u001b[0m found artifact with same hash: Artifact(uid='buvlHZTfCKo60akB0000', is_latest=True, key='trajectory/pseudotemporal.h5ad', description='pseudotemporal dataset', suffix='.h5ad', otype='AnnData', size=388391976, hash='FdzXtifrBdukftwBX2_m5M', space_id=1, storage_id=1, run_id=2, created_by_id=2, created_at=2025-02-19 08:38:20 UTC); to track this artifact as an input, use: ln.Artifact.get()\n" |
| 94 | + ] |
| 95 | + }, |
| 96 | + { |
| 97 | + "data": { |
| 98 | + "text/plain": [ |
| 99 | + "Artifact(uid='buvlHZTfCKo60akB0000', is_latest=True, key='trajectory/pseudotemporal.h5ad', description='pseudotemporal dataset', suffix='.h5ad', otype='AnnData', size=388391976, hash='FdzXtifrBdukftwBX2_m5M', space_id=1, storage_id=1, run_id=2, created_by_id=2, created_at=2025-02-19 08:38:20 UTC)" |
| 100 | + ] |
| 101 | + }, |
| 102 | + "execution_count": 5, |
| 103 | + "metadata": {}, |
| 104 | + "output_type": "execute_result" |
| 105 | + } |
| 106 | + ], |
| 107 | + "source": [ |
| 108 | + "af = ln.Artifact(\n", |
| 109 | + " \"bonemarrow.h5ad\",\n", |
| 110 | + " key=\"trajectory/pseudotemporal.h5ad\",\n", |
| 111 | + " description=\"pseudotemporal dataset\",\n", |
| 112 | + ").save()\n", |
| 113 | + "af" |
| 114 | + ] |
| 115 | + }, |
| 116 | + { |
| 117 | + "cell_type": "code", |
| 118 | + "execution_count": null, |
| 119 | + "metadata": {}, |
| 120 | + "outputs": [], |
| 121 | + "source": [ |
| 122 | + "ln.finish()" |
| 123 | + ] |
| 124 | + } |
| 125 | + ], |
| 126 | + "metadata": { |
| 127 | + "kernelspec": { |
| 128 | + "display_name": "bp-pseudotime", |
| 129 | + "language": "python", |
| 130 | + "name": "python3" |
| 131 | + }, |
| 132 | + "language_info": { |
| 133 | + "codemirror_mode": { |
| 134 | + "name": "ipython", |
| 135 | + "version": 3 |
| 136 | + }, |
| 137 | + "file_extension": ".py", |
| 138 | + "mimetype": "text/x-python", |
| 139 | + "name": "python", |
| 140 | + "nbconvert_exporter": "python", |
| 141 | + "pygments_lexer": "ipython3", |
| 142 | + "version": "3.12.9" |
| 143 | + } |
| 144 | + }, |
| 145 | + "nbformat": 4, |
| 146 | + "nbformat_minor": 2 |
| 147 | +} |
0 commit comments