zaeleus / noodles

Bioinformatics I/O libraries in Rust
MIT License
512 stars 53 forks source link

templeate_length() for long reads #285

Closed Psy-Fer closed 4 months ago

Psy-Fer commented 4 months ago

Hey,

Thanks for making an excellent tool

I'm reading some nanopore bam files, which don't have read pairs, only single long reads.

I am looking for the best way to get the alignment length and some clarification on the best way to do that. I thought this would be record.template_length() but it is always set to 0 because there are no read pairs I am using alignment_span() now. Is this essentially the same thing?

Cheers, James

zaeleus commented 4 months ago

The alignment span (Record::alignment_span) is indeed the alignment length.

The template length and alignment span are not the same. The template length is the distance between the leftmost and rightmost positions of a multisegmented read. If there is only a single segment, by definition, the template length is 0.

Psy-Fer commented 4 months ago

Okay great that answers my question.

In the long read files from nanopore they have used template length in their summary files and other metadata. Which has always been confusing to me.

Thanks for clearing that up.

Cheers, James