Initial port to python3
[htsworkflow.git] / htsworkflow / pipelines / ipar.py
index 376c5bd98ecbfe082329c4d3d75f238be47de182..576bff85aedba54c2cd01b0e0c12d2c18aff5b06 100644 (file)
@@ -19,7 +19,7 @@ import re
 import stat
 import time
 
-from htsworkflow.pipelines.runfolder import \
+from htsworkflow.pipelines import \
    ElementTree, \
    VERSION_RE, \
    EUROPEAN_STRPTIME
@@ -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")
@@ -226,7 +226,8 @@ def ipar(pathname):
         # its still live.
 
     # look for parameter xml file
-    paramfiles = [os.path.join(pathname, 'config.xml'),
+    paramfiles = [os.path.join(pathname, 'RTAConfig.xml'),
+                  os.path.join(pathname, 'config.xml'),
                   os.path.join(path, '.params')]
     for paramfile in paramfiles:
         if os.path.exists(paramfile):