Skip to content

Commit b9d7133

Browse files
committed
fixed LoadingSpinner on features, restart on failure update, replace relative paths for cli script
1 parent 1296f7a commit b9d7133

File tree

13 files changed

+291
-125
lines changed

13 files changed

+291
-125
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*.log
2929

3030
**/setup_dev.sh
31+
**/testImport.json
3132

3233
# VS CODE
3334
**/.vscode

cli/import/exampleImport.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[
22
{
33
"assembly": {
4-
"assemblyID": 34,
5-
"mainFile": "PATH/TO/ASSEMBLY.FASTA",
4+
"mainFile": "PATH/TO/ASSEMBLY.FASTA or use assemblyID key instead",
65
"label": "Assembly label"
76
},
87
"taxon": {

cli/import/importDataset.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from os import getcwd
99

1010
DB_NAME = "gnom_db"
11-
HELP_STRING = ""
11+
HELP_STRING = "Example call: python3 importDataset.py PATH/TO/JSON"
1212
BASE_PATH_TO_IMPORT = "/flask-backend/data/import/"
1313

1414
__location__ = realpath(join(getcwd(), dirname(__file__)))
@@ -45,7 +45,7 @@ def loadDataset(datasets_path):
4545
print("Valid inputs...")
4646

4747
try:
48-
with open(join(__location__, "local.config")) as config_file:
48+
with open(join(__location__, "../../local.config")) as config_file:
4949
config_params = config_file.readlines()
5050
config_file.close()
5151

@@ -66,7 +66,8 @@ def loadDataset(datasets_path):
6666
def importDatasets(datasets, config):
6767
uuid = str(uuid1())
6868
try:
69-
for dataset in datasets:
69+
for idx, dataset in enumerate(datasets):
70+
print(f"Starting {idx+1}/{len(datasets)}")
7071
if "assemblyID" in dataset["assembly"] and dataset["assembly"]["assemblyID"] > 0:
7172
pass
7273
elif "mainFile" in dataset["assembly"] and exists(dataset["assembly"]["mainFile"]):
@@ -252,7 +253,7 @@ def importDatasets(datasets, config):
252253

253254
print("Removing tmp files...")
254255
run(args=["rm", "-r", tmp_dir])
255-
256+
print(f"{idx+1}/{len(datasets)} imported!\n")
256257
return 1
257258

258259
except Exception as err:

flask-backend/src/Routes/analyses.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def analyses_bp_fetchRepeatmaskerAnalysesByAssemblyID():
247247
return REQUESTMETHODERROR
248248

249249

250-
# FETCH TAXON IMAGE BY TAXON ID
250+
# FETCH FILES BY PATH (example: Milts plot)
251251
@analyses_bp.route("/fetchFileByPath", methods=["GET"])
252252
def analyses_bp_fetchFileByPath():
253253
if request.method == "GET":

flask-backend/src/Routes/annotations.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ def annotations_bp_fetchFeatureTypes():
201201

202202

203203
# FETCH ALL KEYS IN ATTRIBUTE SECTION
204-
@annotations_bp.route("/fetchFeatureAttributeKeys", methods=["GET"])
204+
@annotations_bp.route("/fetchFeatureAttributeKeys", methods=["Post"])
205205
def annotations_bp_fetchFeatureAttributeKeys():
206-
if request.method == "GET":
207-
userID = request.args.get("userID", None)
208-
token = request.args.get("token", None)
206+
if request.method == "POST":
207+
req = request.get_json(force=True)
208+
userID = req.get("userID", None)
209+
token = req.get("token", None)
209210

210211
# token still active
211212
valid_token, error = validateActiveToken(userID, token)
@@ -214,7 +215,11 @@ def annotations_bp_fetchFeatureAttributeKeys():
214215
response.headers.add("Access-Control-Allow-Origin", "*")
215216
return response
216217

217-
data, notification = fetchFeatureAttributeKeys()
218+
taxonIDs = req.get("taxonIDs", None)
219+
assemblyID = req.get("assemblyID", None)
220+
types = req.get("types", None)
221+
222+
data, notification = fetchFeatureAttributeKeys(assemblyID, taxonIDs, types)
218223

219224
response = jsonify({"payload": data, "notification": notification})
220225
response.headers.add("Access-Control-Allow-Origin", "*")

0 commit comments

Comments
 (0)