diff util/Reader.py @ 13:43a700afd457 draft

planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit bcb239c4045d2c47a8acad5fbd29eea03663e187
author yating-l
date Tue, 19 Jun 2018 17:59:51 -0400
parents 5d5fdcb798da
children
line wrap: on
line diff
--- a/util/Reader.py	Sat Jun 02 13:08:46 2018 -0400
+++ b/util/Reader.py	Tue Jun 19 17:59:51 2018 -0400
@@ -120,11 +120,15 @@
         # TODO: Optimize this double loop
         for input_data in array_inputs:
             input_false_path = input_data["false_path"]
-            input_data["name"] = santitizer.sanitize_name_input(input_data["name"])
-            extensionObject = ExtensionClass(input_false_path, input_data)
-            extensionObject.generateCustomTrack()
-            datatype_dictionary.update({input_data["order_index"]: extensionObject})
-            self.logger.debug("%s object: %s has been created", ExtensionClass, input_data["name"])
+            # if the file is empty, skip the rest
+            if os.path.isfile(input_false_path) and os.path.getsize(input_false_path) > 0:
+                input_data["name"] = santitizer.sanitize_name_input(input_data["name"])
+                extensionObject = ExtensionClass(input_false_path, input_data)
+                extensionObject.generateCustomTrack()
+                datatype_dictionary.update({input_data["order_index"]: extensionObject})
+                self.logger.debug("%s object: %s has been created", ExtensionClass, input_data["name"])
+            else:
+                self.logger.info("The input file: %s is empty, skip creating the track for this data", input_data["name"])
         return datatype_dictionary