Skip to content

Commit 12c598e

Browse files
committed
simplify local webapp deployment
1 parent 19647c4 commit 12c598e

File tree

7 files changed

+34
-59
lines changed

7 files changed

+34
-59
lines changed

.editorconfig

Whitespace-only changes.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,10 +1371,10 @@ Epub 2022 Dec 15. PMID: 36522432; PMCID: PMC10272994.
13711371

13721372
## 5 Contacts
13731373

1374-
- Luca Pinello, PhD
1374+
- Luca Pinello
13751375
13761376

1377-
- Rosalba Giugno, PhD
1377+
- Rosalba Giugno
13781378
13791379

13801380
- Daniel Bauer

TODO.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

index.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
current_working_directory,
3535
cache,
3636
)
37-
from utils import check_directories
3837

3938
from dash.dependencies import Input, Output, State
4039
from typing import Tuple
@@ -50,6 +49,15 @@
5049
HOST = "0.0.0.0" # server host
5150
PORTWEB = 80 # website port
5251
PORTLOCAL = 8080 # local server port
52+
CRISPRME_DIRS = [
53+
"Genomes",
54+
"Results",
55+
"Dictionaries",
56+
"VCFs",
57+
"Annotations",
58+
"PAMs",
59+
"samplesIDs",
60+
] # crisprme directory tree
5361

5462
# initialize the webpage
5563
server = app.server # start server
@@ -65,6 +73,29 @@
6573
)
6674

6775

76+
def check_directories(basedir: str) -> None:
77+
"""Check and create necessary directories in the specified base directory.
78+
79+
This function verifies if the provided base directory exists and creates
80+
any missing subdirectories defined in the CRISPRME_DIRS list.
81+
82+
Args:
83+
basedir (str): The base directory to check and create subdirectories in.
84+
85+
Raises:
86+
TypeError: If basedir is not a string.
87+
FileNotFoundError: If the base directory does not exist.
88+
"""
89+
90+
if not isinstance(basedir, str):
91+
raise TypeError(f"Expected {str.__name__}, got {type(basedir).__name__}")
92+
if not os.path.exists(basedir):
93+
raise FileNotFoundError(f"Unable to locate {basedir}")
94+
for d in CRISPRME_DIRS:
95+
if not os.path.exists(os.path.join(basedir, d)):
96+
os.makedirs(os.path.join(basedir, d))
97+
98+
6899
# switch between the website pages
69100
@app.callback(
70101
[Output("page-content", "children"), Output("job-link", "children")],

reset_dirs.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.
File renamed without changes.

utils.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,6 @@
44
import sys
55
import os
66

7-
CRISPRME_DIRS = [
8-
"Genomes",
9-
"Results",
10-
"Dictionaries",
11-
"VCFs",
12-
"Annotations",
13-
"PAMs",
14-
"samplesIDs",
15-
]
16-
17-
18-
def check_directories(basedir: str) -> None:
19-
"""The function checks the consistency of CRISPRme's directory tree.
20-
If a directory is not found in the tree, it will be created.
21-
22-
...
23-
24-
Parameters
25-
----------
26-
basedir : str
27-
Base directory
28-
29-
Returns
30-
-------
31-
None
32-
"""
33-
34-
if not isinstance(basedir, str):
35-
raise TypeError(f"Expected {str.__name__}, got {type(basedir).__name__}")
36-
if not os.path.exists(basedir):
37-
raise FileNotFoundError(f"Unable to locate {basedir}")
38-
for d in CRISPRME_DIRS:
39-
if not os.path.exists(os.path.join(basedir, d)):
40-
os.makedirs(os.path.join(basedir, d))
41-
427

438
def download_genome(chr: str, directory: str) -> None:
449
if not isinstance(chr, str):

0 commit comments

Comments
 (0)