@@ -29,6 +29,13 @@ def test_context_manager_error(self):
29
29
with vcf_utils .IndexedVcf (data_path / "no-such-file.bcf" ):
30
30
pass
31
31
32
+ def test_indels_filtered (self ):
33
+ with vcf_utils .IndexedVcf (data_path / "chr_m_indels.vcf.gz" ) as vfile :
34
+ # Hand-picked example that results in filtering
35
+ region = vcf_utils .Region ("chrM" , 300 , 314 )
36
+ pos = [var .POS for var in vfile .variants (region )]
37
+ assert pos == [307 , 308 , 309 , 312 , 313 , 314 ]
38
+
32
39
# values computed using bcftools index -s
33
40
@pytest .mark .parametrize (
34
41
("index_file" , "expected" ),
@@ -58,6 +65,7 @@ def test_context_manager_error(self):
58
65
("1kg_2020_chr20_annotations.bcf.csi" , {"chr20" : 21 }),
59
66
("NA12878.prod.chr20snippet.g.vcf.gz.tbi" , {"20" : 301778 }),
60
67
("multi_contig.vcf.gz.tbi" , {str (j ): 933 for j in range (5 )}),
68
+ ("chr_m_indels.vcf.gz.csi" , {"chrM" : 155 }),
61
69
],
62
70
)
63
71
def test_contig_record_counts (self , index_file , expected ):
@@ -82,6 +90,7 @@ def test_contig_record_counts(self, index_file, expected):
82
90
("1kg_2020_chr20_annotations.bcf.csi" , ["chr20:60070-" ]),
83
91
("NA12878.prod.chr20snippet.g.vcf.gz.tbi" , ["20:60001-" ]),
84
92
("multi_contig.vcf.gz.tbi" , [f"{ j } :1-" for j in range (5 )]),
93
+ ("chr_m_indels.vcf.gz.csi" , ["chrM:26-" ]),
85
94
],
86
95
)
87
96
def test_partition_into_one_part (self , index_file , expected ):
@@ -106,6 +115,7 @@ def test_partition_into_one_part(self, index_file, expected):
106
115
("1kg_2020_chr20_annotations.bcf.csi" , 1 , 21 ),
107
116
("NA12878.prod.chr20snippet.g.vcf.gz.tbi" , 59 , 301778 ),
108
117
("multi_contig.vcf.gz.tbi" , 5 , 5 * 933 ),
118
+ ("chr_m_indels.vcf.gz.csi" , 1 , 155 ),
109
119
],
110
120
)
111
121
def test_partition_into_max_parts (self , index_file , num_expected , total_records ):
0 commit comments