File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -538,7 +538,10 @@ def test_ancestral_missingness(tmp_path):
538
538
)
539
539
ds = sgkit .load_dataset (str (zarr_path ) + ".tmp" )
540
540
sd = tsinfer .SgkitSampleData (str (zarr_path ) + ".tmp" )
541
- with pytest .warns (UserWarning , match = "The following alleles were not found" ):
541
+ with pytest .warns (
542
+ UserWarning ,
543
+ match = "Ancestral alleles not found in the variant_allele array for the 3 sites" ,
544
+ ):
542
545
inf_ts = tsinfer .infer (sd )
543
546
for i , (
544
547
inf_var ,
Original file line number Diff line number Diff line change @@ -2405,11 +2405,16 @@ def sites_ancestral_allele(self):
2405
2405
except IndexError :
2406
2406
unknown_alleles [allele ] += 1
2407
2407
ret [i ] = allele_index
2408
- if sum (unknown_alleles .values ()) > 0 :
2408
+ tot = sum (unknown_alleles .values ())
2409
+ if tot > 0 :
2409
2410
warnings .warn (
2410
- "The following alleles were not found in the variant_allele array "
2411
- "and will be treated as unknown:\n "
2412
- f"{ unknown_alleles } "
2411
+ "Ancestral alleles not found in the variant_allele "
2412
+ f"array for the { tot } sites ({ tot / len (string_allele )* 100 :.2f} %) "
2413
+ "listed below. They will be treated as of unknown ancestral state:\n "
2414
+ + "\n " .join (
2415
+ f"'{ k } ': { v } ({ v / len (string_allele )* 100 :.2f} % of sites)"
2416
+ for k , v in unknown_alleles .items ()
2417
+ )
2413
2418
)
2414
2419
return ret
2415
2420
You can’t perform that action at this time.
0 commit comments