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

Fix for "Signed Integer Overflow in MAPQ" #96

Merged
merged 1 commit into from
Aug 16, 2021

Conversation

monsanto-pinheiro
Copy link
Contributor

When some read doesn't map at all the MAPQ is a "Signed Integer".
SAM example of a aligned read that does not map:
"597843e1-50df-4887-ab2c-c78a4d9ac28d 2048 chrXV 638441 -2147483648 4870S25M2I7M1I3M1D14M1D7M1I19M101S ..."
The MAPQ in this case is -2147483648. This creates some problems for samtools. "[W::sam_read1_sam] Parse error at line YYYY"
This happens because "mqCount" is zero on return of method "AlignmentBuffer::computeMappingQuality"

When some read doesn't map at all the MAPQ is a "Signed Integer".
SAM example of a aligned read that does not map:
"597843e1-50df-4887-ab2c-c78a4d9ac28d    2048    chrXV   638441  -2147483648     4870S25M2I7M1I3M1D14M1D7M1I19M101S ..."
The MAPQ in this case is -2147483648. This creates some problems for samtools. "[W::sam_read1_sam] Parse error at line YYYY"
This happens because "mqCount" is zero on return of method "AlignmentBuffer::computeMappingQuality"
@smoe
Copy link
Contributor

smoe commented Jul 13, 2021

I just ran into this. A new release tag would be nice! Have many thanks for the fix - much appreciated.

@jmarshall
Copy link

jmarshall commented Aug 8, 2021

👍 from bioconda as well. it would be ideal if there would be a new ngmlr release with this fixed, so that we could provide a ngmlr package that interacts well with current samtools.

Note that mqCount == 0 in computeMappingQuality() does indeed appear to be the cause of this problem (I have inspected the code, but not run any tests), but the appropriate value to return for MAPQ in this case deserves a bit of thought.

What situation does mqCount == 0 represent? Does this call for a low value for MAPQ (e.g. 0), a high value, or perhaps 255 — which the SAM spec describes as “mapping quality is not available”:

0 <= MAPQ <= 255: MAPping Quality. It equals −10 log10 Pr{mapping position is wrong}, rounded to the nearest integer. A value 255 indicates that the mapping quality is not available.

@smoe
Copy link
Contributor

smoe commented Aug 9, 2021

With local Nanopore genomic sequencing data I ran into this bug every ~5000 reads and all reads have passed the guppy QA. @jmarshall, you do not happen to know someone with a personal contact to upstream to help escalating this bug a bit?

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

Successfully merging this pull request may close these issues.

None yet

4 participants