From f940b1d67fe2bf7eabc437b4724cf66f1f7d7fa0 Mon Sep 17 00:00:00 2001 From: peterpru Date: Wed, 22 Jan 2025 15:22:26 +0100 Subject: [PATCH 1/4] nallo metrics-deliver --- cg/cli/workflow/nallo/base.py | 3 +- cg/constants/nf_analysis.py | 4 + cg/meta/workflow/nallo.py | 5 + .../nf_analysis/test_cli_metrics_deliver.py | 6 +- tests/conftest.py | 122 +++++++++++++++++- .../fixtures/analysis/nallo/multiqc_data.json | 33 +++++ ...ase_enough_reads_metrics_deliverables.yaml | 79 ++++++++++++ 7 files changed, 244 insertions(+), 8 deletions(-) create mode 100644 tests/fixtures/analysis/nallo/multiqc_data.json create mode 100644 tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml diff --git a/cg/cli/workflow/nallo/base.py b/cg/cli/workflow/nallo/base.py index 4c724e8561..fb1cad2a76 100644 --- a/cg/cli/workflow/nallo/base.py +++ b/cg/cli/workflow/nallo/base.py @@ -6,7 +6,7 @@ from cg.cli.utils import CLICK_CONTEXT_SETTINGS -from cg.cli.workflow.nf_analysis import config_case, run, start +from cg.cli.workflow.nf_analysis import config_case, run, start, metrics_deliver from cg.constants.constants import MetaApis from cg.meta.workflow.analysis import AnalysisAPI @@ -26,3 +26,4 @@ def nallo(context: click.Context) -> None: nallo.add_command(config_case) nallo.add_command(run) nallo.add_command(start) +nallo.add_command(metrics_deliver) diff --git a/cg/constants/nf_analysis.py b/cg/constants/nf_analysis.py index 87e7cd72b9..377e1fbb70 100644 --- a/cg/constants/nf_analysis.py +++ b/cg/constants/nf_analysis.py @@ -15,6 +15,10 @@ class NfTowerStatus(StrEnum): UNKNOWN: str = "UNKNOWN" +NALLO_METRIC_CONDITIONS: dict[str, dict[str, Any]] = { + "median_coverage": {"norm": "gt", "threshold": 25}, +} + RAREDISEASE_PREDICTED_SEX_METRIC = "predicted_sex_sex_check" RAREDISEASE_METRIC_CONDITIONS: dict[str, dict[str, Any]] = { diff --git a/cg/meta/workflow/nallo.py b/cg/meta/workflow/nallo.py index f53b431b04..12cd944cec 100644 --- a/cg/meta/workflow/nallo.py +++ b/cg/meta/workflow/nallo.py @@ -1,7 +1,9 @@ """Module for Nallo Analysis API.""" import logging + from cg.constants import Workflow +from cg.constants.nf_analysis import NALLO_METRIC_CONDITIONS from cg.constants.subject import PlinkPhenotypeStatus, PlinkSex from cg.meta.workflow.nf_analysis import NfAnalysisAPI from cg.models.cg_config import CGConfig @@ -91,3 +93,6 @@ def get_built_workflow_parameters(self, case_id: str) -> NalloParameters: input=self.get_sample_sheet_path(case_id=case_id), outdir=outdir, ) + + def get_workflow_metrics(self, metric_id: str) -> dict: + return NALLO_METRIC_CONDITIONS diff --git a/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py b/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py index 08c617f7b0..4e4aabb481 100644 --- a/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py +++ b/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py @@ -18,7 +18,7 @@ @pytest.mark.parametrize( "workflow", - [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE], + [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE, Workflow.NALLO], ) def test_metrics_deliver_without_options( cli_runner: CliRunner, workflow: Workflow, request: FixtureRequest @@ -38,7 +38,7 @@ def test_metrics_deliver_without_options( @pytest.mark.parametrize( "workflow", - [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE], + [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE, Workflow.NALLO], ) def test_metrics_deliver_with_missing_case( cli_runner: CliRunner, @@ -69,7 +69,7 @@ def test_metrics_deliver_with_missing_case( @pytest.mark.parametrize( "workflow", - [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE], + [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE, Workflow.NALLO], ) def test_metrics_deliver_case( cli_runner: CliRunner, diff --git a/tests/conftest.py b/tests/conftest.py index 59dd031208..46251f7011 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -866,6 +866,12 @@ def mip_dna_analysis_dir(mip_analysis_dir: Path) -> Path: return Path(mip_analysis_dir, "dna") +@pytest.fixture +def nallo_analysis_dir(analysis_dir: Path) -> Path: + """Return the path to the directory with nallo analysis files.""" + return Path(analysis_dir, "nallo") + + @pytest.fixture def nf_analysis_analysis_dir(fixtures_dir: Path) -> Path: """Return the path to the directory with nf-analysis files.""" @@ -2528,7 +2534,7 @@ def sequencing_platform() -> str: @pytest.fixture(scope="session") def nallo_case_id() -> str: """Returns a nallo case id.""" - return "nallo_case_two_samples" + return "nallo_case_enough_reads" @pytest.fixture(scope="function") @@ -2557,7 +2563,7 @@ def nallo_context( helpers.add_case(status_db, internal_id=no_sample_case_id, name=no_sample_case_id) # Create textbook case with two samples - nallo_case_two_samples: Case = helpers.add_case( + nallo_case_enough_reads: Case = helpers.add_case( store=status_db, internal_id=nallo_case_id, name=nallo_case_id, @@ -2584,13 +2590,13 @@ def nallo_context( helpers.add_relationship( status_db, - case=nallo_case_two_samples, + case=nallo_case_enough_reads, sample=nallo_sample_one, ) helpers.add_relationship( status_db, - case=nallo_case_two_samples, + case=nallo_case_enough_reads, sample=another_nallo_sample, ) return cg_context @@ -2612,6 +2618,114 @@ def nallo_config(nallo_dir: Path, nallo_case_id: str) -> None: ).touch(exist_ok=True) +@pytest.fixture(scope="function") +def nallo_deliverable_data( + nallo_dir: Path, nallo_case_id: str, sample_id: str +) -> dict: + return { + "files": [ + { + "path": f"{nallo_dir}/{nallo_case_id}/multiqc/multiqc_report.html", + "path_index": "", + "step": "report", + "tag": ["multiqc-html"], + "id": nallo_case_id, + "format": "html", + "mandatory": True, + }, + ] + } + + +@pytest.fixture(scope="function") +def nallo_metrics_deliverables(nallo_analysis_dir: Path) -> list[dict]: + """Returns the content of a mock metrics deliverables file.""" + return read_yaml( + file_path=Path(nallo_analysis_dir, "nallo_case_enough_reads_metrics_deliverables.yaml") + ) + + +@pytest.fixture(scope="function") +def nallo_metrics_deliverables_path(nallo_dir: Path, nallo_case_id: str) -> Path: + """Path to deliverables file.""" + return Path(nallo_dir, nallo_case_id, f"{nallo_case_id}_metrics_deliverables").with_suffix( + FileExtensions.YAML + ) + + +@pytest.fixture(scope="function") +def nallo_mock_analysis_finish( + nallo_dir: Path, + nallo_case_id: str, + nallo_multiqc_json_metrics: dict, + tower_id: int, +) -> None: + """Create analysis finish file for testing.""" + Path.mkdir(Path(nallo_dir, nallo_case_id, "pipeline_info"), parents=True, exist_ok=True) + Path(nallo_dir, nallo_case_id, "pipeline_info", software_version_file).touch(exist_ok=True) + Path(nallo_dir, nallo_case_id, f"{nallo_case_id}_samplesheet.csv").touch(exist_ok=True) + Path.mkdir( + Path(nallo_dir, nallo_case_id, "multiqc", "multiqc_data"), + parents=True, + exist_ok=True, + ) + write_json( + content=nallo_multiqc_json_metrics, + file_path=Path( + nallo_dir, + nallo_case_id, + "multiqc", + "multiqc_data", + "multiqc_data", + ).with_suffix(FileExtensions.JSON), + ) + write_yaml( + content={nallo_case_id: [tower_id]}, + file_path=Path( + nallo_dir, + nallo_case_id, + "tower_ids", + ).with_suffix(FileExtensions.YAML), + ) + + +@pytest.fixture(scope="function") +def nallo_mock_deliverable_dir( + nallo_dir: Path, nallo_deliverable_data: dict, nallo_case_id: str +) -> Path: + """Create raredisease deliverable file with dummy data and files to deliver.""" + Path.mkdir( + Path(nallo_dir, nallo_case_id), + parents=True, + exist_ok=True, + ) + Path.mkdir( + Path(nallo_dir, nallo_case_id, "multiqc"), + parents=True, + exist_ok=True, + ) + for report_entry in nallo_deliverable_data["files"]: + Path(report_entry["path"]).touch(exist_ok=True) + WriteFile.write_file_from_content( + content=nallo_deliverable_data, + file_format=FileFormat.JSON, + file_path=Path(nallo_dir, nallo_case_id, nallo_case_id + deliverables_yaml), + ) + return nallo_dir + + +@pytest.fixture +def nallo_multiqc_json_metrics_path(nallo_analysis_dir: Path) -> Path: + """Return Multiqc JSON file path for nallo.""" + return Path(nallo_analysis_dir, multiqc_json_file) + + +@pytest.fixture +def nallo_multiqc_json_metrics(nallo_multiqc_json_metrics_path: Path) -> list[dict]: + """Returns the content of a mock Multiqc JSON file.""" + return read_json(file_path=nallo_multiqc_json_metrics_path) + + @pytest.fixture(scope="function") def nallo_nexflow_config_file_path(nallo_dir, nallo_case_id) -> Path: """Path to config file.""" diff --git a/tests/fixtures/analysis/nallo/multiqc_data.json b/tests/fixtures/analysis/nallo/multiqc_data.json new file mode 100644 index 0000000000..aedb6c7c1d --- /dev/null +++ b/tests/fixtures/analysis/nallo/multiqc_data.json @@ -0,0 +1,33 @@ +{ + "report_data_sources": {}, + "report_general_stats_data": [ + { + "ADM1": { + "mean_coverage": 32.18, + "min_coverage": 0.0, + "max_coverage": 63906.0, + "coverage_bases": 99366056494, + "length": 3088286377, + "1_x_pc": 94.0, + "5_x_pc": 94.0, + "10_x_pc": 93.0, + "30_x_pc": 65.0, + "50_x_pc": 2.0, + "median_coverage": 13 + }, + "ADM2": { + "mean_coverage": 32.18, + "min_coverage": 0.0, + "max_coverage": 63906.0, + "coverage_bases": 99366056494, + "length": 3088286377, + "1_x_pc": 94.0, + "5_x_pc": 94.0, + "10_x_pc": 93.0, + "30_x_pc": 65.0, + "50_x_pc": 2.0, + "median_coverage": 33 + } + } + ] +} diff --git a/tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml b/tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml new file mode 100644 index 0000000000..1da56c37f2 --- /dev/null +++ b/tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml @@ -0,0 +1,79 @@ +--- +metrics: +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: mean_coverage + step: multiqc + value: 32.18 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: min_coverage + step: multiqc + value: 0.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: max_coverage + step: multiqc + value: 63906.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: coverage_bases + step: multiqc + value: 99366056494 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: length + step: multiqc + value: 3088286377 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: 1_x_pc + step: multiqc + value: 94.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: 5_x_pc + step: multiqc + value: 94.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: 10_x_pc + step: multiqc + value: 93.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: 30_x_pc + step: multiqc + value: 65.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: 50_x_pc + step: multiqc + value: 2.0 +- condition: null + header: null + id: ADM1_1 + input: multiqc_data.json + name: median_coverage + step: multiqc + value: 13 \ No newline at end of file From 5fb2a36593b98653f65ec48bdc2b4e9c804dee2b Mon Sep 17 00:00:00 2001 From: peterpru Date: Thu, 23 Jan 2025 12:32:01 +0100 Subject: [PATCH 2/4] add nallo to more config-case tests --- .../nf_analysis/test_cli_config_case.py | 6 +- .../nf_analysis/test_cli_metrics_deliver.py | 24 ++++++- tests/cli/workflow/test_cli_workflow.py | 1 + tests/conftest.py | 67 +++++++++++++------ 4 files changed, 71 insertions(+), 27 deletions(-) diff --git a/tests/cli/workflow/nf_analysis/test_cli_config_case.py b/tests/cli/workflow/nf_analysis/test_cli_config_case.py index f3c5dcc834..ff73087a51 100644 --- a/tests/cli/workflow/nf_analysis/test_cli_config_case.py +++ b/tests/cli/workflow/nf_analysis/test_cli_config_case.py @@ -44,7 +44,7 @@ def test_config_case_without_options( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_config_with_missing_case( cli_runner: CliRunner, @@ -74,7 +74,7 @@ def test_config_with_missing_case( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_config_case_without_samples( cli_runner: CliRunner, @@ -185,7 +185,7 @@ def test_config_case_default_parameters( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_config_case_dry_run( cli_runner: CliRunner, diff --git a/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py b/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py index 4e4aabb481..b105372d38 100644 --- a/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py +++ b/tests/cli/workflow/nf_analysis/test_cli_metrics_deliver.py @@ -18,7 +18,13 @@ @pytest.mark.parametrize( "workflow", - [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE, Workflow.NALLO], + [ + Workflow.RAREDISEASE, + Workflow.RNAFUSION, + Workflow.TAXPROFILER, + Workflow.TOMTE, + Workflow.NALLO, + ], ) def test_metrics_deliver_without_options( cli_runner: CliRunner, workflow: Workflow, request: FixtureRequest @@ -38,7 +44,13 @@ def test_metrics_deliver_without_options( @pytest.mark.parametrize( "workflow", - [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE, Workflow.NALLO], + [ + Workflow.RAREDISEASE, + Workflow.RNAFUSION, + Workflow.TAXPROFILER, + Workflow.TOMTE, + Workflow.NALLO, + ], ) def test_metrics_deliver_with_missing_case( cli_runner: CliRunner, @@ -69,7 +81,13 @@ def test_metrics_deliver_with_missing_case( @pytest.mark.parametrize( "workflow", - [Workflow.RAREDISEASE, Workflow.RNAFUSION, Workflow.TAXPROFILER, Workflow.TOMTE, Workflow.NALLO], + [ + Workflow.RAREDISEASE, + Workflow.RNAFUSION, + Workflow.TAXPROFILER, + Workflow.TOMTE, + Workflow.NALLO, + ], ) def test_metrics_deliver_case( cli_runner: CliRunner, diff --git a/tests/cli/workflow/test_cli_workflow.py b/tests/cli/workflow/test_cli_workflow.py index 80bb612b75..91ff6c18c3 100644 --- a/tests/cli/workflow/test_cli_workflow.py +++ b/tests/cli/workflow/test_cli_workflow.py @@ -21,6 +21,7 @@ def test_no_options(cli_runner: CliRunner, base_context: CGConfig): assert "microsalt" in result.output assert "mip-dna" in result.output assert "mip-rna" in result.output + assert "nallo" in result.output assert "raredisease" in result.output assert "rnafusion" in result.output assert "taxprofiler" in result.output diff --git a/tests/conftest.py b/tests/conftest.py index 46251f7011..661114c285 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2118,7 +2118,7 @@ def context_config( "workflow_bin_path": Path("workflow", "path").as_posix(), "profile": "myprofile", "references": Path("path", "to", "references").as_posix(), - "revision": "dev", + "revision": "2.2.0", "root": str(nallo_dir), "slurm": { "account": "development", @@ -2516,7 +2516,7 @@ def bam_unmapped_read_paths(housekeeper_dir: Path) -> Path: """Path to existing bam read file.""" bam_unmapped_read_path = Path( housekeeper_dir, "m00000_000000_000000_s4.hifi_reads.bc2021" - ).with_suffix(f"{AlignmentFileTag.BAM}") + ).with_suffix(f".{AlignmentFileTag.BAM}") with open(bam_unmapped_read_path, "wb") as wh: wh.write( b"1f 8b 08 04 00 00 00 00 00 ff 06 00 42 43 02 00 1b 00 03 00 00 00 00 00 00 00 00 00" @@ -2543,62 +2543,89 @@ def nallo_context( helpers: StoreHelpers, nf_analysis_housekeeper: HousekeeperAPI, trailblazer_api: MockTB, - hermes_api: HermesApi, - cg_dir: Path, nallo_case_id: str, sample_id: str, + father_sample_id: str, sample_name: str, another_sample_name: str, - father_sample_id: str, no_sample_case_id: str, + total_sequenced_reads_pass: int, wgs_long_read_application_tag: str, + case_id_not_enough_reads: str, + sample_id_not_enough_reads: str, + total_sequenced_reads_not_pass: int, + mocker: MockFixture, ) -> CGConfig: - """Context to use in CLI.""" + """context to use in cli""" cg_context.housekeeper_api_ = nf_analysis_housekeeper cg_context.trailblazer_api_ = trailblazer_api cg_context.meta_apis["analysis_api"] = NalloAnalysisAPI(config=cg_context) status_db: Store = cg_context.status_db + # NB: the order in which the cases are added matters for the tests of store_available + # Create ERROR case with NO SAMPLES helpers.add_case(status_db, internal_id=no_sample_case_id, name=no_sample_case_id) - # Create textbook case with two samples - nallo_case_enough_reads: Case = helpers.add_case( + # Create textbook case with enough reads + case_enough_reads: Case = helpers.add_case( store=status_db, internal_id=nallo_case_id, name=nallo_case_id, data_analysis=Workflow.NALLO, ) - nallo_sample_one: Sample = helpers.add_sample( + sample_enough_reads: Sample = helpers.add_sample( status_db, internal_id=sample_id, name=sample_name, last_sequenced_at=datetime.now(), + reads=total_sequenced_reads_pass, application_tag=wgs_long_read_application_tag, reference_genome=GenomeVersion.HG38, ) - another_nallo_sample: Sample = helpers.add_sample( + another_sample_enough_reads: Sample = helpers.add_sample( status_db, internal_id=father_sample_id, name=another_sample_name, last_sequenced_at=datetime.now(), + reads=total_sequenced_reads_pass, application_tag=wgs_long_read_application_tag, reference_genome=GenomeVersion.HG38, ) helpers.add_relationship( status_db, - case=nallo_case_enough_reads, - sample=nallo_sample_one, + case=case_enough_reads, + sample=sample_enough_reads, ) helpers.add_relationship( status_db, - case=nallo_case_enough_reads, - sample=another_nallo_sample, + case=case_enough_reads, + sample=another_sample_enough_reads, + ) + + # Create case without enough reads + case_not_enough_reads: Case = helpers.add_case( + store=status_db, + internal_id=case_id_not_enough_reads, + name=case_id_not_enough_reads, + data_analysis=Workflow.NALLO, + ) + + sample_not_enough_reads: Sample = helpers.add_sample( + status_db, + internal_id=sample_id_not_enough_reads, + last_sequenced_at=datetime.now(), + reads=total_sequenced_reads_not_pass, + application_tag=wgs_long_read_application_tag, + reference_genome=GenomeVersion.HG38, ) + + helpers.add_relationship(status_db, case=case_not_enough_reads, sample=sample_not_enough_reads) + return cg_context @@ -2619,9 +2646,7 @@ def nallo_config(nallo_dir: Path, nallo_case_id: str) -> None: @pytest.fixture(scope="function") -def nallo_deliverable_data( - nallo_dir: Path, nallo_case_id: str, sample_id: str -) -> dict: +def nallo_deliverable_data(nallo_dir: Path, nallo_case_id: str, sample_id: str) -> dict: return { "files": [ { @@ -2693,7 +2718,7 @@ def nallo_mock_analysis_finish( def nallo_mock_deliverable_dir( nallo_dir: Path, nallo_deliverable_data: dict, nallo_case_id: str ) -> Path: - """Create raredisease deliverable file with dummy data and files to deliver.""" + """Create nallo deliverable file with dummy data and files to deliver.""" Path.mkdir( Path(nallo_dir, nallo_case_id), parents=True, @@ -2720,10 +2745,10 @@ def nallo_multiqc_json_metrics_path(nallo_analysis_dir: Path) -> Path: return Path(nallo_analysis_dir, multiqc_json_file) -@pytest.fixture -def nallo_multiqc_json_metrics(nallo_multiqc_json_metrics_path: Path) -> list[dict]: +@pytest.fixture(scope="function") +def nallo_multiqc_json_metrics(nallo_analysis_dir) -> dict: """Returns the content of a mock Multiqc JSON file.""" - return read_json(file_path=nallo_multiqc_json_metrics_path) + return read_json(file_path=Path(nallo_analysis_dir, multiqc_json_file)) @pytest.fixture(scope="function") From 019738b77b8dee2bfafc6df030a6e15dac3794b1 Mon Sep 17 00:00:00 2001 From: peterpru Date: Fri, 24 Jan 2025 09:57:02 +0100 Subject: [PATCH 3/4] fix test --- cg/models/nallo/nallo.py | 6 ++++++ tests/conftest.py | 1 - tests/fixtures/analysis/nallo/multiqc_data.json | 13 ------------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/cg/models/nallo/nallo.py b/cg/models/nallo/nallo.py index c5463d5fe1..46f164ae4a 100644 --- a/cg/models/nallo/nallo.py +++ b/cg/models/nallo/nallo.py @@ -7,6 +7,12 @@ from cg.models.nf_analysis import WorkflowParameters +class NalloQCMetrics(BaseModel): + """Nallo QC metrics""" + + median_coverage: float | None + + class NalloSampleSheetEntry(BaseModel): """Nallo sample model is used when building the sample sheet.""" diff --git a/tests/conftest.py b/tests/conftest.py index f39f96f124..784d0f98bf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2567,7 +2567,6 @@ def nallo_context( case_id_not_enough_reads: str, sample_id_not_enough_reads: str, total_sequenced_reads_not_pass: int, - mocker: MockFixture, ) -> CGConfig: """context to use in cli""" cg_context.housekeeper_api_ = nf_analysis_housekeeper diff --git a/tests/fixtures/analysis/nallo/multiqc_data.json b/tests/fixtures/analysis/nallo/multiqc_data.json index aedb6c7c1d..ef0c3b817e 100644 --- a/tests/fixtures/analysis/nallo/multiqc_data.json +++ b/tests/fixtures/analysis/nallo/multiqc_data.json @@ -3,19 +3,6 @@ "report_general_stats_data": [ { "ADM1": { - "mean_coverage": 32.18, - "min_coverage": 0.0, - "max_coverage": 63906.0, - "coverage_bases": 99366056494, - "length": 3088286377, - "1_x_pc": 94.0, - "5_x_pc": 94.0, - "10_x_pc": 93.0, - "30_x_pc": 65.0, - "50_x_pc": 2.0, - "median_coverage": 13 - }, - "ADM2": { "mean_coverage": 32.18, "min_coverage": 0.0, "max_coverage": 63906.0, From 680c6f65614ae1f4bcbc817e1a5d88a89b1c7897 Mon Sep 17 00:00:00 2001 From: peterpru Date: Fri, 24 Jan 2025 11:35:31 +0100 Subject: [PATCH 4/4] update yaml fixture --- tests/conftest.py | 2 +- ...llo_fixture_for_metrics_deliverables.yaml} | 28 ++++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) rename tests/fixtures/analysis/nallo/{nallo_case_enough_reads_metrics_deliverables.yaml => nallo_fixture_for_metrics_deliverables.yaml} (86%) diff --git a/tests/conftest.py b/tests/conftest.py index 784d0f98bf..4310773e93 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2678,7 +2678,7 @@ def nallo_deliverable_data(nallo_dir: Path, nallo_case_id: str, sample_id: str) def nallo_metrics_deliverables(nallo_analysis_dir: Path) -> list[dict]: """Returns the content of a mock metrics deliverables file.""" return read_yaml( - file_path=Path(nallo_analysis_dir, "nallo_case_enough_reads_metrics_deliverables.yaml") + file_path=Path(nallo_analysis_dir, "nallo_fixture_for_metrics_deliverables.yaml") ) diff --git a/tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml b/tests/fixtures/analysis/nallo/nallo_fixture_for_metrics_deliverables.yaml similarity index 86% rename from tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml rename to tests/fixtures/analysis/nallo/nallo_fixture_for_metrics_deliverables.yaml index 1da56c37f2..44e0066941 100644 --- a/tests/fixtures/analysis/nallo/nallo_case_enough_reads_metrics_deliverables.yaml +++ b/tests/fixtures/analysis/nallo/nallo_fixture_for_metrics_deliverables.yaml @@ -2,78 +2,80 @@ metrics: - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: mean_coverage step: multiqc value: 32.18 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: min_coverage step: multiqc value: 0.0 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: max_coverage step: multiqc value: 63906.0 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: coverage_bases step: multiqc value: 99366056494 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: length step: multiqc value: 3088286377 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: 1_x_pc step: multiqc value: 94.0 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: 5_x_pc step: multiqc value: 94.0 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: 10_x_pc step: multiqc value: 93.0 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: 30_x_pc step: multiqc value: 65.0 - condition: null header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: 50_x_pc step: multiqc value: 2.0 -- condition: null +- condition: + norm: gt + threshold: 25.0 header: null - id: ADM1_1 + id: ADM1 input: multiqc_data.json name: median_coverage step: multiqc - value: 13 \ No newline at end of file + value: 33 \ No newline at end of file