-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About how wavefront offsets are saved #94
Comments
It seems to be true. https://github.com/smarco/WFA2-lib/blob/main/wavefront/wavefront.c#L89 |
Yes indeed, my understanding is that |
Thank you Ragnar. I just searched and found C++ does support a negative index !!!! https://stackoverflow.com/questions/47170740/c-negative-array-index But Go don't allow that. So I'll still use the previous layout but grow the the array less frequently. |
Hi, Yes. I know it can be a little bit weird at first. But, usually, the convention is to index the main diagonal as But this is just a convention, and you may as well map the wavefront's indexes (i.e., diagonals) to any positive range. Do not hesitate to contact me if you have more questions. |
I see, thank you every much! |
Hi @smarco ,
I'm trying to understand the source code about how wavefront offsets are saved.
It looks like they are saved in a list,
https://github.com/smarco/WFA2-lib/blob/main/wavefront/wavefront.h#L62
which is accessed by the
k
as the index.https://github.com/smarco/WFA2-lib/blob/main/wavefront/wavefront_backtrace.c#L73
However, the
k
might be negative. How is this possible for a negative list index?My guess is all
k
values are added by the length of the query sequence to make them >=0. But I can't find the code and this would occupy a lot of space, especially for long sequences.In my implementation, to support negative
k
values, I use the layout below. But it requires bound checking in every reading/writing.Best,
Wei.
The text was updated successfully, but these errors were encountered: