def test_creates_contrasts_correctly_with_no_contrast_file_given(self): #make some samples: all_samples = [Sample('A', 'X'), Sample('B', 'Y'), Sample('C', 'Z')] p = PipelineBuilder('') mock_pipeline_params = Params() mock_pipeline_params.add(skip_analysis = False) mock_pipeline_params.add(contrast_file = None) p.builder_params = mock_pipeline_params p.all_samples = all_samples p._PipelineBuilder__check_contrast_file() expected_result = set([('X','Y'),('X','Z'),('Y','Z')]) self.assertTrue(set_of_tuples_is_equivalent(p.contrasts, expected_result))
def test_raises_exception_if_non_sensible_contrast_specified(self, mock_parse): #make some samples: all_samples = [Sample('A', 'X'), Sample('B', 'Y'), Sample('C', 'Z')] p = PipelineBuilder('') mock_pipeline_params = Params() mock_pipeline_params.add(skip_analysis = False) mock_pipeline_params.add(contrast_file = 'contrast.txt') p.builder_params = mock_pipeline_params p.all_samples = all_samples # note the specification of a contrast of Y against A. However, we have no samples from condition A. mock_parse.return_value = set([('X','Y'),('X','Z'),('Y','A')]) with self.assertRaises(ContrastSpecificationException): p._PipelineBuilder__check_contrast_file()