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

Chaining score contributions from anchors seem to be capped by the anchor length, but the paper doesn't explain why #1125

Open
adamnovak opened this issue Oct 24, 2023 · 2 comments
Labels

Comments

@adamnovak
Copy link

In the Minimap2 paper in section 2.1.1, the chaining score contribution from going from one anchor (j) to the next (i) is supposed to be given by:

α(j,i)=min{min{yi−yj,xi−xj},wi} is the number of matching bases between the two anchors

In other words, take minimum distance between the tail ends of the two anchors in the read or in the reference, and then the minimum of that and the length of the destination anchor. That indeed seems to be what is implemented in the code:

minimap2/lchain.c

Lines 124 to 126 in ce03fbc

dg = dr < dq? dr : dq;
q_span = aj->y>>32&0xff;
sc = q_span < dg? q_span : dg;

But why is the length of the destination anchor min'd in here, given what this is described as representing? Is this quantity really the "number of matching bases between the two anchors"? Or is it really intended to be something like the additional matching bases in anchor i that do not overlap matching bases in anchor j?

@lh3
Copy link
Owner

lh3 commented Nov 2, 2023

Is this quantity really the "number of matching bases between the two anchors"? Or is it really intended to be something like the additional matching bases in anchor i that do not overlap matching bases in anchor j?

This seems the same to me?

@lh3 lh3 added the question label Nov 2, 2023
@adamnovak
Copy link
Author

I'm thinking of the anchors as objects that occupy space in the read and the reference. For simplicity, consider the case of all matches. If there were zero bases "between" two anchors, the last base involved in the first anchor would immediately precede the first base involved in the second anchor. If there is some space between them it would look like this:

ACGTACGTACGTGATGA (Read)
JJJJJ (Anchor j = (0, 0, 5))
            IIIII (Anchor i = (12, 12, 5))
     ||||||| (7 matching bases between boundaries)
ACGTACGTACGTGATGA (Ref)

But given the 3-tuple anchor representation it could also be natural to think of anchors as point objects, with an associated w width but not actually occupying that space. But that also doesn't seem to describe what's being computed.

ACGTACGTACGTGATGA (Read)
J (Anchor j = (0, 0, 5))
            I (Anchor i = (12, 12, 5))
|||||||||||| (12 matching bases between start points)
ACGTACGTACGTGATGA (Ref)

Either way we still get:

α(j,i)=min{min{yi−yj,xi−xj},wi}
= min{min{12 - 5, 12 - 5}, 5}
= min{min{7, 7}, 5}
= min{7, 5}
= 5

The wi cap is hit and restricts the result.

Or have I missed a step where we ensured that the number of (potentially) matching bases between two anchors can't exceed the anchor width?

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

No branches or pull requests

2 participants