diff --git a/cg/cli/workflow/nallo/base.py b/cg/cli/workflow/nallo/base.py index 204ae6d42a..7e14cbfc93 100644 --- a/cg/cli/workflow/nallo/base.py +++ b/cg/cli/workflow/nallo/base.py @@ -45,4 +45,4 @@ def panel(context: CGConfig, case_id: str, dry_run: bool) -> None: if dry_run: echo_lines(lines=bed_lines) return - analysis_api.write_panel(case_id=case_id, content=bed_lines) + analysis_api.write_panel_as_tsv(case_id=case_id, content=bed_lines) diff --git a/cg/constants/scout.py b/cg/constants/scout.py index 2507a5abbe..7ff0945f86 100644 --- a/cg/constants/scout.py +++ b/cg/constants/scout.py @@ -14,6 +14,7 @@ class GenomeBuild(StrEnum): class ScoutExportFileName(StrEnum): MANAGED_VARIANTS: str = f"managed_variants{FileExtensions.VCF}" PANELS: str = f"gene_panels{FileExtensions.BED}" + PANELS_TSV: str = f"gene_panels{FileExtensions.TSV}" class UploadTrack(StrEnum): diff --git a/cg/meta/workflow/analysis.py b/cg/meta/workflow/analysis.py index 2ff9fd4769..9c1d70b69e 100644 --- a/cg/meta/workflow/analysis.py +++ b/cg/meta/workflow/analysis.py @@ -705,6 +705,17 @@ def _write_panel(out_dir: Path, content: list[str]) -> None: file_path=Path(out_dir, ScoutExportFileName.PANELS), ) + @staticmethod + def _write_panel_as_tsv(out_dir: Path, content: list[str]) -> None: + """Write the gene panel to case dir while omitted the commented BED lines.""" + filtered_content = [line for line in content if not line.startswith("##")] + out_dir.mkdir(parents=True, exist_ok=True) + WriteFile.write_file_from_content( + content="\n".join(filtered_content), + file_format=FileFormat.TXT, + file_path=Path(out_dir, ScoutExportFileName.PANELS_TSV), + ) + def _get_gene_panel(self, case_id: str, genome_build: str, dry_run: bool = False) -> list[str]: """Create and return the aggregated gene panel file.""" case: Case = self.status_db.get_case_by_internal_id(internal_id=case_id) @@ -725,6 +736,10 @@ def write_panel(self, case_id: str, content: list[str]) -> None: """Write the gene panel to case dir.""" self._write_panel(out_dir=Path(self.root, case_id), content=content) + def write_panel_as_tsv(self, case_id: str, content: list[str]) -> None: + """Write the gene panel to case dir.""" + self._write_panel_as_tsv(out_dir=Path(self.root, case_id), content=content) + @staticmethod def get_aggregated_panels(customer_id: str, default_panels: set[str]) -> list[str]: """Check if customer is collaborator for gene panel master list