Skip to content

Commit

Permalink
add things to scout config
Browse files Browse the repository at this point in the history
  • Loading branch information
rannick committed Sep 3, 2024
1 parent 3e92234 commit 57d9b61
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
33 changes: 24 additions & 9 deletions cg/constants/scout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
)

Expand Down Expand Up @@ -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"},
Expand All @@ -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"},
Expand Down
16 changes: 3 additions & 13 deletions cg/meta/upload/scout/raredisease_config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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"""
Expand Down
31 changes: 16 additions & 15 deletions cg/models/scout/scout_load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,21 @@ 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
upd_regions_bed: str | None = None
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
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 57d9b61

Please sign in to comment.