Skip to content

bug: bbmap ambig=random allows split alignments even with killbadpairs #33

Description

@eboyden

v40.02. There's actually two (possibly related) issues here:

I typically use bbmap on amplicon libraries so I expect only properly paired alignments (reads nearby on opposite strands). Accordingly I almost always use killbadpairs to prevent discordant paired alignments and pairedonly to ensure singletons are rendered unmapped. I also always set deterministic and averagepairdistance. Typically I also set ambig=toss.

Issue 1 (bug):
When I set ambig=random I get multiple split alignments, with reads mapped to different chromosomes. This should never occur with killbadpairs, reads mapping to different chromosomes is the same as reads mapping to the same strand or with the wrong insert size.

Issue 2 (not really a bug, more like an algorithm flaw):
When I set ambig=toss I only get alignments with mapqs ≥11. When I set ambig=best I also get ambiguous alignments with mapq=2 and mapq=3 (not sure why these aren't mapq=0 which is how most other aligners set mapq for multiple equally good alignments, but ok). But I also get more alignments for every mapq ≥11, because one read maps ambiguously but the other does not, so in "toss" mode with kbp po they're both discarded, but in "best" mode they're both kept, e.g. one with mapq=2 and the other with mapq ≥11.

To me, considering only the uniqueness of each read individually defeats much of the value of aligning paired reads; if I just want bbmap's best guess for each read's optimal alignment regardless of pairing I would just align in single-end mode. Rather, the uniqueness of the pair should be considered, with the aligner striving to keep reads together in a concordant alignment rather than separating them (which it should only do if no concordant alignment can be found). In this example case, they should not be discarded in "toss" mode because one of the reads aligned uniquely and the other read can be placed nearby. Only in cases where there are multiple concordant paired alignments should "toss" discard the pair (or if there are zero, then consider each read individually, but in this case kbp po should eliminate them).

This relates to Issue 1 because with ambig=random, bbmap should assign the pair to a random location with a concordant alignment if possible, rather than separating them (and if a concordant alignment is not possible, then kbp should unmap the worse read and po should unmap the other). If one read in a pair aligns to several locations and the other only aligns to one, then "random" should always align the pair to the one unique location.

Activity

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

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