diff --git a/README.md b/README.md index 0e9f549654..e4bf6b1783 100644 --- a/README.md +++ b/README.md @@ -63,4 +63,7 @@ For development, use `poetry install --all-extras` to install development depend [codefactor-badge]: https://www.codefactor.io/repository/github/clinical-genomics/cg/badge [codefactor-url]: https://www.codefactor.io/repository/github/clinical-genomics/cg [black-image]: https://img.shields.io/badge/code%20style-black-000000.svg -[black-url]: https://github.com/psf/black \ No newline at end of file +[black-url]: https://github.com/psf/black + +Old codes find the light, Newer maps trace hidden flaws, Healing with data. + diff --git a/cg/services/analysis_starter/configurator/file_creators/nextflow/params_file/raredisease.py b/cg/services/analysis_starter/configurator/file_creators/nextflow/params_file/raredisease.py index f435346a82..2468352b76 100644 --- a/cg/services/analysis_starter/configurator/file_creators/nextflow/params_file/raredisease.py +++ b/cg/services/analysis_starter/configurator/file_creators/nextflow/params_file/raredisease.py @@ -24,7 +24,6 @@ class RarediseaseParamsFileCreator(ParamsFileCreator): - def __init__(self, store: Store, lims: LimsAPI, params: str): super().__init__(params) self.store = store @@ -91,7 +90,7 @@ def _get_target_bed_from_lims(self, case_id: str) -> str: if target_bed_shortname: bed_version: BedVersion = ( self.store.get_bed_version_by_short_name_and_genome_version_strict( - short_name=target_bed_shortname, genome_version=BedVersionGenomeVersion.HG19 + short_name=target_bed_shortname, genome_version=BedVersionGenomeVersion.HG38 ) ) return bed_version.filename diff --git a/cg/services/analysis_starter/configurator/file_creators/nextflow/utils.py b/cg/services/analysis_starter/configurator/file_creators/nextflow/utils.py index 513bcaa640..23f1c32a10 100644 --- a/cg/services/analysis_starter/configurator/file_creators/nextflow/utils.py +++ b/cg/services/analysis_starter/configurator/file_creators/nextflow/utils.py @@ -7,7 +7,7 @@ def get_genome_build(workflow: Workflow) -> GenePanelGenomeBuild | None: workflow_to_genome_build: dict[Workflow, GenePanelGenomeBuild] = { Workflow.MIP_DNA: GenePanelGenomeBuild.hg19, Workflow.NALLO: GenePanelGenomeBuild.hg38, - Workflow.RAREDISEASE: GenePanelGenomeBuild.hg19, + Workflow.RAREDISEASE: GenePanelGenomeBuild.hg38, Workflow.TOMTE: GenePanelGenomeBuild.hg38, } return workflow_to_genome_build.get(workflow) diff --git a/cg/services/analysis_starter/factories/configurator_factory.py b/cg/services/analysis_starter/factories/configurator_factory.py index 5e92a7a34b..8df1f3a982 100644 --- a/cg/services/analysis_starter/factories/configurator_factory.py +++ b/cg/services/analysis_starter/factories/configurator_factory.py @@ -211,7 +211,7 @@ def _get_managed_variants_file_creator(self, workflow: Workflow) -> ManagedVaria def _get_scout_api(self, workflow: Workflow) -> ScoutAPI: return ( self.cg_config.scout_api_38 - if workflow == Workflow.NALLO + if workflow in [Workflow.NALLO, Workflow.RAREDISEASE] else self.cg_config.scout_api_37 ) diff --git a/tests/services/analysis_starter/file_creators/params_file/test_params_file_creator.py b/tests/services/analysis_starter/file_creators/params_file/test_params_file_creator.py index 237b1e72e8..40f1392513 100644 --- a/tests/services/analysis_starter/file_creators/params_file/test_params_file_creator.py +++ b/tests/services/analysis_starter/file_creators/params_file/test_params_file_creator.py @@ -51,7 +51,7 @@ def test_raredisease_params_file_creator( lambda short_name, genome_version: ( create_autospec(BedVersion, filename="bed_version.bed") if short_name == "target_bed_shortname_123" - and genome_version == BedVersionGenomeVersion.HG19 + and genome_version == BedVersionGenomeVersion.HG38 else create_autospec(BedVersion) ) ) diff --git a/tests/services/analysis_starter/file_creators/test_gene_panel_file_creator.py b/tests/services/analysis_starter/file_creators/test_gene_panel_file_creator.py index 7733a85f9c..968613c3e2 100644 --- a/tests/services/analysis_starter/file_creators/test_gene_panel_file_creator.py +++ b/tests/services/analysis_starter/file_creators/test_gene_panel_file_creator.py @@ -223,7 +223,7 @@ def test_add_gene_panels_in_combo( "case_id, expected_genome_build", [ (MIP_DNA_CASE_ID, GenePanelGenomeBuild.hg19), - (RAREDISEASE_CASE_ID, GenePanelGenomeBuild.hg19), + (RAREDISEASE_CASE_ID, GenePanelGenomeBuild.hg38), (NALLO_CASE_ID, GenePanelGenomeBuild.hg38), (TOMTE_CASE_ID, GenePanelGenomeBuild.hg38), ], diff --git a/tests/services/analysis_starter/test_configurator_factory.py b/tests/services/analysis_starter/test_configurator_factory.py index 0d6767494c..ab795d6e01 100644 --- a/tests/services/analysis_starter/test_configurator_factory.py +++ b/tests/services/analysis_starter/test_configurator_factory.py @@ -82,8 +82,6 @@ def test_get_microsalt_configurator(cg_context: CGConfig): @pytest.mark.parametrize( "workflow, pipeline_extension_class", [ - (Workflow.NALLO, NalloExtension), - (Workflow.RAREDISEASE, RarediseaseExtension), (Workflow.RNAFUSION, PipelineExtension), (Workflow.TAXPROFILER, PipelineExtension), (Workflow.TOMTE, TomteExtension), @@ -109,6 +107,50 @@ def test_nextflow_configurator_factory_success( assert isinstance(configurator.pipeline_extension, pipeline_extension_class) +def test_nextflow_configurator_factory_raredisease_success( + cg_context: CGConfig, +): + # GIVEN a configurator factory + configurator_factory = ConfiguratorFactory(cg_config=cg_context) + + # WHEN getting the configurator for the workflow + configurator = cast( + NextflowConfigurator, configurator_factory.get_configurator(Workflow.RAREDISEASE) + ) + + # THEN the configurator is of the expected type + assert isinstance(configurator, NextflowConfigurator) + assert isinstance(configurator.params_file_creator, ParamsFileCreator) + assert isinstance(configurator.sample_sheet_creator, SampleSheetCreator) + assert isinstance(configurator.pipeline_extension, RarediseaseExtension) + assert ( + configurator.pipeline_extension.gene_panel_file_creator.scout_api == cg_context.scout_api_38 + ) + assert ( + configurator.pipeline_extension.managed_variants_file_creator.scout_api + == cg_context.scout_api_38 + ) + + +def test_nextflow_configurator_factory_nallo_success( + cg_context: CGConfig, +): + # GIVEN a configurator factory + configurator_factory = ConfiguratorFactory(cg_config=cg_context) + + # WHEN getting the configurator for the workflow + configurator = cast(NextflowConfigurator, configurator_factory.get_configurator(Workflow.NALLO)) + + # THEN the configurator is of the expected type + assert isinstance(configurator, NextflowConfigurator) + assert isinstance(configurator.params_file_creator, ParamsFileCreator) + assert isinstance(configurator.sample_sheet_creator, SampleSheetCreator) + assert isinstance(configurator.pipeline_extension, NalloExtension) + assert ( + configurator.pipeline_extension.gene_panel_file_creator.scout_api == cg_context.scout_api_38 + ) + + def test_get_mip_dna_configurator(): # GIVEN a MIP-DNA config mip_config: MipConfig = create_autospec(