Spaces:
Runtime error
Runtime error
Commit ·
c4c5be0
1
Parent(s): 034ad05
fix downloaded file paths
Browse files
app.py
CHANGED
|
@@ -15,23 +15,6 @@ from itertools import chain
|
|
| 15 |
from huggingface_hub import hf_hub_download
|
| 16 |
|
| 17 |
|
| 18 |
-
def unzip(file):
|
| 19 |
-
with gzip.open(file, 'rb') as f_in:
|
| 20 |
-
with open(file.replace('.gz', ''), 'wb') as f_out:
|
| 21 |
-
shutil.copyfileobj(f_in, f_out)
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
hf_hub_download(repo_id="dylanplummer/islet-epigenome", filename="rna.h5ad.gz", repo_type="dataset", token=os.environ['DATASET_SECRET'])
|
| 25 |
-
hf_hub_download(repo_id="dylanplummer/islet-epigenome", filename="hic.h5ad.gz", repo_type="dataset", token=os.environ['DATASET_SECRET'])
|
| 26 |
-
hf_hub_download(repo_id="dylanplummer/islet-epigenome", filename="dcq_prior_10kb_ice_0.99.graphml.gz", repo_type="dataset", token=os.environ['DATASET_SECRET'])
|
| 27 |
-
unzip('rna.h5ad.gz')
|
| 28 |
-
unzip('hic.h5ad.gz')
|
| 29 |
-
|
| 30 |
-
hf_hub_download(repo_id="dylanplummer/HiGLUE-islet", filename="glue_hic_dcq_prior_10kb_ice_0.99.dill", repo_type="model", token=os.environ['DATASET_SECRET'])
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
prior_name = 'dcq'
|
| 36 |
resolution = '10kb'
|
| 37 |
loop_q = 0.99
|
|
@@ -43,7 +26,28 @@ window_size = 64
|
|
| 43 |
eps = 1e-4
|
| 44 |
n_neighbors = 5
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
scglue.models.configure_dataset(rna, "NB", use_highly_variable=True, use_rep="X_pca", use_layer="counts")
|
| 48 |
|
| 49 |
celltypes = sorted(rna.obs['celltype'].unique())
|
|
@@ -55,12 +59,12 @@ rna_color_map = {celltype + '_rna': colors[i] for i, celltype in enumerate(cellt
|
|
| 55 |
color_map = {**color_map, **sorted_color_map, **rna_color_map}
|
| 56 |
color_map['Other'] = 'gray'
|
| 57 |
|
| 58 |
-
hic = ad.read_h5ad(
|
| 59 |
print(hic)
|
| 60 |
print('Loading prior knowledge graph...')
|
| 61 |
-
prior = nx.read_graphml(
|
| 62 |
scglue.models.configure_dataset(hic, "NB", use_highly_variable=True)
|
| 63 |
-
glue = scglue.models.load_model(
|
| 64 |
|
| 65 |
|
| 66 |
genes = []
|
|
|
|
| 15 |
from huggingface_hub import hf_hub_download
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
prior_name = 'dcq'
|
| 19 |
resolution = '10kb'
|
| 20 |
loop_q = 0.99
|
|
|
|
| 26 |
eps = 1e-4
|
| 27 |
n_neighbors = 5
|
| 28 |
|
| 29 |
+
|
| 30 |
+
def unzip(file):
|
| 31 |
+
with gzip.open(file, 'rb') as f_in:
|
| 32 |
+
new_file = file.replace('.gz', '')
|
| 33 |
+
with open(new_file, 'wb') as f_out:
|
| 34 |
+
shutil.copyfileobj(f_in, f_out)
|
| 35 |
+
return new_file
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
rna_file = hf_hub_download(repo_id="dylanplummer/islet-epigenome", filename="rna.h5ad.gz", repo_type="dataset", token=os.environ['DATASET_SECRET'])
|
| 39 |
+
hic_file = hf_hub_download(repo_id="dylanplummer/islet-epigenome", filename="hic.h5ad.gz", repo_type="dataset", token=os.environ['DATASET_SECRET'])
|
| 40 |
+
graph_file = hf_hub_download(repo_id="dylanplummer/islet-epigenome", filename=f"{prior_name}_prior_{resolution}_{suffix}.graphml.gz", repo_type="dataset", token=os.environ['DATASET_SECRET'])
|
| 41 |
+
rna_file = unzip(rna_file)
|
| 42 |
+
hic_file = unzip('hic.h5ad.gz')
|
| 43 |
+
|
| 44 |
+
model_file = hf_hub_download(repo_id="dylanplummer/HiGLUE-islet", filename=f"glue_hic_{prior_name}_prior_{resolution}_{suffix}.dill", repo_type="model", token=os.environ['DATASET_SECRET'])
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
rna = ad.read_h5ad(rna_file)
|
| 51 |
scglue.models.configure_dataset(rna, "NB", use_highly_variable=True, use_rep="X_pca", use_layer="counts")
|
| 52 |
|
| 53 |
celltypes = sorted(rna.obs['celltype'].unique())
|
|
|
|
| 59 |
color_map = {**color_map, **sorted_color_map, **rna_color_map}
|
| 60 |
color_map['Other'] = 'gray'
|
| 61 |
|
| 62 |
+
hic = ad.read_h5ad(hic_file)
|
| 63 |
print(hic)
|
| 64 |
print('Loading prior knowledge graph...')
|
| 65 |
+
prior = nx.read_graphml(graph_file)
|
| 66 |
scglue.models.configure_dataset(hic, "NB", use_highly_variable=True)
|
| 67 |
+
glue = scglue.models.load_model(model_file)
|
| 68 |
|
| 69 |
|
| 70 |
genes = []
|