Initial port to python3
[htsworkflow.git] / htsworkflow / pipelines / ipar.py
index f818b3495fbf2fd2d8f2fba13d698188e7680d3f..576bff85aedba54c2cd01b0e0c12d2c18aff5b06 100644 (file)
@@ -52,11 +52,11 @@ class Tiles(object):
     return value_list
 
   def items(self):
-    return zip(self.keys(), self.values())
+    return list(zip(list(self.keys()), list(self.values())))
 
   def __getitem__(self, key):
     # FIXME: this is inefficient. building the dictionary be rescanning the xml.
-    v = dict(self.items())
+    v = dict(list(self.items()))
     return v[key]
 
 class IPAR(object):
@@ -146,12 +146,12 @@ class IPAR(object):
         """
         suffix_node = self.tree.find('RunParameters/CompressionSuffix')
         if suffix_node is None:
-          print "find compression suffix failed"
+          print("find compression suffix failed")
           return None
         suffix = suffix_node.text
         files = []
         format = "%s_%s_%04d_%s.txt%s"
-        for lane, attrib in self.tiles.items():
+        for lane, attrib in list(self.tiles.items()):
           for file_type in ["int","nse"]:
             start, stop = attrib['TileRange']
             for tile in range(start, stop+1):
@@ -159,8 +159,8 @@ class IPAR(object):
         return files
 
     def dump(self):
-        print "Matrix:", self.matrix
-        print "Tree:", self.tree
+        print("Matrix:", self.matrix)
+        print("Tree:", self.tree)
 
     def get_elements(self):
         attribs = {'version': str(IPAR.XML_VERSION) }
@@ -195,7 +195,7 @@ def load_ipar_param_tree(paramfile):
 
     tree = ElementTree.parse(paramfile).getroot()
     run = tree.find('Run')
-    if run.attrib.has_key('Name') and run.attrib['Name'] in SOFTWARE_NAMES:
+    if 'Name' in run.attrib and run.attrib['Name'] in SOFTWARE_NAMES:
         return run
     else:
         LOGGER.info("No run found")