aboutsummaryrefslogtreecommitdiff
path: root/backend/data/genOtolData.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-05-11 12:43:38 +1000
committerTerry Truong <terry06890@gmail.com>2022-05-11 12:43:38 +1000
commit4872ce9c22cc3c7024075f66409efdaf8860e9b8 (patch)
treef47f0683a2260ac4a41062615e344d1c9b847c3c /backend/data/genOtolData.py
parent6c61612564b9a30f747207c43729c3e7e8cbf0d3 (diff)
Do minor code cleanup
Diffstat (limited to 'backend/data/genOtolData.py')
-rwxr-xr-xbackend/data/genOtolData.py16
1 files changed, 8 insertions, 8 deletions
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