@@ -424,7 +424,6 @@ def sanitise_value_float_1d(shape, value):
424
424
value = drop_empty_second_dim (value )
425
425
result = np .full (shape , constants .FLOAT32_FILL , dtype = np .float32 )
426
426
result [: value .shape [0 ]] = value
427
- print (result )
428
427
return result
429
428
430
429
@@ -435,7 +434,6 @@ def sanitise_value_float_2d(shape, value):
435
434
value = np .array (value , ndmin = 2 , dtype = np .float32 , copy = True )
436
435
result = np .full (shape , constants .FLOAT32_FILL , dtype = np .float32 )
437
436
result [:, : value .shape [1 ]] = value
438
- print (result )
439
437
return result
440
438
441
439
@@ -943,6 +941,19 @@ def iter_filters(self, start, stop):
943
941
) from None
944
942
yield filters
945
943
944
+ def iter_contig (self , start , stop ):
945
+ source_field = self .fields ["CHROM" ]
946
+ lookup = {
947
+ contig .id : index for index , contig in enumerate (self .metadata .contigs )
948
+ }
949
+
950
+ for value in source_field .iter_values (start , stop ):
951
+ # Note: because we are using the indexes to define the lookups
952
+ # and we always have an index, it seems that we the contig lookup
953
+ # will always succeed. However, if anyone ever does hit a KeyError
954
+ # here, please do open an issue with a reproducible example!
955
+ yield lookup [value [0 ]]
956
+
946
957
def iter_field (self , field_name , shape , start , stop ):
947
958
source_field = self .fields [field_name ]
948
959
sanitiser = source_field .sanitiser_factory (shape )
0 commit comments