@@ -452,6 +452,8 @@ def test_call_LAA(self, ds):
452
452
[[1 , - 2 , - 2 ], [- 1 , - 2 , - 2 ]],
453
453
[[2 , - 2 , - 2 ], [2 , - 2 , - 2 ]],
454
454
[[1 , - 2 , - 2 ], [- 2 , - 2 , - 2 ]],
455
+ [[- 2 , - 2 , - 2 ], [- 2 , - 2 , - 2 ]],
456
+ [[1 , - 2 , - 2 ], [1 , - 2 , - 2 ]],
455
457
]
456
458
nt .assert_array_equal (ds .call_LAA .values , call_LAA )
457
459
@@ -493,29 +495,37 @@ def test_call_LPL(self, ds):
493
495
[30 , 30 , 30 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
494
496
[30 , - 1 , 0 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
495
497
],
498
+ [
499
+ [- 1 , - 1 , - 1 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
500
+ [- 1 , - 1 , - 1 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
501
+ ],
502
+ [
503
+ [- 1 , - 1 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
504
+ [- 1 , - 1 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 , - 2 ],
505
+ ],
496
506
]
497
507
nt .assert_array_equal (ds .call_LPL .values , call_LPL )
498
508
499
509
500
510
class TestTriploidExample :
501
- data_path = "tests/data/vcf/triploid.vcf.gz"
502
-
503
- @pytest .fixture (scope = "class" )
504
- def ds (self , tmp_path_factory ):
511
+ @pytest .fixture (scope = "class" , params = ["triploid" , "triploid2" , "triploid3" ])
512
+ def ds (self , tmp_path_factory , request ):
513
+ data_path = f"tests/data/vcf/{ request .param } .vcf.gz"
505
514
out = tmp_path_factory .mktemp ("data" ) / "example.vcf.zarr"
506
- vcf2zarr .convert ([self . data_path ], out , local_alleles = False )
515
+ vcf2zarr .convert ([data_path ], out , local_alleles = False )
507
516
return sg .load_dataset (out )
508
517
509
- def test_error_with_local_alleles (self , tmp_path_factory ):
510
- icf_path = tmp_path_factory .mktemp ("data" ) / "triploid.icf"
518
+ @pytest .mark .parametrize ("name" , ["triploid" , "triploid2" , "triploid3" ])
519
+ def test_error_with_local_alleles (self , tmp_path_factory , name ):
520
+ data_path = f"tests/data/vcf/{ name } .vcf.gz"
521
+ icf_path = tmp_path_factory .mktemp ("data" ) / f"{ name } .icf"
511
522
with pytest .raises (ValueError , match = re .escape ("Cannot handle ploidy = 3" )):
512
523
vcf2zarr .explode (
513
- icf_path , [self . data_path ], worker_processes = 0 , local_alleles = True
524
+ icf_path , [data_path ], worker_processes = 0 , local_alleles = True
514
525
)
515
526
516
527
def test_ok_without_local_alleles (self , ds ):
517
528
nt .assert_array_equal (ds .call_genotype .values , [[[0 , 0 , 0 ]]])
518
- nt .assert_array_equal (ds .call_PL .values , [[[0 , 0 , 0 , 0 ]]])
519
529
520
530
521
531
class Test1000G2020Example :
0 commit comments