Skip to content

About how wavefront offsets are saved #94

Closed
@shenwei356

Description

@shenwei356

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

  wf_offset_t* offsets;                // Offsets (k-centered)

which is accessed by the k as the index.

https://github.com/smarco/WFA2-lib/blob/main/wavefront/wavefront_backtrace.c#L73

mwavefront->offsets[k]

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.

  index: 0,  1,  2,  3,  4,  5,  6
  k:     0, -1,  1, -2,  2, -3,  3

Best,
Wei.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions