-
Notifications
You must be signed in to change notification settings - Fork 0
/
getCellxgeneFiles.py
39 lines (29 loc) · 1.14 KB
/
getCellxgeneFiles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#shortcut to download select collections from cellxgene
#clone repo https://github.com/chanzuckerberg/single-cell-curation.git
#to run this, cd to single-cell-curation/notebooks/curation-api/python/
from src.dataset import (
download_assets,
get_dataset,
)
from src.collection import (
get_collection
)
from src.utils.config import set_api_access_config
set_api_access_config()
#replace colluction_uuid with desired uuid(s)
collection_ids=[collection_uuid]
#initialize empy list for 'collections', which we will pass to get_dataset to get download links
#see curation-api/python/src/dataset.py for reference
collections=[]
datasets=[]
for id in collection_ids:
collection = get_collection(id)
collections.append(collection)
#print(collections)
#iterate through collections list and get dataset object, which contains download links we will pass to download_assets
#see src/dataset.py for source code
for item in collections:
for dataset in item['datasets']:
datasets.append(get_dataset(item['collection_id'],dataset['dataset_id']))
#download all h5ad and rds files for given collections
download_assets(datasets)