aboutsummaryrefslogtreecommitdiff
path: root/backend/data
diff options
context:
space:
mode:
Diffstat (limited to 'backend/data')
-rwxr-xr-xbackend/data/downloadImgsForReview.py4
-rwxr-xr-xbackend/data/genOtolData.py16
2 files changed, 10 insertions, 10 deletions
diff --git a/backend/data/downloadImgsForReview.py b/backend/data/downloadImgsForReview.py
index 03e22a8..d5ccf62 100755
--- a/backend/data/downloadImgsForReview.py
+++ b/backend/data/downloadImgsForReview.py
@@ -66,10 +66,10 @@ if not os.path.exists(outDir):
print("Finding next ID to download for")
nextIdx = 0
fileList = os.listdir(outDir)
-ids = list(map(lambda filename: int(filename.split(" ")[0]), fileList))
+ids = [int(filename.split(" ")[0]) for filename in fileList]
if len(ids) > 0:
ids.sort()
- nextIdx = eolIds.index(ids[-1])
+ nextIdx = eolIds.index(ids[-1]) + 1
if nextIdx == len(eolIds):
print("No IDs left. Exiting...")
sys.exit(0)
diff --git a/backend/data/genOtolData.py b/backend/data/genOtolData.py
index 7dfac54..9298106 100755
--- a/backend/data/genOtolData.py
+++ b/backend/data/genOtolData.py
@@ -1,12 +1,12 @@
#!/usr/bin/python3
-import sys, re, json, sqlite3
-import os.path
+import sys, os.path, re
+import json, sqlite3
usageInfo = f"usage: {sys.argv[0]}\n"
-usageInfo += "Reads labelled_supertree_ottnames.tre & annotations.json (from an Open Tree of Life release), \n"
+usageInfo += "Reads labelled_supertree_ottnames.tre & annotations.json (from an Open Tree of Life release),\n"
usageInfo += "and creates a sqlite database, which holds entries of the form (name text, data text).\n"
-usageInfo += "Each row holds a tree-of-life node's name, JSON-encoded child name array, a parent name or '', \n"
+usageInfo += "Each row holds a tree-of-life node's name, JSON-encoded child name array, a parent name or '',\n"
usageInfo += "number of descendant 'tips', and a 1 or 0 indicating phylogenetic-support.\n"
usageInfo += "\n"
usageInfo += "Expected labelled_supertree_ottnames.tre format:\n"
@@ -30,10 +30,10 @@ idToName = {} # Maps node IDs to names
nameToFirstId = {} # Maps node names to first found ID (names might have multiple IDs)
dupNameToIds = {} # Maps names of nodes with multiple IDs to those node IDs
-## Check for existing db
-#if os.path.exists(dbFile):
-# print("ERROR: Existing {} db".format(dbFile), file=sys.stderr)
-# sys.exit(1)
+# Check for existing db
+if os.path.exists(dbFile):
+ print("ERROR: Existing {} db".format(dbFile), file=sys.stderr)
+ sys.exit(1)
# Parse treeFile
print("Parsing tree file")
data = None