@@ -233,9 +233,10 @@ def test_call_HQ(self, ds):
233
233
]
234
234
nt .assert_array_equal (ds ["call_HQ" ], call_HQ )
235
235
236
- def test_call_LAA (self , ds ):
236
+ def test_no_local_alleles (self , ds ):
237
237
# The small example VCF does not have a PL field
238
- assert "call_LA" not in ds
238
+ assert "call_LAA" not in ds
239
+ assert "call_LPL" not in ds
239
240
240
241
def test_no_genotypes (self , ds , tmp_path ):
241
242
path = "tests/data/vcf/sample_no_genotypes.vcf.gz"
@@ -451,6 +452,35 @@ def test_call_LAA(self, ds):
451
452
]
452
453
nt .assert_array_equal (ds .call_LAA .values , call_LAA )
453
454
455
+ def test_call_LPL (self , ds ):
456
+ call_LPL = [
457
+ [
458
+ [100 , 0 , 105 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
459
+ [0 , 100 , 200 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
460
+ ],
461
+ [
462
+ [0 , 100 , 200 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
463
+ [154 , 22 , 0 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
464
+ ],
465
+ [
466
+ [1002 , 55 , 1002 , 0 , 55 , 1002 , - 2 , - 2 , - 2 , - 2 ],
467
+ [154 , 154 , 0 , 154 , 102 , 102 , - 2 , - 2 , - 2 , - 2 ],
468
+ ],
469
+ [
470
+ [- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ],
471
+ [- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ],
472
+ ],
473
+ [
474
+ [30 , 30 , 30 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
475
+ [30 , 60 , 0 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
476
+ ],
477
+ [
478
+ [0 , 30 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
479
+ [0 , 0 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
480
+ ],
481
+ ]
482
+ nt .assert_array_equal (ds .call_LPL .values , call_LPL )
483
+
454
484
455
485
class TestTriploidExample :
456
486
data_path = "tests/data/vcf/triploid.vcf.gz"
@@ -475,13 +505,18 @@ def test_ok_without_local_alleles(self, ds):
475
505
476
506
class Test1000G2020Example :
477
507
data_path = "tests/data/vcf/1kg_2020_chrM.vcf.gz"
508
+ expected_call_lpl_path = "tests/data/numpy/expected_call_LPL.npy"
478
509
479
510
@pytest .fixture (scope = "class" )
480
511
def ds (self , tmp_path_factory ):
481
512
out = tmp_path_factory .mktemp ("data" ) / "example.vcf.zarr"
482
513
vcf2zarr .convert ([self .data_path ], out , worker_processes = 0 )
483
514
return sg .load_dataset (out )
484
515
516
+ @pytest .fixture (scope = "class" )
517
+ def expected_call_lpl (self ):
518
+ return np .load (self .expected_call_lpl_path )
519
+
485
520
def test_position (self , ds ):
486
521
# fmt: off
487
522
pos = [
@@ -606,6 +641,9 @@ def test_call_LAA(self, ds):
606
641
]
607
642
nt .assert_array_equal (ds .call_LAA .values , call_LAA )
608
643
644
+ def test_call_LPL (self , ds , expected_call_lpl ):
645
+ nt .assert_array_equal (ds .call_LPL .values , expected_call_lpl )
646
+
609
647
def test_call_PID (self , ds ):
610
648
call_PGT = ds ["call_PGT" ].values
611
649
assert np .all (call_PGT == "." )
0 commit comments