-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path00-download-data.py
More file actions
37 lines (27 loc) · 1003 Bytes
/
00-download-data.py
File metadata and controls
37 lines (27 loc) · 1003 Bytes
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
# C. Savonen 2021
# See refinebio-py tutorials for more info:
# https://alexslemonade.github.io/refinebio-py/quickstart.html
import os
from pathlib import Path
import pyrefinebio
# Define the file path to the data directory
data_dir = Path('data/SRP070849')
# Declare the file path to the gene expression matrix file
data_file = Path(os.path.join(data_dir, 'SRP070849.tsv'))
# Declare the file path to the metadata file
# inside the directory saved as `data_dir`
metadata_file = Path(os.path.join(data_dir, 'metadata_SRP070849.tsv'))
try:
os.mkdir(data_dir, mode = 0o777)
except OSError as error:
print(error)
# Only download the data if it doesn't exist locally
if not data_file.exists() or not metadata_file.exists():
print("Downloading SRP070849 from refine.bio")
pyrefinebio.create_token(agree_to_terms=True, save_token=False)
pyrefinebio.download_dataset(
"data/dataset.zip",
"cansav09@gmail.com",
experiments=["SRP070849"],
extract=True
)