zaeleus / noodles

Bioinformatics I/O libraries in Rust
MIT License
482 stars 52 forks source link

query sorted bam for unmapped reads #198

Closed drtconway closed 1 year ago

drtconway commented 1 year ago

I've got a multi-threaded tool which opens a BAM file independently in each thread, and uses a query to extract each chromosome and process it independently. This seems to work pretty well, but I also want to process the unmapped reads which usually sort at the end of the BAM.

Is there a way to extract the region of the BAM from the index file so I can add that to the list of regions to process?

drtconway commented 1 year ago

Oh. I knew it was probably a dumb question.

https://docs.rs/noodles-bam/latest/noodles_bam/indexed_reader/struct.IndexedReader.html#method.query_unmapped