I'd like to programmatically generate VCF records as part of my unit tests for various tools. In some cases I'll create new records then write them to disk to test the tool end to end (versus just passing methods the variant records themselves). The VCF needs to be indexed, and I was wondering how to do that after I've written the VCF as well as ideally on the fly.
I think to create the index, you can get the virtual position from the writer and perhaps something like this:
|
for (reference_sequence_name, start, end) in records { |
|
writeln!(writer, "{}\t{}\t{}", reference_sequence_name, start, end)?; |
|
|
|
let end_position = writer.virtual_position(); |
|
let chunk = Chunk::new(start_position, end_position); |
|
|
|
indexer.add_record(reference_sequence_name, start, end, chunk)?; |
|
|
|
start_position = end_position; |
|
} |
?
Any guidance would be greatly appreciated!
I'd like to programmatically generate VCF records as part of my unit tests for various tools. In some cases I'll create new records then write them to disk to test the tool end to end (versus just passing methods the variant records themselves). The VCF needs to be indexed, and I was wondering how to do that after I've written the VCF as well as ideally on the fly.
I think to create the index, you can get the virtual position from the writer and perhaps something like this:
noodles/noodles-tabix/examples/tabix_write.rs
Lines 29 to 38 in bd10986
Any guidance would be greatly appreciated!