wdecoster / cramino

A *fast* tool for BAM/CRAM quality evaluation, intended for long reads
MIT License
127 stars 11 forks source link

fix: reading from stdin #23

Closed mbhall88 closed 10 months ago

mbhall88 commented 10 months ago

This PR fixes reading a BAM from stdin.

The problem was that there were two parts of the code which read from stdin. So the first read works, but the second read doesn't as stdin has been emptied.

The second place that read from stdin was the function to calculate the genome size, which only needs the header. So I just return a copy of the header from the first read and then made that the input to the get_genome_size function.

I've also removed an unwrap or two relating to reading the BAM file as unwrapping assumes the BAM will always been Ok, which it might not. And the subsequent error would have been cryptic.

I also made - the default value for input if no argument is given. This removes the need to add - explicitly when calling cramino.

wdecoster commented 10 months ago

Hi, this looks great. Thank you so much!