@@ -74,7 +74,7 @@ def loaded_reports(tmp_path_factory) -> Generator:
7474 ],
7575 'hrd' : {
7676 'score' : 9999.0 ,
77- 'kbCategory ' : 'homologous recombination deficiency strong signature' ,
77+ 'cutoff ' : 5 ,
7878 },
7979 'expressionVariants' : json .loads (
8080 pd .read_csv (get_test_file ('expression.short.tab' ), sep = '\t ' ).to_json (orient = 'records' )
@@ -106,6 +106,7 @@ def loaded_reports(tmp_path_factory) -> Generator:
106106 'caption' : 'Test adding a caption to an image' ,
107107 }
108108 ],
109+ 'config' : 'test config' ,
109110 }
110111
111112 json_file .write_text (
@@ -254,15 +255,30 @@ def test_copy_variants_loaded(self, loaded_reports) -> None:
254255 async_equals_sync = stringify_sorted (section ) == stringify_sorted (async_section )
255256 assert async_equals_sync
256257
257- # # Uncomment when signatureVariants are supported in pori_ipr_api
258- # def test_signature_variants_loaded(self, loaded_reports) -> None:
259- # section = get_section(loaded_reports["sync"], "signature-variants")
260- # kbmatched = [item for item in section if item["kbMatches"]]
261- # assert ("SBS2", "high signature") in [
262- # (item["signatureName"], item["variantTypeName"]) for item in kbmatched
263- # ]
264- # async_section = get_section(loaded_reports["async"], "signature-variants")
265- # assert compare_sections(section, async_section)
258+ def test_signature_variants_loaded (self , loaded_reports ) -> None :
259+ section = get_section (loaded_reports ['sync' ], 'signature-variants' )
260+ kbmatched = [item for item in section if item ['kbMatches' ]]
261+ # Check for COSMIC signatures
262+ assert ('SBS2' , 'high signature' ) in [
263+ (item ['signatureName' ], item ['variantTypeName' ]) for item in kbmatched
264+ ]
265+ # Check for HRD signature (score 9999 > cutoff 5, so strong signature)
266+ assert ('homologous recombination deficiency' , 'strong signature' ) in [
267+ (item ['signatureName' ], item ['variantTypeName' ]) for item in kbmatched
268+ ]
269+ # Check for MSI signature
270+ assert ('microsatellite instability' , 'high signature' ) in [
271+ (item ['signatureName' ], item ['variantTypeName' ]) for item in kbmatched
272+ ]
273+ async_section = get_section (loaded_reports ['async' ], 'signature-variants' )
274+ async_equals_sync = stringify_sorted (section ) == stringify_sorted (async_section )
275+ assert async_equals_sync
276+
277+ def test_hrd_score_in_report (self , loaded_reports ) -> None :
278+ """Test that HRD score is present in the loaded report."""
279+ report = loaded_reports ['sync' ][1 ]['reports' ][0 ]
280+ assert 'hrdScore' in report
281+ assert report ['hrdScore' ] == 9999.0
266282
267283 def test_kb_matches_loaded (self , loaded_reports ) -> None :
268284 section = get_section (loaded_reports ['sync' ], 'kb-matches' )
0 commit comments