Index: /mds-and-trees/tree-genealogy.py
===================================================================
--- /mds-and-trees/tree-genealogy.py	(revision 709)
+++ /mds-and-trees/tree-genealogy.py	(revision 710)
@@ -154,6 +154,7 @@
                                   self.h_margin+self.h_no_margs*chi_pos['y']/max_height), line_style)
 
-    def draw_scale(self, file, filename):
-        self.add_text(file, "Generated from " + filename.split("\\")[-1], (5, 5), "start")
+    def draw_scale(self, file, filenames):
+        self.add_text(file, "Generated from " + filenames[0].split("\\")[-1]
+                      + (" and " + str(len(filenames)-1) + " more" if len(filenames) > 1 else ""), (5, 5), "start")
 
         start_text = ""
@@ -692,5 +693,5 @@
         pass
 
-    def load(self, filename, max_nodes=0):
+    def load(self, filenames, max_nodes=0):
         print("Loading...")
 
@@ -726,15 +727,17 @@
             return creature
 
-        file = open(filename)
 
         # counting the number of expected nodes
+
         nodes = 0
-        for line in file:
-            line_arr = line.split(' ', 1)
-            if len(line_arr) == 2:
-                if line_arr[0] == CLI_PREFIX:
-                    line_arr = line_arr[1].split(' ', 1)
-                if line_arr[0] == "[BORN]":
-                    nodes += 1
+        for filename in filenames:
+            file = open(filename)
+            for line in file:
+                line_arr = line.split(' ', 1)
+                if len(line_arr) == 2:
+                    if line_arr[0] == CLI_PREFIX:
+                        line_arr = line_arr[1].split(' ', 1)
+                    if line_arr[0] == "[BORN]":
+                        nodes += 1
 
         nodes = min(nodes, max_nodes if max_nodes != 0 else nodes)+1
@@ -748,76 +751,40 @@
         print("nodes: %d" % len(self.parents))
 
-        file.seek(0)
+
+        get_id("virtual_parent")
         loaded_so_far = 0
-        lasttime = timelib.time()
-
-        get_id("virtual_parent")
-
-        for line in file:
-            line_arr = line.split(' ', 1)
-            if len(line_arr) == 2:
-                if line_arr[0] == CLI_PREFIX:
-                    line_arr = line_arr[1].split(' ', 1)
-                if line_arr[0] == "[BORN]":
-                    creature = try_to_load(line_arr[1])
-                    if not creature:
-                        nodes -= 1
-                        break
-
-                    creature_id = get_id(creature["ID"])
-
-                    # debug
-                    if loaded_so_far%1000 == 0:
-                        #print(". " + str(creature_id) + " " + str(timelib.time() - lasttime))
-                        lasttime = timelib.time()
-
-                    if "Time" in creature:
-                        self.time[creature_id] = creature["Time"]
-
-                    for prop in creature:
-                        if prop not in default_props:
-                            if prop not in self.props:
-                                self.props[prop] = [0 for i in range(nodes)]
-                            self.props[prop][creature_id] = creature[prop]
-
-                    loaded_so_far += 1
-
-                if line_arr[0] == "[OFFSPRING]":
-                    creature = try_to_load(line_arr[1])
-                    if not creature:
-                        nodes -= 1
-                        break
-
-                    if "FromIDs" in creature:
-                        # make sure that ID's of parents are lower than that of their children
-                        for i in range(0, len(creature["FromIDs"])):
-                            if creature["FromIDs"][i] not in self.ids:
-                                get_id("virtual_parent")
-
-                        creature_id = get_id(creature["ID"])#, False)
-
-                        # we assign to each parent its contribution to the genotype of the child
-                        for i in range(0, len(creature["FromIDs"])):
-                            if creature["FromIDs"][i] in self.ids:
-                                parent_id = get_id(creature["FromIDs"][i])
-                            else:
-                                if creature["FromIDs"][i] not in merged_with_virtual_parent:
-                                    merged_with_virtual_parent.append(creature["FromIDs"][i])
-                                parent_id = get_id("virtual_parent")
-                            inherited = (creature["Inherited"][i] if 'Inherited' in creature else 1)
-                            self.parents[creature_id][parent_id] = inherited
-
-                        if "Kind" in creature:
-                            self.kind[creature_id] = creature["Kind"]
-                    else:
-                        raise LoadingError("[OFFSPRING] misses the 'FromIDs' field!")
-
-                if line_arr[0] == "[DIED]" or line_arr[0] == "[BORN]":
-                    creature = try_to_load(line_arr[1])
-                    if not creature:
-                        nodes -= 1
-                        break
-                    creature_id = get_id(creature["ID"], False)
-                    if creature_id is not None:
+        max_time = 0
+        # rewind the file
+
+        for filename in filenames:
+            file = open(filename)
+            time_offset = max_time
+            if max_time != 0:
+                print("NOTE: merging the files, the time offset for the file " + filename + " is: " + str(time_offset))
+
+            lasttime = timelib.time()
+
+            for line in file:
+                line_arr = line.split(' ', 1)
+                if len(line_arr) == 2:
+                    if line_arr[0] == CLI_PREFIX:
+                        line_arr = line_arr[1].split(' ', 1)
+                    if line_arr[0] == "[BORN]":
+                        creature = try_to_load(line_arr[1])
+                        if not creature:
+                            nodes -= 1
+                            break
+
+                        creature_id = get_id(creature["ID"])
+
+                        # debug
+                        if loaded_so_far%1000 == 0:
+                            #print(". " + str(creature_id) + " " + str(timelib.time() - lasttime))
+                            lasttime = timelib.time()
+
+                        if "Time" in creature:
+                            self.time[creature_id] = creature["Time"] + time_offset
+                            max_time = max(self.time[creature_id], max_time)
+
                         for prop in creature:
                             if prop not in default_props:
