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

Handling unmapped results in BwaAlnInteractive._to_result #68

Open
ameynert opened this issue Oct 8, 2024 · 1 comment · May be fixed by #69
Open

Handling unmapped results in BwaAlnInteractive._to_result #68

ameynert opened this issue Oct 8, 2024 · 1 comment · May be fixed by #69

Comments

@ameynert
Copy link

ameynert commented Oct 8, 2024

bwa aln sometimes returns a read that is unmapped but does have hits (both primary and XA tag). Suggest that we ignore this case:

        num_hits: int = int(rec.get_tag("HN")) if rec.has_tag("HN") else 0
        if num_hits > self.max_hits:
            return BwaResult(query=query, hit_count=num_hits, hits=[])
        else:
            hits = self.to_hits(rec=rec)
            hit_count = num_hits if len(hits) == 0 else len(hits)
            return BwaResult(query=query, hit_count=hit_count, hits=hits)
@msto msto linked a pull request Oct 8, 2024 that will close this issue
@ameynert
Copy link
Author

ameynert commented Oct 8, 2024

The three valid scenarios for hits being returned from bwa aln are:

  1. Read is unmapped. HN = 0, there should be no XA tags returned, and thus hits = []
  2. Read is mapped, potentially multiply-mapped. 0 < HN <= max_hits. HN = n, where n is the number of hits, and len(hits) == n
  3. Read is multiply-mapped, HN > max_hits. HN = n, where n is the number of hits, and hits = [] because although the primary hit is returned, there are no XA tags representing the alternate reads, so we return none of them.

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 a pull request may close this issue.

1 participant