From 703891794bb56b8dd53ff7dbc1f7c452e3f87035 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Mon, 1 Nov 2010 14:52:45 -0700 Subject: [PATCH] Check for s_${lane}_02_matrix.txt as well as s_${lane}_1_matrix.txt It still could use more test coverage --- htsworkflow/pipelines/bustard.py | 17 +++++++++++++---- .../pipelines/test/simulate_runfolder.py | 5 +++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/htsworkflow/pipelines/bustard.py b/htsworkflow/pipelines/bustard.py index 25b2737..49c1f16 100644 --- a/htsworkflow/pipelines/bustard.py +++ b/htsworkflow/pipelines/bustard.py @@ -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') diff --git a/htsworkflow/pipelines/test/simulate_runfolder.py b/htsworkflow/pipelines/test/simulate_runfolder.py index 50fca0a..5b79c2e 100644 --- a/htsworkflow/pipelines/test/simulate_runfolder.py +++ b/htsworkflow/pipelines/test/simulate_runfolder.py @@ -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): -- 2.30.2