Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,38 @@ for species, imgpath in species_to_imgpath.items():
|
|
22 |
nodename = filename.split('.')[0].split('-')[0]
|
23 |
protoID = filename.split('.')[0].split('-')[1]
|
24 |
nodename_to_protoIDs[nodename].append(protoID)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
def display_tree():
|
|
|
22 |
nodename = filename.split('.')[0].split('-')[0]
|
23 |
protoID = filename.split('.')[0].split('-')[1]
|
24 |
nodename_to_protoIDs[nodename].append(protoID)
|
25 |
+
|
26 |
+
|
27 |
+
class Node():
|
28 |
+
def __init__(self, name):
|
29 |
+
self.name = name
|
30 |
+
self.children = []
|
31 |
+
|
32 |
+
def add_child(child):
|
33 |
+
self.children.append(child)
|
34 |
+
|
35 |
+
|
36 |
+
name_to_node = {}
|
37 |
+
|
38 |
+
for species, imgpath in species_to_imgpath.items():
|
39 |
+
for foldername in os.listdir(imgpath):
|
40 |
+
if os.path.isdir(os.path.join(imgpath, foldername)):
|
41 |
+
folderpath = os.path.join(imgpath, foldername)
|
42 |
+
node_name = foldername
|
43 |
+
child_names = [filename.split('.')[0].split('-')[0] for filename in os.listdir(folderpath)]
|
44 |
+
|
45 |
+
if node_name in name_to_node:
|
46 |
+
node = name_to_node
|
47 |
+
# To be finished
|
48 |
+
# for filename in os.listdir(folderpath):
|
49 |
+
# if filename.endswith('png') or filename.endswith('jpg'):
|
50 |
+
# filepath = os.path.join(folderpath, filename)
|
51 |
+
# imgname_to_filepath[filename] = filepath
|
52 |
+
# nodename = filename.split('.')[0].split('-')[0]
|
53 |
+
# protoID = filename.split('.')[0].split('-')[1]
|
54 |
+
# nodename_to_protoIDs[nodename].append(protoID)
|
55 |
+
|
56 |
+
|
57 |
|
58 |
|
59 |
def display_tree():
|