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

Bug in extended CIGAR output #266

Closed
isovic opened this issue Nov 8, 2018 · 2 comments
Closed

Bug in extended CIGAR output #266

isovic opened this issue Nov 8, 2018 · 2 comments
Labels

Comments

@isovic
Copy link

isovic commented Nov 8, 2018

Hi Heng,
Minimap2 is an amazing tool.
There is an edge case I ran into with the extended CIGAR mode, and wanted to report it.
Data for reproducibility can be found in the attachment: test-data-for-minimap2.tar.gz

Concretely, running the following produces output as expected:

$ minimap2 -c ref.fasta query.fasta
query   10111   0   10111   +   ref 10110   4   10110   10105   10112   60  NM:i:7  ms:i:20168  AS:i:20160  nn:i:0  tp:A:P  cm:i:1911   s1:i:10057  s2:i:0  dv:f:0.0004 cg:Z:509M1I4550M1I1878M1D11M1I2652M1I491M1I7M1I7M

When the --eqx flag is used, the output becomes:

$ minimap2 -c --eqx ref.fasta query.fasta
query   10111   0   10111   +   ref 10110   4   10110   10105   10112   60  NM:i:7  ms:i:20168  AS:i:20160  nn:i:0  tp:A:P  cm:i:1911   s1:i:10057  s2:i:0  dv:f:0.0004 cg:Z:40=2X1=1X1=1X2=2X1=10X1=3X1=2X1=14X3=2X1=1X1=3X2=7X2=2X1=7X1=1X2=3X2=1X2=4X3=2X1=2X1=3X2=5X1=1X1=1X1=1X2=2X1=4X1=2X1=16X1=1X1=14X2=3X2=4X1=2X1=3X1=1X1=3X1=1X1=3X3=7X1=1X1=2X1=1X1=2X1=1X1=3X1=1X1=7X2=3X1=10X1=1X1=2X1=1X1=3X1=5X1=7X1=6X1=3X1=1X1=5X3=1X1=4X4=3X2=2X1=9X3=2X2=2X1=6X2=5X1=2X1=3X1=4X1=6X1=1X4=6X1=1X1=2X1=2X1=1X1=3X2=3X1=3X3=1X1=1X3=9X1=3X2=2X1=1X1=8X1=2X2=3X1=6X1=3X3=4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=7X1=12X2=5X1=3X1=6X2=4X2=6X1=4X1=5X1=1X1=2X1=2X2=3X1=3X1=2X2=6X2=3X2=1X1=3X1=2X2=8X1=2X1=3X2=1X2=2X2=1X1=10X1=3X1=3X1=2X2=6X1=4X1=4X1=7X1=2X3=6X1I2X2=4X2=1X1=1X2=1X1=4X1=5X1=5X1=8X1=1X1=1X1=6X1=8X1=4X2=2X2=1X1=2X1=5X1=3X1=6X1=4X1=1X1=2X2=9X1=1X1=9X2=1X2=1X1=4X2=5X2=1X1=5X1=3X1=2X1=7X2=1X1=6X1=13X1=4X1=4X2=1X1=3X2=9X1=1X2=1X1=3X1=6X1=3X1=1X1=1X1=3X1=8X1=10X1=1X1=1X1=20X2=4X2=2X1=4X1=2X1=3X1=3X1=12X1=1X2=2X1=3X2=3X1=2X1=3X2=5X2=2X1=11X1=3X1=5X1=3X1=2X3=4X1=3X1=8X1=1X1=6X1=6X2=1X1=3X1=3X2=2X1=2X1=1X1=2X1=5X2=3X1=1X1=4X1=4X1=5X3=2X2=1X1I1=3X1=2X1I4X1=2X

However, the edit distance is still NM:i:7.
Specifying either a larger kmer size, or a smaller window size produces sane alignments again:

$ minimap2 -c --eqx -k 20 ref.fasta query.fasta
query   10111   0   10111   +   ref 10110   4   10110   10105   10112   60  NM:i:7  ms:i:20168  AS:i:20168  nn:i:0  tp:A:P  cm:i:1805   s1:i:10062  s2:i:40 dv:f:0.0004 cg:Z:509=1I4550=1I1878=1D11=1I2652=1I491=1I7=1I7=

$ minimap2 -c --eqx -w 5 ref.fasta query.fasta
query   10111   0   10111   +   ref 10110   4   10110   10105   10112   60  NM:i:7  ms:i:20168  AS:i:20168  nn:i:0  tp:A:P  cm:i:3440   s1:i:10074  s2:i:0  dv:f:0.0004 cg:Z:509=1I4550=1I1878=1D11=1I2652=1I491=1I7=1I7=

I tested it on v2.13 and v2.14, and the results are the same.

Hope this helps,
Best regards,
Ivan.

@lh3 lh3 added the bug label Nov 8, 2018
@lh3 lh3 closed this as completed in 83a8ee7 Nov 18, 2018
@lh3
Copy link
Owner

lh3 commented Nov 18, 2018

Thanks so much for the exact example! Very informative.

@isovic
Copy link
Author

isovic commented Nov 19, 2018

No problem, any time.
Thanks for fixing it so fast!

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