Closed zaeleus closed 1 year ago
@brentp, this issue is fixed in noodles 0.58.0 / noodles-csi 0.27.0.
The only other issue in the given example is that you must track the reference sequence names, in the case of VCF. E.g., since there's only one record and reference sequence name:
- let mut indexer =
- csi::index::Indexer::default().set_header(csi::index::header::Builder::vcf().build());
+ let reference_sequence_names = [chrom].into_iter().collect();
+ let header = csi::index::header::Builder::vcf()
+ .set_reference_sequence_names(reference_sequence_names)
+ .build();
+ let mut indexer = csi::index::Indexer::default().set_header(header);
Alternatively, use tabix::index::Indexer
. This works on reference sequence names instead of IDs and adds them to the index header on build.
thanks very much @zaeleus ! Indeed it's working with latest version and that change.
Originally posted by @brentp in https://github.com/zaeleus/noodles/issues/214#issuecomment-1808084159
When using noodles-csi, the column indices when reading and writing a tabix header are off by one. The error comes from the tabix header using 1-based column indices, whereas noodles normalizes them to be 0-based.
This only affects the CSI reader and writer, not tabix.