Index: /mds-and-trees/tree-genealogy.py
===================================================================
--- /mds-and-trees/tree-genealogy.py	(revision 576)
+++ /mds-and-trees/tree-genealogy.py	(revision 577)
@@ -16,12 +16,14 @@
 svg_file = 0
 
-svg_line_style = 'stroke="rgb(90%,10%,16%)" stroke-width="1" stroke-opacity="0.8"'
+svg_line_style = 'stroke="rgb(90%,10%,16%)" stroke-width="1" stroke-opacity="0.7"'
+svg_mutation_line_style = 'stroke="black" stroke-width="1" stroke-opacity="0.7"'
+svg_crossover_line_style = 'stroke="darkviolet" stroke-width="1" stroke-opacity="0.7"'
+svg_spine_line_style = 'stroke="rgb(0%,90%,40%)" stroke-width="2" stroke-opacity="1"'
+svg_scale_line_style = 'stroke="black" stroke-width="0.5" stroke-opacity="1" stroke-dasharray="5, 5"'
+
 svg_dot_style = 'r="2" stroke="black" stroke-width="0.2" fill="red"'
 svg_clear_dot_style = 'r="2" stroke="black" stroke-width="0.4" fill="none"'
-
-svg_spine_line_style = 'stroke="rgb(0%,0%,80%)" stroke-width="2" stroke-opacity="1"'
 svg_spine_dot_style = 'r="1" stroke="black" stroke-width="0.2" fill="rgb(50%,50%,100%)"'
 
-svg_scale_line_style = 'stroke="black" stroke-width="0.5" stroke-opacity="1" stroke-dasharray="5, 5"'
 svg_scale_text_style = 'style="font-family: Arial; font-size: 12; fill: #000000;"'
 
@@ -60,22 +62,11 @@
            + str(from_col[2]*(1-percent) + to_col[2]*percent) + '%)" stroke-width="' + str(stroke) + '" stroke-opacity="' + str(opa) + '"'
 
-def svg_generate_dot_style(percent):
-    from_col = [100, 70, 0]
-    to_col = [60, 0, 0]
-    # neon
-    # from_col = [30, 200, 255]
-    # to_col = [240, 0, 220]
-
-    from_opa = 0.2
-    to_opa = 1.0
-
-    opa = from_opa*(1-percent) + to_opa*percent
-
-    percent = 1 - ((1-percent)**20)
-
-    return 'fill="rgb(' + str(from_col[0]*(1-percent) + to_col[0]*percent) + '%,' \
-           + str(from_col[1]*(1-percent) + to_col[1]*percent) + '%,' \
-           + str(from_col[2]*(1-percent) + to_col[2]*percent) + '%)" r="1.5" stroke="black" stroke-width="0.2" fill-opacity="' + str(opa) + '" ' \
-           'stroke-opacity="' + str(opa) + '"'
+def svg_generate_dot_style(kind):
+    kinds = ["red", "lawngreen", "royalblue", "magenta", "yellow", "cyan", "white", "black"]
+
+    r = min(2500/len(nodes), 10)
+
+    return 'fill="' + kinds[kind] + '" r="' + str(r) + '" stroke="black" stroke-width="' + str(r/10) + '" fill-opacity="1.0" ' \
+           'stroke-opacity="1.0"'
 
 # -------------------
@@ -106,4 +97,7 @@
                 if "Time" in creature:
                     time[creature["ID"]] = creature["Time"]
+
+                if "Kind" in creature:
+                    kind[creature["ID"]] = creature["Kind"]
 
     for k, v in sorted(nodes.items()):
@@ -182,10 +176,4 @@
             visited[c] = True
 
-        # if JITTER == True:
-        #     dissimilarity = random.gauss(0,1)
-        # else:
-        #     dissimilarity = 1
-        #     #TODO take this info from proper fields
-
         cy = 0
         if TIME == "BIRTHS":
@@ -262,5 +250,12 @@
             draw_children_recurrent(c, max_depth)
 
