noodles-bcf 0.64.0

Binary Call Format (BCF) reader and writer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
# Changelog

## 0.64.0 - 2024-11-07

### Changed

  * bcf: Sync dependencies.

## 0.63.0 - 2024-10-22

### Changed

  * bcf/record/samples/series/value/genotype: Only infer first allele phasing
    for VCF < 4.4.

    See ยง 6.3.3.9 "Type encoding: Genotype (GT) field" (2024-06-28): "When
    processing VCF version 4.3 or earlier files, the phasing of the first
    allele should be treated as missing and inferred from the remaining
    values."

## 0.62.0 - 2024-09-26

### Changed

  * bcf: Sync dependencies.

## 0.61.0 - 2024-09-12

### Changed

  * bcf: Sync dependencies.

## 0.60.0 - 2024-09-09

### Changed

  * bcf: Sync dependencies.

## 0.59.1 - 2024-09-04

### Fixed

  * bcf/record/codec/decoder/position: Fix reading position at max position.

    This would previously overflow and error instead of returning a properly
    normalized `Position`.

## 0.59.0 - 2024-08-04

### Changed

  * bcf: Sync dependencies.

## 0.58.0 - 2024-07-14

### Changed

  * bcf: Sync dependencies.

## 0.57.0 - 2024-06-17

### Changed

  * bcf: Sync dependencies.

## 0.56.0 - 2024-06-06

### Changed

  * bcf: Sync dependencies.

## 0.55.0 - 2024-05-31

