s4hts / HTStream

A high throughput sequence read toolset using a streaming approach facilitated by Linux pipes
https://s4hts.github.io/HTStream/
Apache License 2.0
49 stars 9 forks source link

Fixes #239 space at end of id string #240

Closed joe-angell closed 3 years ago

joe-angell commented 3 years ago

Bug where substr was beyond length of string when there is a space at the end of an id string.

samhunter commented 3 years ago

The proposed fix will solve the problem I ran into, and I think it should work for most of the cases I can think of: 1) ">one_space " --> id="test_with_one_space"; id2="" 2) ">two_spaces " --> id="test_with_two_spaces";id2=" " 3) ">two_spaces and description " --> id="two_spaces"; id2=" and description "

It does have the result that additional spaces will be retained if they are present as in cases 2 and 3. I don't think that this is a problem because we don't use id2 in a way that will be compromised by additional white space as far as I can tell.