@@ -520,7 +520,7 @@ def init(
520
520
# Doing this synchronously - this is fine surely
521
521
self .encode_samples (root )
522
522
if self .source .filters is not None :
523
- self .encode_filter_id (root )
523
+ self .encode_filters (root )
524
524
if self .source .contigs is not None :
525
525
self .encode_contigs (root )
526
526
@@ -581,9 +581,7 @@ def encode_contigs(self, root):
581
581
)
582
582
array .attrs ["_ARRAY_DIMENSIONS" ] = ["contigs" ]
583
583
584
- def encode_filter_id (self , root ):
585
- # TODO need a way to store description also
586
- # https://github.com/sgkit-dev/vcf-zarr-spec/issues/19
584
+ def encode_filters (self , root ):
587
585
filters = self .source .filters
588
586
array = root .array (
589
587
"filter_id" ,
@@ -593,6 +591,14 @@ def encode_filter_id(self, root):
593
591
compressor = DEFAULT_ZARR_COMPRESSOR ,
594
592
)
595
593
array .attrs ["_ARRAY_DIMENSIONS" ] = ["filters" ]
594
+ array = root .array (
595
+ "filter_description" ,
596
+ data = [filt .description for filt in filters ],
597
+ shape = len (filters ),
598
+ dtype = "str" ,
599
+ compressor = DEFAULT_ZARR_COMPRESSOR ,
600
+ )
601
+ array .attrs ["_ARRAY_DIMENSIONS" ] = ["filters" ]
596
602
597
603
def init_array (self , root , array_spec , variants_dim_size ):
598
604
kwargs = dict (zarr_utils .ZARR_FORMAT_KWARGS )
0 commit comments