### Changed

  * bcf/record: Resolve info field and samples series values using header type
    definitions ([#266]).

[#266]: https://github.com/zaeleus/noodles/issues/266

## 0.54.0 - 2024-05-16

### Changed

  * bcf/record/samples: Add lookup by sample name (`Samples::get`).

## 0.53.0 - 2024-05-08

### Changed

  * bcf: Sync dependencies.

## 0.52.0 - 2024-05-02

### Removed

  * bcf/io/reader: Remove `Reader::virtual_position` and `Reader::seek`.

    Use the inner reader instead.

## 0.51.0 - 2024-04-22

### Added

  * bcf/record/samples: Implement series selector (`Samples::select`).

### Fixed

  * bcf/io/reader/record: Return EOF when site length signals EOF ([#255]).

[#255]: https://github.com/zaeleus/noodles/issues/255

## 0.50.0 - 2024-04-11

### Changed

  * bcf/io/reader/record: Disallow partial site lengths.

    A partial site length previously would return EOF. This is now more
    strict, requiring a complete site length or EOF.

## 0.49.0 - 2024-04-04

### Added

  * bcf/async/io: Add async writer (`r#async::io::Writer`).

  * bcf/record: Add reference sequence name getter
    (`Record::reference_sequence_name`).

  * bcf/record: Add `Samples` wrapper.

    This allows reading of the samples without converting to
    `vcf::variant::record_buf::Samples`.

### Changed

  * bcf: Move readers (`Reader` and `IndexedReader`) to writer (`Writer`) to
    `io` module.

  * bcf: Move lazy record to record.

    Use `bcf::Record` instead of `bcf::lazy::Record`.

  * bcf/async/io/reader: Change `Reader::read_header` to return a parsed header
    (`vcf::Header`).

    This no longer returns a raw string. String maps are also parsed and
    attached to the reader. Use `Reader::string_maps` to get a reference to
    the string maps.

  * bcf/io/reader: Rename record to record buf.

    This changes the following:

      * `Reader::read_record` => `Reader::read_record_buf`,
      * `Reader::records` => `Reader::record_bufs`,
      * `Reader::read_lazy_record` => `Reader::read_record`, and
      * `Reader::lazy_records` => `Reader::records`.

  * bcf/io/reader: Return an iterator over `bcf::Record` for queries
    (`Reader::query`).

  * bcf/record: Rename chromosome to reference sequence name, position to
    variant start, and genotypes to samples.

  * bcf/record :Increase the visibilities of the bases methods
    (`Record::reference_bases` and `Record::alternate_bases`).

### Removed

  * bcf/async/io/reader: Remove `Reader::read_file_format`.

    `Reader::read_header` now includes checking the magic number and reading
    the file format version.

  * bcf/header: Remove `StringMaps`.

    This is moved to noodles-vcf.

  * bcf/record: Remove `Record::try_into_vcf_record`.

    Use `vcf::variant::RecordBuf::try_from_variant_record` instead.

## 0.48.0 - 2024-03-28

### Changed

  * bcf: Sync dependencies.

## 0.47.0 - 2024-03-12

### Changed

  * bcf: Sync dependencies.

## 0.46.0 - 2024-01-25

### Changed

  * bcf: Sync dependencies.

## 0.45.0 - 2023-12-14

### Added

  * bcf/indexed_reader: Add index getter (`IndexedReader::index`).

  * bcf/reader/builder: Add `Builder::build_from_reader`.

  * bcf/reader/builder: Add a compression method setter
    (`Builder::set_compression_method`).

    This allows the compression method to be overridden using
    `bcf::io::CompressionMethod`, instead of assuming the input is
    always bgzip-compressed.

    Change instantiations of `bcf::reader::Builder` to
    `bcf::reader::Builder::default()`.

  * bcf/writer: Add builder (`bcf::writer::Builder`).

### Changed

  * bcf: Raise minimum supported Rust version (MSRV) to 1.70.0.

  * bcf: Increase the visibility of the `writer` module.

  * bcf/async/reader: Accept `csi::BinningIndex` for querying.

  * bcf/reader: Accept `csi::BinningIndex` for querying.

## 0.44.0 - 2023-11-14

### Changed

  * bcf: Sync dependencies.

## 0.43.0 - 2023-11-13

### Changed

  * bcf: Sync dependencies.

## 0.42.0 - 2023-11-02

### Changed

  * bcf/reader/header: Parse header line by line.

    The header parser can now build a `vcf::Header` and `StringMaps` by parsing
    a raw header line by line. This makes it so that it is no longer required
    to read the entire raw header into memory before parsing.

## 0.41.0 - 2023-10-26

### Changed

  * bcf: Sync dependencies.

## 0.40.0 - 2023-10-23

### Added

  * bcf/reader: Add builder (`bcf::reader::Builder`).

## 0.39.0 - 2023-10-19

### Changed

  * bcf: Sync dependencies.

## 0.38.0 - 2023-10-12

### Changed

  * bcf: Sync dependencies.

## 0.37.0 - 2023-09-21

### Changed

  * bcf: Sync dependencies.

## 0.36.0 - 2023-09-14

### Removed

  * bcf/lazy/record: Remove mutable reference getters.

    Lazy records were not meant to be mutable. This removes
    `lazy::Record::position_mut`, `lazy::Record::quality_score_mut`, and
    `lazy::Record::ids_mut`.

## 0.35.0 - 2023-08-31

### Changed

  * bcf: Sync dependencies.

## 0.34.0 - 2023-08-24

### Changed

  * bcf: Sync dependencies.

## 0.33.0 - 2023-08-17

### Changed

  * bcf: Sync dependencies.

## 0.32.0 - 2023-08-03

### Added

  * bcf/indexed_reader/builder: Add index setter (`Builder::set_index`).

  * bcf/indexed_reader/builder: Add `Builder::build_from_reader`.

## 0.31.0 - 2023-07-06

### Changed

  * bcf: Update to indexmap 2.0.0.

### Fixed

  * bcf/reader/query: Fix using parsed string maps for query ([#181]).

[#181]: https://github.com/zaeleus/noodles/issues/181

## 0.30.0 - 2023-06-29

### Added

  * bcf/indexed_reader: Add builder (`indexed_reader::Builder`).

## 0.29.0 - 2023-06-15

### Added

  * bcf: Add an indexed reader (`IndexedReader`).

## 0.28.0 - 2023-06-01

### Changed

  * bcf: Sync dependencies.

## 0.27.0 - 2023-05-18

### Changed

  * bcf: Sync dependencies.

## 0.26.0 - 2023-05-11

### Removed

  * bcf/reader: Remove `Reader::read_file_format`.

    `Reader::read_header` now includes checking the magic number and reading
    the file format version. Calling `Reader::read_file_format` is no longer
    necessary.

  * bcf/writer: Remove `Writer::write_file_format`.

    `Writer::write_header` now includes writing the magic number and file
    format version. Calling `Writer::write_file_format` is no longer necessary.

## 0.25.0 - 2023-05-04

### Changed

  * bcf: Sync dependencies.

## 0.24.0 - 2023-04-27

### Changed

  * bcf: Rename `Record` to `lazy::Record`.

  * bcf/async/reader: Rename `Reader::read_record` to
    `Reader::read_lazy_record`.

  * bcf/async/reader: Rename `Reader::records` to `Reader::lazy_records`.

  * bcf/header/string_maps: Use the `IDX` field, if present, when building
    string maps from a `vcf::Header`.

    This now makes conversion fallible. Use `TryFrom<&vcf::Header>` instead.

  * bcf/reader: Change `Reader::read_header` to return a parsed header
    (`Header`).

    This no longer returns a raw string. `StringMaps` are also parsed and
    attached to the reader. Use `Reader::string_maps` to get a reference to the
    string maps.

  * bcf/reader: Change `Reader:read_record` to read a parsed record.

    This now requires the header and strings map. If reading a lazy record, use
    `Reader::read_lazy_record` instead.

  * bcf/reader: Rename `Reader::records` to `Reader::lazy_records`.

  * bcf/reader/query: Return `vcf::Record` instead of `bcf::lazy::Record`.

    This now requires `Reader::query` to receive a reference to a
    `vcf::Header`.

  * bcf/writer: Build string maps upon writing header.

    `StringMaps` are now built from the header upon calling
    `Writer::write_header`. This is subsequently used as context when writing
    records.

  * bcf/writer: Rename `Writer::write_vcf_record` to `Writer::write_record`.

### Removed

  * bcf/writer: Remove `Writer::write_record(lazy::Record)`.

    Writing lazy records is not supported.

## 0.23.0 - 2023-04-06

### Changed

  * bcf: Sync dependencies.

## 0.22.0 - 2023-03-14

### Added

  * bcf/writer: Implement `VariantWriter` ([#150]).

[#150]: https://github.com/zaeleus/noodles/issues/150

### Fixed

  * bcf/writer/vcf_record/genotypes: Fix writing dropped values ([#151]).

    Trailing field values are allowed to be missing.

[#151]: https://github.com/zaeleus/noodles/issues/151

## 0.21.0 - 2023-03-03

### Added

  * bcf/reader: Implement `vcf::VariantReader` ([#149]).

[#149]: https://github.com/zaeleus/noodles/pull/149

## 0.20.0 - 2023-02-03

### Changed

  * bcf: Raise minimum supported Rust version (MSRV) to 1.64.0.

  * bcf/record/info: Add `Info::iter` for an iterator over
    `Key`-`Option<Value>` pairs.

  * bcf/record/info: Change `Info::values` to return an iterator over
    `Option<Value>` values.

    Use `Info::iter` for fields.

  * bcf/record/info: Change `Info::get` to return an `Option<Value>` value
    instead of a field.

### Removed

  * bcf/header: Remove `StringMap`.

    This was deprecated in noodles-bcf 0.11.0. Use
    `noodles_bcf::header::string_maps::StringMap` instead.

## 0.19.2 - 2022-12-02

### Fixed

  * bcf/writer/vcf_writer/genotypes: Add FORMAT GT encoder for missing alleles
    (i.e., `.`).

  * bcf/writer/vcf_writer/genotypes: Pad integer vector for genotypes.

## 0.19.1 - 2022-11-29

### Fixed

  * bcf/header/string_maps: Use file format as context when parsing records
    (#137).

  * bcf/writer/vcf_writer/genotypes: Add FORMAT GT encoder ([#135]).

[#135]: https://github.com/zaeleus/noodles/issues/135
[#137]: https://github.com/zaeleus/noodles/issues/137

## 0.19.0 - 2022-11-18

### Changed

  * bcf: Sync dependencies.

## 0.18.0 - 2022-10-28

### Changed

  * bcf: Sync dependencies.

## 0.17.0 - 2022-10-20

### Changed

  * bcf: Sync dependencies.

## 0.16.0 - 2022-09-29

### Changed

  * bcf: Sync dependencies.

## 0.15.0 - 2022-08-16

### Changed

  * bcf: Raise minimum supported Rust version (MSRV) to 1.57.0.

### Removed

  * bcf/async/reader: Remove `Builder` and `Reader::builder`.

    Use `bgzf::async::reader::Builder` and construct with
    `bcf::async::Reader::from` instead.

## 0.14.0 - 2022-07-05

### Changed

  * bcf: Sync dependencies.

## 0.13.3 - 2022-06-08

### Fixed

  * bcf: Sync dependencies.

## 0.13.2 - 2022-03-29

### Fixed

  * bcf/async/reader/record: Read site from buffer ([#79]).

[#79]: https://github.com/zaeleus/noodles/issues/79

## 0.13.1 - 2022-03-02

### Fixed

  * bcf: Sync dependencies.

## 0.13.0 - 2022-02-17

### Added

  * bcf: Set minimum supported Rust version (MSRV) to 1.56.0 in package
    manifest.

  * bcf/async/reader: Add query stream.

  * bcf/record: Add type alias for chromosome ID: `ChromosomeId`.

### Fixed

  * bcf/writer/vcf_record/site: Avoid overflow when the alternate allele count
    is `usize::MAX`.

## 0.12.0 - 2022-01-27

### Added

  * bcf/async/reader: Add common methods to access the underlying reader:
    `get_ref`, `get_mut`, and `into_inner`.

  * bcf/reader/record/info: Handle reading INFO array values with missing raw
    values.

  * bcf/writer/vcf_record/site/info: Handle writing INFO array values with
    missing raw values.

    This allows reading/writing INFO array values that have missing raw values,
    e.g., `AC=8,.`.

### Changed

  * bcf/record: Change chromosome ID to a `usize`.

    `CHROM` is used as an index.

  * bcf/reader: Use contig string map to find contig index when querying.

    The chromosome ID maps to a contig string map entry, not the header
    contigs.

  * bcf/writer/vcf_record/site: Ensure the record position is <= its end
    position when writing `rlen`.

### Fixed

  * bcf/reader/record/info: Split on delimiter when reading a character array.

  * bcf/writer/record: Write filters when present.

  * bcf/writer/vcf_record/site: Skip writing alternate bases when empty.

  * bcf/writer/vcf_record/site: Filters with indices larger than 127 are now
    valid.

  * bcf/writer/vcf_record/site: Fix `rlen` calculation.

## 0.11.0 - 2022-01-13

### Added

  * bcf/async/reader: Add conversion from `R` into `Reader<R>`.

### Changed

  * bcf/header: Split `StringMap` from `StringMaps` (#64).

    Use `bcf::header::string_maps::StringStringMap` as a replacement to what
    `StringMap` was used as. It can typically be accessed using
    `StringMaps::strings`.

  * bcf/header/string_maps: Parsing can now fail with
    `vcf::header::ParseError::StringMapPositionMismatch` if the string map
    position of an entry and record-defined IDX field value do not match.

  * bcf/header/string_maps: If present, the IDX field is used to determine the
    position of the entry in the string map ([#64]).

  * bcf/header/string_maps: Parsing (`FromStr`) and conversion
    (`From<&vcf::Header>`) now builds a contig string map (also known as a
    "dictionary of contigs") (#64).

    It can be accessed using `StringMaps::contigs`.

  * bcf/header/string_maps/string_map: The default implementation now creates
    an empty map.

    This used to create a default map with a `PASS` entry at position 0.

  * bcf/record: `Record::try_into_vcf_record` now takes `StringMaps` instead of
    `StringMap` (#64).

  * bcf/record: The following now take `StringStringMap` instead of
    `StringMap` (#64):

    * `Filters::try_into_vcf_record_filters`
    * `Info::try_into_vcf_record_info`
    * `Info::get`
    * `Info::values`
    * `Info::try_into_vcf_record_genotypes`

  * bcf/record/convert: Use contig string map to find chromosome name (#64).

  * bcf/writer: `Writer::write_vcf_record` now takes `StringMaps` instead of
    `StringMap`.

  * bcf/writer/vcf_record: Use contig string map to find index of contig (#64).

    This previously used the position of the contig in the header, but BCF
    allows records to override their positions using the `IDX` field, requiring
    a contig string map.

[#64]: https://github.com/zaeleus/noodles/issues/64

### Removed

  * bcf/header/string_maps/string_map: Remove `Deref<Target =
    IndexSet<String>>` for `StringMap`.

    `StringMap` is no longer backed by an `IndexMap`.

## 0.10.0 - 2021-12-16

### Added

  * bcf/reader: Add common methods to access the underlying reader: `get_ref`,
    `get_mut` and `into_inner`.

  * bcf/writer: Add record writer (`Writer::write_record`).

### Fixed

  * bcf/writer/vcf_record/site: Fix allele count calculation.

    This overcounted by 1 when there were no alternate bases.

## 0.9.0 - 2021-12-02

### Added

  * bcf/record/genotypes: Add method to clear all fields (`Genotypes::clear`).

  * bcf/record/info: Add methods to wrap an INFO buffer (`Info::new`), clear
    all fields (`Info::clear`), retrieve a field by key (`Info::get`; [#52]),
    and iterate all fields (`Info::values`).

  * bcf/reader: Add conversion from `R` into `Reader<R>`.

  * bcf/writer: Add conversion from `W` into `Writer<W>`.

  * bcf/writer: Add common methods to access the underlying writer: `get_mut`
    and `into_inner`.

[#52]: https://github.com/zaeleus/noodles/issues/52

### Changed

  * bcf/header/string_map: Disable type checking when the file format is < VCF
    4.3.

  * bcf/reader/record/genotypes: Always use key from header.

  * bcf/reader/record/site/info: Always use key from header.

  * bcf/record/genotypes: Return `Genotypes` from
    `Genotypes::try_into_vcf_record_genotypes`.

    Use `vcf::record::Genotypes::keys` for the genotypes keys.

### Fixed

  * bcf/reader/record/site/info: Allow value to be optional (#56).

[#56]: https://github.com/zaeleus/noodles/issues/56

## 0.8.0 - 2021-11-18

### Added

  * bcf/record: Implement `Debug` for `Record`.

  * bcf/record: Add getter for filters (`Record::filters`), IDs
    (`Record::ids`), genotypes (`Record::genotypes`), info (`Record::info`),
    and quality score (`Record::quality_score`).

  * bcf/record: Add mutable getters for IDs (`Record::ids_mut`), position
    (`Record::position_mut`) and quality score (`Record::quality_score_mut`).

### Changed

  * bcf/record: `bcf::Record` is no longer backed by a contiguous buffer.

    Fields are read individually when reading the record. `bcf::Record` no
    longer implements `Deref<Target = [u8]>`. `Filters`, `Info`, `Genotypes`
    now own their data.

## 0.7.0 - 2021-11-11

### Changed

  * bcf: Update to Rust 2021.

## 0.6.1 - 2021-10-16

### Fixed

  * bcf: Sync dependencies.

## 0.6.0 - 2021-10-01

### Added

  * bcf: Increase visibility of `reader` module ([#37]).

    This allows public access to the reader iterators `Records` and `Query`.

[#37]: https://github.com/zaeleus/noodles/pull/37

## 0.5.2 - 2021-09-19

### Fixed

  * bcf: Sync dependencies.

## 0.5.1 - 2021-09-01

### Fixed

  * bcf: Sync dependencies.

## 0.5.0 - 2021-08-19

### Changed

  * bcf: Update to tokio 1.10.0.

  * bcf/async: I/O builders are now owned/consuming builders.

    This fixes the terminal method not being able to move out of a mutable
    reference.

### Fixed

  * bcf: Define features to enable for Docs.rs.

## 0.4.0 - 2021-08-11

### Added

  * bcf/async: Add async reader (`bcf::AsyncReader`).

    This can be enabled with the `async` feature.

## 0.3.1 - 2021-08-04

### Fixed

  * bcf: Sync dependencies.

## 0.3.0 - 2021-07-30

### Added

  * bcf/header/string_map: Implement conversion from `vcf::Header`.

## 0.2.0 - 2021-07-21

### Added

  * bcf/reader: Accept any `BinningIndex` to query.

### Fixed

  * bcf: Fixed documentation link in package manifest ([#31]).

[#31]: https://github.com/zaeleus/noodles/issues/31

## 0.1.0 - 2021-07-14

  * bcf: Initial release.