Parse runfolders generated with IPAR 1.3 and pipeline 1.3.2
[htsworkflow.git] / htsworkflow / pipelines / ipar.py
index 9113d6f1717fd6fd2d27fe9c2bd1e848766f2b5d..a9544203afb7ee255c834f07e83ecbed91c39e67 100644 (file)
@@ -12,6 +12,7 @@ fromxml
 __docformat__ = "restructuredtext en"
 
 import datetime
+from glob import glob
 import logging
 import os
 import re
@@ -195,11 +196,17 @@ def ipar(pathname):
     if groups[0] != 'IPAR':
       raise ValueError('ipar can only process IPAR directories')
 
+    bustard_pattern = os.path.join(pathname, 'Bustard*')
     # contents of the matrix file?
     matrix_pathname = os.path.join(pathname, 'Matrix', 's_matrix.txt')
-    if not os.path.exists(matrix_pathname):
+    if os.path.exists(matrix_pathname):
+        # this is IPAR_1.01
+        i.matrix = open(matrix_pathname, 'r').read()
+    elif glob(bustard_pattern) > 0:
+        i.matrix = None
+        # its still live.
+    else:
         return None
-    i.matrix = open(matrix_pathname, 'r').read()
 
     # look for parameter xml file
     paramfile = os.path.join(path, '.params')