@@ -440,6 +440,27 @@ def test_vcf_field_description(self, ds, field, description):
440
440
assert ds [field ].attrs ["description" ] == description
441
441
442
442
443
+ class TestLocalAllelesExample :
444
+ data_path = "tests/data/vcf/local_alleles.vcf.gz"
445
+
446
+ @pytest .fixture (scope = "class" )
447
+ def ds (self , tmp_path_factory ):
448
+ out = tmp_path_factory .mktemp ("data" ) / "local_alleles.vcf.zarr"
449
+ vcf2zarr .convert ([self .data_path ], out , worker_processes = 0 )
450
+ return sg .load_dataset (out )
451
+
452
+ def test_call_LAA (self , ds ):
453
+ call_LAA = [
454
+ [[1 , - 2 , - 2 ], [1 , - 2 , - 2 ]],
455
+ [[1 , - 2 , - 2 ], [1 , - 2 , - 2 ]],
456
+ [[1 , 2 , - 2 ], [1 , 2 , - 2 ]],
457
+ [[1 , 2 , 3 ], [2 , 3 , - 2 ]],
458
+ [[1 , - 2 , - 2 ], [1 , - 2 , - 2 ]],
459
+ [[2 , - 2 , - 2 ], [1 , - 2 , - 2 ]],
460
+ ]
461
+ nt .assert_array_equal (ds .call_LAA .values , call_LAA )
462
+
463
+
443
464
class Test1000G2020Example :
444
465
data_path = "tests/data/vcf/1kg_2020_chrM.vcf.gz"
445
466
@@ -546,9 +567,31 @@ def test_call_AD(self, ds):
546
567
nt .assert_array_equal (ds .call_AD .values , call_AD )
547
568
548
569
def test_call_LAA (self , ds ):
549
- # The shape is (23, 3, 1).
550
- # None of the entries use any alternate alleles.
551
- call_LAA = np .full ((23 , 3 , 1 ), - 2 , dtype = int )
570
+ call_LAA = [
571
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
572
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
573
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
574
+ [[1 , 2 , - 2 , - 2 ], [1 , 2 , - 2 , - 2 ], [1 , 2 , - 2 , - 2 ]],
575
+ [[1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ]],
576
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
577
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
578
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
579
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
580
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
581
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
582
+ [[1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ]],
583
+ [[1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ]],
584
+ [[1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ]],
585
+ [[1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ]],
586
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
587
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
588
+ [[1 , 2 , - 2 , - 2 ], [1 , 2 , - 2 , - 2 ], [1 , 2 , - 2 , - 2 ]],
589
+ [[1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ], [1 , - 2 , - 2 , - 2 ]],
590
+ [[1 , 2 , - 2 , - 2 ], [1 , 2 , - 2 , - 2 ], [1 , 2 , - 2 , - 2 ]],
591
+ [[1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ]],
592
+ [[1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ], [1 , 2 , 3 , 4 ]],
593
+ [[1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ], [1 , 2 , 3 , - 2 ]],
594
+ ]
552
595
nt .assert_array_equal (ds .call_LAA .values , call_LAA )
553
596
554
597
def test_call_PID (self , ds ):
0 commit comments