Spaces:
Sleeping
Sleeping
refactor: Clean up "results" folder
Browse files- app.py +10 -13
- predict_chromosome.py +1 -7
app.py
CHANGED
|
@@ -13,6 +13,7 @@ st.title("DeepLoop")
|
|
| 13 |
# depth = st.selectbox("Select Model", ["Model 1", "Model 2", "Model 3"])
|
| 14 |
# HACK
|
| 15 |
chromosome = "chr11"
|
|
|
|
| 16 |
|
| 17 |
# Load the model from hugging face
|
| 18 |
from huggingface_hub import from_pretrained_keras
|
|
@@ -28,13 +29,13 @@ HiCorr_data = snapshot_download("funlab/HiCorr_test_data", repo_type="dataset")
|
|
| 28 |
|
| 29 |
import os
|
| 30 |
|
| 31 |
-
os.makedirs(
|
| 32 |
|
| 33 |
-
predict_and_write(
|
| 34 |
model,
|
| 35 |
full_matrix_dir=HiCorr_data + f"/anchor_2_anchor.loop.{chromosome}",
|
| 36 |
input_name=HiCorr_data + f"/anchor_2_anchor.loop.{chromosome}.p_val",
|
| 37 |
-
outdir=
|
| 38 |
anchor_dir=anchors,
|
| 39 |
chromosome=chromosome,
|
| 40 |
small_matrix_size=128,
|
|
@@ -46,15 +47,11 @@ predict_and_write(
|
|
| 46 |
)
|
| 47 |
|
| 48 |
# Print and list the files
|
| 49 |
-
|
| 50 |
-
st.write("Files created:")
|
| 51 |
-
st.write(os.listdir("results"))
|
| 52 |
-
|
| 53 |
-
# Offer a download
|
| 54 |
-
st.write("Download the results")
|
| 55 |
st.download_button(
|
| 56 |
-
label="Download Results",
|
| 57 |
-
data="
|
| 58 |
-
file_name="
|
| 59 |
-
mime="
|
| 60 |
)
|
|
|
|
|
|
|
|
|
| 13 |
# depth = st.selectbox("Select Model", ["Model 1", "Model 2", "Model 3"])
|
| 14 |
# HACK
|
| 15 |
chromosome = "chr11"
|
| 16 |
+
prefix = "results"
|
| 17 |
|
| 18 |
# Load the model from hugging face
|
| 19 |
from huggingface_hub import from_pretrained_keras
|
|
|
|
| 29 |
|
| 30 |
import os
|
| 31 |
|
| 32 |
+
os.makedirs(prefix, exist_ok=True)
|
| 33 |
|
| 34 |
+
denoised_anchor_to_anchor = predict_and_write(
|
| 35 |
model,
|
| 36 |
full_matrix_dir=HiCorr_data + f"/anchor_2_anchor.loop.{chromosome}",
|
| 37 |
input_name=HiCorr_data + f"/anchor_2_anchor.loop.{chromosome}.p_val",
|
| 38 |
+
outdir=prefix,
|
| 39 |
anchor_dir=anchors,
|
| 40 |
chromosome=chromosome,
|
| 41 |
small_matrix_size=128,
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
# Print and list the files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
st.download_button(
|
| 51 |
+
label="Download Denoised Results",
|
| 52 |
+
data=os.path.join(prefix, chromosome + ".denoised.anchor.to.anchor"),
|
| 53 |
+
file_name=chromosome + ".denoised.anchor.to.anchor",
|
| 54 |
+
mime="text/csv",
|
| 55 |
)
|
| 56 |
+
st.dataframe(denoised_anchor_to_anchor)
|
| 57 |
+
st.write(os.listdir(prefix))
|
predict_chromosome.py
CHANGED
|
@@ -221,13 +221,7 @@ def predict_and_write(
|
|
| 221 |
index=False,
|
| 222 |
header=False,
|
| 223 |
)
|
| 224 |
-
|
| 225 |
-
label="Download Denoised Results",
|
| 226 |
-
data=os.path.join(outdir, chromosome + ".denoised.anchor.to.anchor"),
|
| 227 |
-
file_name=chromosome + ".denoised.anchor.to.anchor",
|
| 228 |
-
mime="text/csv",
|
| 229 |
-
)
|
| 230 |
-
st.dataframe(denoised_anchor_to_anchor)
|
| 231 |
|
| 232 |
|
| 233 |
if __name__ == "__main__":
|
|
|
|
| 221 |
index=False,
|
| 222 |
header=False,
|
| 223 |
)
|
| 224 |
+
return denoised_anchor_to_anchor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
|
| 227 |
if __name__ == "__main__":
|