Check for s_${lane}_02_matrix.txt as well as s_${lane}_1_matrix.txt
authorDiane Trout <diane@caltech.edu>
Mon, 1 Nov 2010 21:52:45 +0000 (14:52 -0700)
committerDiane Trout <diane@caltech.edu>
Mon, 1 Nov 2010 21:52:45 +0000 (14:52 -0700)
It still could use more test coverage

htsworkflow/pipelines/bustard.py
htsworkflow/pipelines/test/simulate_runfolder.py

index 25b273792b6f7a1f0ebad315e36372636f0bac21..49c1f16b703e8a64d1a68fa8d5925dbe52985ac5 100644 (file)
@@ -168,11 +168,20 @@ def crosstalk_matrix_from_bustard_config(bustard_path, bustard_config_tree):
         # we estimated the matrix from something in this run.
         # though we don't really care which lane it was
         if matrix_auto_lane == 0:
-            matrix_path = os.path.join(bustard_path, 
-                                       'Matrix', 's_02_matrix.txt')
+            auto_lane_fragment = ""
         else:
-            matrix_path = os.path.join(bustard_path, 'Matrix',
-                           's_%d_1_matrix.txt' % (matrix_auto_lane,))
+            auto_lane_fragment = "_%d" % ( matrix_auto_lane,)
+            
+        for matrix_name in ['s%s_02_matrix.txt' % (auto_lane_fragment,),
+                            's%s_1_matrix.txt' % (auto_lane_fragment,),
+                            ]:
+            matrix_path = os.path.join(bustard_path, 'Matrix', matrix_name)
+            if os.path.exists(matrix_path):
+                break
+        else:
+            raise RuntimeError("Couldn't find matrix for lane %d" % \
+                               (matrix_auto_lane,))
+
         crosstalk = CrosstalkMatrix(matrix_path)
     else:
         matrix_elements = call_parameters.find('MatrixElements')
index 50fca0a06251d922a13873ffa0eba5a3248111a4..5b79c2ea19ee4e12a250fed9026c1792722bda6c 100644 (file)
@@ -186,8 +186,9 @@ def make_matrix_dir_rta160(bustard_dir):
         os.mkdir(destdir)
         
     source = os.path.join(TESTDATA_DIR, '61MMFAAXX_4_1_matrix.txt')
-    for lane in LANE_LIST:
-        destination = os.path.join(destdir, 's_%d_1_matrix.txt' % ( lane, ))
+    lane_fragments = [ "_%d" % (l,) for l in LANE_LIST]
+    for fragment in lane_fragments:
+        destination = os.path.join(destdir, 's%s_1_matrix.txt' % ( fragment, ))
         shutil.copy(source, destination)
         
 def make_phasing_dir(bustard_dir):