From 57d9b615cc5745868f6039357401f21fa68c25a8 Mon Sep 17 00:00:00 2001 From: Annick Renevey <47788523+rannick@users.noreply.github.com> Date: Tue, 3 Sep 2024 16:06:04 +0200 Subject: [PATCH] add things to scout config --- cg/constants/scout.py | 33 ++++++++++++++----- .../scout/raredisease_config_builder.py | 16 ++------- cg/models/scout/scout_load_config.py | 31 ++++++++--------- 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/cg/constants/scout.py b/cg/constants/scout.py index 47da27108a..b0b5fb2736 100644 --- a/cg/constants/scout.py +++ b/cg/constants/scout.py @@ -41,18 +41,20 @@ class ScoutUploadKey(StrEnum): RAREDISEASE_CASE_TAGS = dict( delivery_report={"delivery-report"}, - multiqc_report={"multiqc-html"}, + multiqc={"multiqc-html"}, peddy_check={"ped-check", "peddy"}, peddy_ped={"ped", "peddy"}, peddy_sex={"sex-check", "peddy"}, smn_tsv={"smn-calling"}, - snv_research_vcf={"vcf-snv-research"}, - snv_vcf={"vcf-snv-clinical"}, - str_catalog={"expansionhunter", "variant-catalog"}, - sv_research_vcf={"vcf-sv-research"}, - sv_vcf={"vcf-sv-clinical"}, vcf_mei={"mobile-elements", "clinical", "vcf"}, vcf_mei_research={"mobile-elements", "research", "vcf"}, + vcf_snv_research={"vcf-snv-research"}, + vcf_snv={"vcf-snv-clinical"}, + vcf_snv_research_mt={"vcf-sv-research", "mitochondria"}, + vcf_snv_mt={"vcf-sv-clinical", "mitochondria"}, + str_catalog={"expansionhunter", "variant-catalog"}, + vcf_sv_research={"vcf-sv-research"}, + vcf_sv={"vcf-sv-clinical"}, vcf_str={"vcf-str"}, ) @@ -101,9 +103,9 @@ class ScoutUploadKey(StrEnum): vcf_fusion={"vcf-fusion"}, ) -RAREDISEASE_SAMPLE_TAGS = dict( +RAREDISEASE_SAMPLE_TAGS: dict[str, set[str]] = dict( bam_file={"bam"}, - # alignment_file={"cram"}, + alignment_file={"cram"}, vcf2cytosure={"vcf2cytosure"}, mt_bam={"bam-mt"}, chromograph_autozyg={"chromograph", "autozyg"}, @@ -116,7 +118,20 @@ class ScoutUploadKey(StrEnum): mitodel_file={"mitodel"}, ) -MIP_SAMPLE_TAGS: dict[str, set[str]] = RAREDISEASE_SAMPLE_TAGS +MIP_SAMPLE_TAGS: dict[str, set[str]] = dict( + bam_file={"bam"}, + alignment_file={"cram"}, + vcf2cytosure={"vcf2cytosure"}, + mt_bam={"bam-mt"}, + chromograph_autozyg={"chromograph", "autozyg"}, + chromograph_coverage={"chromograph", "tcov"}, + chromograph_regions={"chromograph", "regions"}, + chromograph_sites={"chromograph", "sites"}, + reviewer_alignment={"expansionhunter", "bam"}, + reviewer_alignment_index={"expansionhunter", "bam-index"}, + reviewer_vcf={"expansionhunter", "vcf-str"}, + mitodel_file={"mitodel"}, +) BALSAMIC_SAMPLE_TAGS = dict( bam_file={"bam"}, diff --git a/cg/meta/upload/scout/raredisease_config_builder.py b/cg/meta/upload/scout/raredisease_config_builder.py index 242185c9ff..fc9475b502 100644 --- a/cg/meta/upload/scout/raredisease_config_builder.py +++ b/cg/meta/upload/scout/raredisease_config_builder.py @@ -60,7 +60,7 @@ def build_load_config(self, rank_score_threshold: int = 5) -> None: GenomeBuild, self.raredisease_analysis_api.get_genome_build(case_id=self.analysis_obj.case.internal_id), ) - self.load_config.rank_score_threshold = rank_score_threshold + # self.load_config.rank_score_threshold = rank_score_threshold # self.load_config.rank_model_version = raredisease_analysis_data.rank_model_version # self.load_config.sv_rank_model_version = raredisease_analysis_data.sv_rank_model_version @@ -90,8 +90,7 @@ def include_pedigree_picture(self) -> None: LOG.info("family of 1 sample - skip pedigree graph") def build_config_sample(self, case_sample: CaseSample) -> ScoutRarediseaseIndividual: - """Build a sample with mip specific information""" - + """Build a sample with specific information""" config_sample = ScoutRarediseaseIndividual() self.add_common_sample_info(config_sample=config_sample, case_sample=case_sample) self.add_common_sample_files(config_sample=config_sample, case_sample=case_sample) @@ -117,6 +116,7 @@ def include_case_files(self) -> None: def include_sample_files(self, config_sample: ScoutIndividual = None) -> None: for scout_key in RAREDISEASE_SAMPLE_TAGS.keys(): + scout_key = scout_key.replace("chromograph_", "chromograph_images.") self._include_file(scout_key) def _include_file(self, scout_key) -> None: @@ -128,16 +128,6 @@ def _include_file(self, scout_key) -> None: self.get_file_from_hk(getattr(self.case_tags, scout_key)), ) - @staticmethod - def extract_generic_filepath(file_path: str | None) -> str | None: - """Remove a file's suffix and identifying integer or X/Y - Example: - `/some/path/gatkcomb_rhocall_vt_af_chromograph_sites_X.png` becomes - `/some/path/gatkcomb_rhocall_vt_af_chromograph_sites_`""" - if file_path is None: - return file_path - return re.split("(\d+|X|Y)\.png", file_path)[0] - @staticmethod def is_family_case(load_config: ScoutLoadConfig) -> bool: """Check if there are any linked individuals in a case""" diff --git a/cg/models/scout/scout_load_config.py b/cg/models/scout/scout_load_config.py index 2eda3028c8..be53ab34c1 100644 --- a/cg/models/scout/scout_load_config.py +++ b/cg/models/scout/scout_load_config.py @@ -70,12 +70,12 @@ class ScoutMipIndividual(ScoutIndividual): class ScoutRarediseaseIndividual(ScoutIndividual): mt_bam: str | None = None bam_file: str | None = None - chromograph_autozyg: str | None = None - chromograph_coverage: str | None = None - chromograph_regions: ChromographImages = ChromographImages() - chromograph_sites: ChromographImages = ChromographImages() - reviewer_alignment: Reviewer = Reviewer() - reviewer_alignment_index: Reviewer = Reviewer() + # chromograph_autozyg: str | None = None + # chromograph_coverage: str | None = None + # chromograph_regions: ChromographImages = ChromographImages() + # chromograph_sites: ChromographImages = ChromographImages() + # reviewer_alignment: Reviewer = Reviewer() + # reviewer_alignment_index: Reviewer = Reviewer() rhocall_bed: str | None = None rhocall_wig: str | None = None tiddit_coverage_wig: str | None = None @@ -83,7 +83,8 @@ class ScoutRarediseaseIndividual(ScoutIndividual): upd_sites_bed: str | None = None vcf2cytosure: str | None = None mitodel_file: str | None = None - + chromograph_images: ChromographImages = ChromographImages() + reviewer: Reviewer = Reviewer() class ScoutCancerIndividual(ScoutIndividual): tumor_type: str | None = None @@ -114,7 +115,6 @@ class ScoutLoadConfig(BaseModel): coverage_qc_report: str | None = None cnv_report: str | None = None multiqc: str | None = None - multiqc_report: str | None = None track: Literal[UploadTrack.RARE_DISEASE.value, UploadTrack.CANCER.value] = ( UploadTrack.RARE_DISEASE.value ) @@ -155,8 +155,8 @@ class MipLoadConfig(ScoutLoadConfig): class RarediseaseLoadConfig(ScoutLoadConfig): - chromograph_image_files: list[str] | None = None - chromograph_prefixes: list[str] | None = None + # chromograph_image_files: list[str] | None = None + # chromograph_prefixes: list[str] | None = None madeline: str | None = None peddy_check: str | None = None peddy_ped: str | None = None @@ -166,12 +166,13 @@ class RarediseaseLoadConfig(ScoutLoadConfig): str_catalog: str | None = None vcf_mei: str | None = None vcf_mei_research: str | None = None - snv_vcf: Annotated[str, BeforeValidator(field_not_none)] = None - snv_research_vcf: Annotated[str | None, BeforeValidator(field_not_none)] = None + vcf_snv: Annotated[str, BeforeValidator(field_not_none)] = None + vcf_snv_research: Annotated[str | None, BeforeValidator(field_not_none)] = None + vcf_snv_mt: str | None = None + vcf_snv_research_mt: str | None = None + vcf_sv: Annotated[str | None, BeforeValidator(field_not_none)] = None + vcf_sv_research: Annotated[str | None, BeforeValidator(field_not_none)] = None vcf_str: str | None = None - sv_vcf: Annotated[str | None, BeforeValidator(field_not_none)] = None - sv_research_vcf: Annotated[str | None, BeforeValidator(field_not_none)] = None - class RnafusionLoadConfig(ScoutLoadConfig): multiqc_rna: str | None = None