Skip to content
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

Add cigar X/= #156

Closed
wants to merge 1 commit into from
Closed

Add cigar X/= #156

wants to merge 1 commit into from

Conversation

armintoepfer
Copy link
Contributor

This is the patch I'm applying to convert M to X/=. It does not yet include the command-line toggle and ignores the python/js stack. It is also not well tested. Feel free to implement it your style or if it looks good, I can add the CLI toggle.

See this PR as a base for discussions and not ready to merge.

Also cheers to @nlhepler who did the main work, long time ago.

while (len > 0) {
// match
for (l = 0; l < len && qseq[qoff + l] == tseq[toff + l]; ++l) {}
if (l > 0) p->cigar[m++] = 4 + (l<<4);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously not for me to decide, but I would keep the cigar opcodes exactly the same as in the SAM/BAM spec.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think defining the opcodes in the header (e.g. #define CIGAR_M 0) and not hardcoding them would be very beneficial. If this is done consistently one can easily (and reliably) locate all the places where opcodes are used.

@1pakch
Copy link
Contributor

1pakch commented Apr 27, 2018

@lh3
BTW, I am wondering what was the reason for not defining cigar pairs as

typedef struct {
        uint32_t op : 4;
        uint32_t count : 28;
} cigar_t;

which would obviate the need of explicit masking and shifting.

@lh3 lh3 added this to the 2.11 milestone May 1, 2018
@nlhepler
Copy link

@armintoepfer thanks for posting this and for taking it across the finish line!

I figure at a minimum this behavior needs to be toggle-able via a command-line switch?

And @ilya-kolpakov, I agree it should probably use the numerical conventions from the BAM spec ([MIDNSHPX=] is [012345678]).

Please let me know if there are any suggestions on what needs to be done.

lh3 added a commit that referenced this pull request May 30, 2018
@lh3
Copy link
Owner

lh3 commented May 30, 2018

Thanks a lot for this PR. Very straightforward and better than my initial plan.

Merged via 154d2ca. I have only made some tiny changes. Option --eqx enables the feature. Thanks again.

@lh3 lh3 closed this May 30, 2018
@lh3
Copy link
Owner

lh3 commented May 30, 2018

PS: I haven't carefully tested the feature, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants