@@ -188,6 +188,7 @@ def write_vcf(
188
188
numba_chunk_to_vcf (
189
189
root ,
190
190
v_chunk ,
191
+ v_mask_chunk ,
191
192
header_info_fields ,
192
193
header_format_fields ,
193
194
contigs ,
@@ -296,16 +297,16 @@ def c_chunk_to_vcf(root, v_chunk, v_mask_chunk, contigs, filters, output):
296
297
297
298
298
299
def numba_chunk_to_vcf (
299
- root , v_chunk , header_info_fields , header_format_fields , contigs , filters , output
300
+ root , v_chunk , v_mask_chunk , header_info_fields , header_format_fields , contigs , filters , output
300
301
):
301
302
# fixed fields
302
303
303
- chrom = root .variant_contig . blocks [ v_chunk ]
304
- pos = root .variant_position . blocks [ v_chunk ]
305
- id = root .variant_id . blocks [ v_chunk ] .astype ("S" )
306
- alleles = root .variant_allele . blocks [ v_chunk ] .astype ("S" )
307
- qual = root .variant_quality . blocks [ v_chunk ]
308
- filter_ = root .variant_filter . blocks [ v_chunk ]
304
+ chrom = get_block_selection ( root .variant_contig , v_chunk , v_mask_chunk )
305
+ pos = get_block_selection ( root .variant_position , v_chunk , v_mask_chunk )
306
+ id = get_block_selection ( root .variant_id , v_chunk , v_mask_chunk ) .astype ("S" )
307
+ alleles = get_block_selection ( root .variant_allele , v_chunk , v_mask_chunk ) .astype ("S" )
308
+ qual = get_block_selection ( root .variant_quality , v_chunk , v_mask_chunk )
309
+ filter_ = get_block_selection ( root .variant_filter , v_chunk , v_mask_chunk )
309
310
310
311
n_variants = len (pos )
311
312
@@ -327,7 +328,7 @@ def numba_chunk_to_vcf(
327
328
# not the other way around. This is probably not what we want to
328
329
# do, but keeping it this way to preserve tests initially.
329
330
continue
330
- values = arr . blocks [ v_chunk ]
331
+ values = get_block_selection ( arr , v_chunk , v_mask_chunk )
331
332
if arr .dtype == bool :
332
333
info_mask [k ] = create_mask (values )
333
334
info_bufs .append (np .zeros (0 , dtype = np .uint8 ))
@@ -366,7 +367,7 @@ def numba_chunk_to_vcf(
366
367
var = "call_genotype" if key == "GT" else f"call_{ key } "
367
368
if var not in root :
368
369
continue
369
- values = root [var ]. blocks [ v_chunk ]
370
+ values = get_block_selection ( root [var ], v_chunk , v_mask_chunk )
370
371
if key == "GT" :
371
372
n_samples = values .shape [1 ]
372
373
format_mask [k ] = create_mask (values )
@@ -394,7 +395,7 @@ def numba_chunk_to_vcf(
394
395
format_indexes = np .empty ((len (format_values ), n_samples + 1 ), dtype = np .int32 )
395
396
396
397
if "call_genotype_phased" in root :
397
- call_genotype_phased = root ["call_genotype_phased" ]. blocks [ v_chunk ] [:]
398
+ call_genotype_phased = get_block_selection ( root ["call_genotype_phased" ], v_chunk , v_mask_chunk ) [:]
398
399
else :
399
400
call_genotype_phased = np .full ((n_variants , n_samples ), False , dtype = bool )
400
401
0 commit comments