-        line_style = (svg_line_style if args.mono_tree else svg_generate_line_style(depth[c]/max_depth))
+        line_style = ""
+        if COLORING == "NONE":
+            line_style = svg_line_style
+        elif COLORING == "TYPE":
+            line_style = (svg_mutation_line_style if len(nodes[c]) == 1 else svg_crossover_line_style)
+        else: # IMPORTANCE, default
+            line_style = svg_generate_line_style(depth[c]/max_depth)
+
         for k, v in sorted(nodes[c].items()):
             svg_add_line( (w_margin+w_no_margs*(positions[k][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[k][1]/max_height),
@@ -269,8 +264,8 @@
         if DOT_STYLE == "NONE":
             continue
-        elif DOT_STYLE == "CLEAR":
-            dot_style = svg_clear_dot_style
+        elif DOT_STYLE == "KIND":
+            dot_style = svg_generate_dot_style(kind[c] if c in kind else 0) #type
         else: # NORMAL, default
-            dot_style = svg_generate_dot_style(depth[c]/max_depth)
+            dot_style = svg_clear_dot_style #svg_generate_dot_style(depth[c]/max_depth)
         svg_add_dot( (w_margin+w_no_margs*(positions[c][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[c][1]/max_height), dot_style)
 def draw_children():
@@ -286,8 +281,8 @@
     if DOT_STYLE == "NONE":
         return
-    elif DOT_STYLE == "CLEAR":
-        dot_style = svg_clear_dot_style
+    elif DOT_STYLE == "KIND":
+        dot_style = svg_generate_dot_style(kind[firstnode] if firstnode in kind else 0)
     else: # NORMAL, default
-        dot_style = svg_generate_dot_style(depth[firstnode]/max_depth)
+        dot_style = svg_clear_dot_style #svg_generate_dot_style(depth[c]/max_depth)
     svg_add_dot( (w_margin+w_no_margs*(positions[firstnode][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[firstnode][1]/max_height), dot_style)
 
@@ -350,5 +345,5 @@
     if TIME == "GENERATIONAL":
        end_text = "Depth " + str(max([v for k, v in depth.items()]))
-    svg_add_text( end_text, (w, h-h_margin - 5), "end")
+    svg_add_text( end_text, (w, h-h_margin + 15), "end")
 
 
@@ -377,7 +372,8 @@
 depth = {}
 time = {}
+kind = {}
 
 def main():
-    global svg_file, min_skeleton_depth, args, TIME, BALANCE, DOT_STYLE, JITTER
+    global svg_file, min_skeleton_depth, args, TIME, BALANCE, DOT_STYLE, COLORING, JITTER
 
     parser = argparse.ArgumentParser(description='Process some integers.')
@@ -402,14 +398,8 @@
                                                                       'REAL: real time of the simulation')
     parser.add_argument('-b', '--balance', default='MIN', dest='balance', help='method of placing node in the tree (RANDOM/MIN/DENSITY)')
-
-    parser.add_argument('-s', '--scale', default='NONE', dest='scale', help='type of timescale added to the tree (NONE/SIMPLE/FULL)')
-
-    parser.add_argument('-d', '--dots', default='NORMAL', dest='dots', help='method of drawing dots (individuals) (NONE/NORMAL/CLEAR)')
-
+    parser.add_argument('-s', '--scale', default='NONE', dest='scale', help='type of timescale added to the tree (NONE/SIMPLE)')
+    parser.add_argument('-c', '--coloring', default='IMPORTANCE', dest="coloring", help='method of coloring the tree (NONE/IMPORTANCE/TYPE)')
+    parser.add_argument('-d', '--dots', default='NORMAL', dest='dots', help='method of drawing dots (individuals) (NONE/NORMAL/TYPE)')
     parser.add_argument('-j', '--jitter', dest="jitter", action='store_true', help='draw horizontal positions of children from the normal distribution')
-
-    mono_tree_parser = parser.add_mutually_exclusive_group(required=False)
-    mono_tree_parser.add_argument('--mono-tree', dest='mono_tree', action='store_true', help='whether the tree should be drawn with a single color')
-    mono_tree_parser.add_argument('--no-mono-tree', dest='mono_tree', action='store_false')
 
     parser.add_argument('--min-skeleton-depth', type=int, default=2, dest='min_skeleton_depth', help='minimal distance from the leafs for the nodes in the skeleton')
@@ -418,5 +408,4 @@
     parser.add_argument('--simple-data', type=bool, dest='simple_data', help='input data are given in a simple format (#child #parent)')
 
-    parser.set_defaults(mono_tree=False)
     parser.set_defaults(draw_tree=True)
     parser.set_defaults(draw_skeleton=False)
@@ -430,4 +419,5 @@
     BALANCE = args.balance
     DOT_STYLE = args.dots
+    COLORING = args.coloring
     JITTER = args.jitter
 
