def test_bad_aligner_parameter_raises_exception(self): """ Pass a aligner parameter that is not specified in the aligners config file """ available_aligners = ('star', 'snapr') default_aligner = 'star' # create a PipelineBuilder and add mocked pipeline/project objects as patches p = PipelineBuilder('/path/to/dir') mock_pipeline_params = Params() mock_pipeline_params.add(available_aligners = available_aligners, default_aligner = default_aligner, aligner='junk') p.builder_params = mock_pipeline_params p._PipelineBuilder__get_aligner_info = mock.Mock() with self.assertRaises(IncorrectAlignerException): p._PipelineBuilder__check_aligner_valid()
def test_missing_aligner_config_file_raises_exception(self, mock_os): available_aligners = ('star', 'snapr') default_aligner = 'star' # create a PipelineBuilder and add mocked pipeline/project objects as patches p = PipelineBuilder('/path/to/dir') mock_pipeline_params = Params() mock_pipeline_params.add(available_aligners=available_aligners, default_aligner=default_aligner, aligner=None, aligners_dir='/path/to/dir', genome='mm9') p.builder_params = mock_pipeline_params p._PipelineBuilder__get_aligner_info = mock.Mock() mock_os.listdir.return_value = [] with self.assertRaises(ConfigFileNotFoundException): p._PipelineBuilder__check_aligner_valid()
def test_default_aligner_used_when_not_specified(self, mock_os): """ If no commandline arg given for aligner, check that it resorts to the default """ available_aligners = ('star', 'snapr') default_aligner = 'star' # create a PipelineBuilder and add mocked pipeline/project objects as patches p = PipelineBuilder('/path/to/dir') mock_pipeline_params = Params() mock_pipeline_params.add(available_aligners = available_aligners, default_aligner = default_aligner, aligner=None, aligners_dir = '/path/to/dir', genome = 'hg19') p.builder_params = mock_pipeline_params p.all_components = [] p._PipelineBuilder__get_aligner_info = mock.Mock() mock_os.listdir.return_value = ['star.cfg'] p._PipelineBuilder__check_aligner_valid() self.assertEqual(p.builder_params.get('aligner'), default_aligner)