|
27 | 27 | "metadata": {}, |
28 | 28 | "outputs": [], |
29 | 29 | "source": [ |
30 | | - "sc.settings.set_figure_params(dpi=50, facecolor=\"white\")" |
| 30 | + "sc.set_figure_params(dpi=50, facecolor=\"white\")" |
31 | 31 | ] |
32 | 32 | }, |
33 | 33 | { |
|
42 | 42 | "We are reading in the count matrix into an [AnnData](https://anndata.readthedocs.io/en/latest/tutorials/notebooks/getting-started.html) object, which holds many slots for annotations and different representations of the data." |
43 | 43 | ] |
44 | 44 | }, |
45 | | - { |
46 | | - "cell_type": "code", |
47 | | - "execution_count": 3, |
48 | | - "id": "f0448e97", |
49 | | - "metadata": {}, |
50 | | - "outputs": [], |
51 | | - "source": [ |
52 | | - "EXAMPLE_DATA = pooch.create(\n", |
53 | | - " path=pooch.os_cache(\"scverse_tutorials\"),\n", |
54 | | - " base_url=\"doi:10.6084/m9.figshare.22716739.v1/\",\n", |
55 | | - ")\n", |
56 | | - "EXAMPLE_DATA.load_registry_from_doi()" |
57 | | - ] |
58 | | - }, |
59 | 45 | { |
60 | 46 | "cell_type": "code", |
61 | 47 | "execution_count": 4, |
|
94 | 80 | } |
95 | 81 | ], |
96 | 82 | "source": [ |
97 | | - "samples = {\n", |
98 | | - " \"s1d1\": \"s1d1_filtered_feature_bc_matrix.h5\",\n", |
99 | | - " \"s1d3\": \"s1d3_filtered_feature_bc_matrix.h5\",\n", |
100 | | - "}\n", |
101 | | - "adatas = {}\n", |
102 | | - "\n", |
103 | | - "for sample_id, filename in samples.items():\n", |
104 | | - " path = EXAMPLE_DATA.fetch(filename)\n", |
| 83 | + "def download_sample(sample_id: str, known_hash: str) -> ad.AnnData:\n", |
| 84 | + " path = pooch.retrieve(\n", |
| 85 | + " path=pooch.os_cache(\"scverse_tutorials\"),\n", |
| 86 | + " url=f\"https://exampledata.scverse.org/tutorials/neurips-2021/{sample_id}_filtered_feature_bc_matrix.h5\",\n", |
| 87 | + " known_hash=known_hash,\n", |
| 88 | + " )\n", |
105 | 89 | " sample_adata = sc.read_10x_h5(path)\n", |
106 | 90 | " sample_adata.var_names_make_unique()\n", |
107 | | - " adatas[sample_id] = sample_adata\n", |
| 91 | + " return sample_adata\n", |
108 | 92 | "\n", |
| 93 | + "samples = {\n", |
| 94 | + " \"s1d1\": \"md5:a99285913ea3f3d22600d3d2f8a88e34\",\n", |
| 95 | + " \"s1d3\": \"md5:825f7f7578e3dc0b8955f5a97a402338\",\n", |
| 96 | + "}\n", |
| 97 | + "adatas = {id_: download_sample(id_, known_hash) for id_, known_hash in samples.items()}\n", |
109 | 98 | "adata = ad.concat(adatas, label=\"sample\")\n", |
110 | 99 | "adata.obs_names_make_unique()" |
111 | 100 | ] |
|
1347 | 1336 | "name": "stderr", |
1348 | 1337 | "output_type": "stream", |
1349 | 1338 | "text": [ |
1350 | | - "\r", |
| 1339 | + "\r\n", |
1351 | 1340 | " 0%| | 0/1 [00:00<?, ?it/s]" |
1352 | 1341 | ] |
1353 | 1342 | }, |
|
1362 | 1351 | "name": "stderr", |
1363 | 1352 | "output_type": "stream", |
1364 | 1353 | "text": [ |
1365 | | - "\r", |
| 1354 | + "\r\n", |
1366 | 1355 | "100%|██████████| 1/1 [00:17<00:00, 17.34s/it]" |
1367 | 1356 | ] |
1368 | 1357 | }, |
1369 | 1358 | { |
1370 | 1359 | "name": "stderr", |
1371 | 1360 | "output_type": "stream", |
1372 | 1361 | "text": [ |
1373 | | - "\r", |
| 1362 | + "\r\n", |
1374 | 1363 | "100%|██████████| 1/1 [00:17<00:00, 17.34s/it]" |
1375 | 1364 | ] |
1376 | 1365 | }, |
|
0 commit comments