Spaces:
Sleeping
Sleeping
Add a run button
Browse files
app.py
CHANGED
|
@@ -13,7 +13,9 @@ st.write("Use hg19, HindIII, chr11, CPGZ and LoopDenoise for the Demo data")
|
|
| 13 |
#########
|
| 14 |
# INPUT #
|
| 15 |
#########
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
training_set = st.selectbox("Select Training Set", ["CPGZ", "H9"], index=0)
|
| 18 |
depth = st.selectbox("Select Depth", ["LoopDenoise", "50M", "101K"], index=0)
|
| 19 |
# TODO Throw a warning that h9 only has LoopDenoise and 100M
|
|
@@ -45,7 +47,6 @@ digestion_enzyme = st.selectbox(
|
|
| 45 |
# val_cols
|
| 46 |
# keep_zeros
|
| 47 |
|
| 48 |
-
|
| 49 |
# Load the model from hugging face
|
| 50 |
from huggingface_hub import from_pretrained_keras
|
| 51 |
|
|
@@ -53,40 +54,38 @@ model = from_pretrained_keras(f"funlab/DeepLoop-{training_set}-{depth}")
|
|
| 53 |
|
| 54 |
from huggingface_hub import snapshot_download
|
| 55 |
|
|
|
|
|
|
|
| 56 |
anchors = snapshot_download(
|
| 57 |
repo_id=f"funlab/{genome}_{digestion_enzyme}_anchor_bed", repo_type="dataset"
|
| 58 |
)
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
anchor_dir=anchors,
|
| 73 |
-
chromosome=chromosome,
|
| 74 |
-
small_matrix_size=128,
|
| 75 |
-
step_size=128,
|
| 76 |
-
dummy=5,
|
| 77 |
-
# max_dist,
|
| 78 |
-
val_cols=["obs", "exp", "pval"],
|
| 79 |
-
# keep_zeros,
|
| 80 |
)
|
| 81 |
-
|
| 82 |
-
st.
|
| 83 |
-
|
| 84 |
-
# Print and list the files
|
| 85 |
-
st.download_button(
|
| 86 |
-
label="Download Denoised Results",
|
| 87 |
-
data=os.path.join(prefix, chromosome + ".denoised.anchor.to.anchor"),
|
| 88 |
-
file_name=chromosome + ".denoised.anchor.to.anchor",
|
| 89 |
-
mime="text/csv",
|
| 90 |
-
)
|
| 91 |
-
st.dataframe(denoised_anchor_to_anchor)
|
| 92 |
-
st.write(os.listdir(prefix))
|
|
|
|
| 13 |
#########
|
| 14 |
# INPUT #
|
| 15 |
#########
|
| 16 |
+
HiCorr_data_hf_repo = st.text_input(
|
| 17 |
+
"HiCorr Data 🤗 Dataset", default="funlab/HiCorr_test_data"
|
| 18 |
+
)
|
| 19 |
training_set = st.selectbox("Select Training Set", ["CPGZ", "H9"], index=0)
|
| 20 |
depth = st.selectbox("Select Depth", ["LoopDenoise", "50M", "101K"], index=0)
|
| 21 |
# TODO Throw a warning that h9 only has LoopDenoise and 100M
|
|
|
|
| 47 |
# val_cols
|
| 48 |
# keep_zeros
|
| 49 |
|
|
|
|
| 50 |
# Load the model from hugging face
|
| 51 |
from huggingface_hub import from_pretrained_keras
|
| 52 |
|
|
|
|
| 54 |
|
| 55 |
from huggingface_hub import snapshot_download
|
| 56 |
|
| 57 |
+
HiCorr_data = snapshot_download(HiCorr_data_hf_repo, repo_type="dataset")
|
| 58 |
+
|
| 59 |
anchors = snapshot_download(
|
| 60 |
repo_id=f"funlab/{genome}_{digestion_enzyme}_anchor_bed", repo_type="dataset"
|
| 61 |
)
|
| 62 |
|
| 63 |
+
if st.button("Run Deeploop", type="primary"):
|
| 64 |
+
denoised_anchor_to_anchor = None
|
| 65 |
+
with st.spinner("Running the model"):
|
| 66 |
+
denoised_anchor_to_anchor = predict_and_write(
|
| 67 |
+
model,
|
| 68 |
+
full_matrix_dir=HiCorr_data + f"/anchor_2_anchor.loop.{chromosome}",
|
| 69 |
+
input_name=HiCorr_data + f"/anchor_2_anchor.loop.{chromosome}.p_val",
|
| 70 |
+
outdir=prefix,
|
| 71 |
+
anchor_dir=anchors,
|
| 72 |
+
chromosome=chromosome,
|
| 73 |
+
small_matrix_size=128,
|
| 74 |
+
step_size=128,
|
| 75 |
+
dummy=5,
|
| 76 |
+
# max_dist,
|
| 77 |
+
val_cols=["obs", "exp", "pval"],
|
| 78 |
+
# keep_zeros,
|
| 79 |
+
)
|
| 80 |
|
| 81 |
+
st.success("Done!")
|
| 82 |
|
| 83 |
+
# Print and list the files
|
| 84 |
+
st.download_button(
|
| 85 |
+
label="Download Denoised Results",
|
| 86 |
+
data=os.path.join(prefix, chromosome + ".denoised.anchor.to.anchor"),
|
| 87 |
+
file_name=chromosome + ".denoised.anchor.to.anchor",
|
| 88 |
+
mime="text/csv",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
)
|
| 90 |
+
st.dataframe(denoised_anchor_to_anchor)
|
| 91 |
+
st.write(os.listdir(prefix))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|