@@ -826,5 +793,52 @@
                                 self.props[prop][creature_id] = creature[prop]
 
-
+                        loaded_so_far += 1
+
+                    if line_arr[0] == "[OFFSPRING]":
+                        creature = try_to_load(line_arr[1])
+                        if not creature:
+                            nodes -= 1
+                            break
+
+                        if "FromIDs" in creature:
+                            # make sure that ID's of parents are lower than that of their children
+                            for i in range(0, len(creature["FromIDs"])):
+                                if creature["FromIDs"][i] not in self.ids:
+                                    get_id("virtual_parent")
+
+                            creature_id = get_id(creature["ID"])#, False)
+
+                            # we assign to each parent its contribution to the genotype of the child
+                            for i in range(0, len(creature["FromIDs"])):
+                                if creature["FromIDs"][i] in self.ids:
+                                    parent_id = get_id(creature["FromIDs"][i])
+                                else:
+                                    if creature["FromIDs"][i] not in merged_with_virtual_parent:
+                                        merged_with_virtual_parent.append(creature["FromIDs"][i])
+                                    parent_id = get_id("virtual_parent")
+                                inherited = (creature["Inherited"][i] if 'Inherited' in creature else 1)
+                                self.parents[creature_id][parent_id] = inherited
+
+                            if "Kind" in creature:
+                                self.kind[creature_id] = creature["Kind"]
+                        else:
+                            raise LoadingError("[OFFSPRING] misses the 'FromIDs' field!")
+
+                    if line_arr[0] == "[DIED]" or line_arr[0] == "[BORN]":
+                        creature = try_to_load(line_arr[1])
+                        if not creature:
+                            nodes -= 1
+                            break
+                        creature_id = get_id(creature["ID"], False)
+                        if creature_id is not None:
+                            for prop in creature:
+                                if prop not in default_props:
+                                    if prop not in self.props:
+                                        self.props[prop] = [0 for i in range(nodes)]
+                                    self.props[prop][creature_id] = creature[prop]
+
+                # breaking both loops
+                if loaded_so_far >= max_nodes and max_nodes != 0:
+                    break
             if loaded_so_far >= max_nodes and max_nodes != 0:
                 break
@@ -848,5 +862,5 @@
     parser = argparse.ArgumentParser(description='Draws a genealogical tree (generates a SVG file) based on parent-child relationship '
                                                  'information from a text file. Supports files generated by Framsticks experiments.')
-    parser.add_argument('-i', '--in', dest='input', required=True, help='input file name with stuctured evolutionary data')
+    parser.add_argument('-i', '--in', nargs='+', dest='input', required=True, help='input file name with stuctured evolutionary data (or a list of input files)')
     parser.add_argument('-o', '--out', dest='output', required=True, help='output file name for the evolutionary tree (SVG/PNG/JPG/BMP)')
     parser.add_argument('-c', '--config', dest='config', default="", help='config file name ')
@@ -886,4 +900,5 @@
 
     dir = args.input
+
     seed = args.seed
     if seed == -1:
