-
Notifications
You must be signed in to change notification settings - Fork 3
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
DRAFT of AuxAlignment for parsing secondary/supplementary alignments #208
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
- Coverage 91.06% 90.84% -0.22%
==========================================
Files 18 18
Lines 2283 2437 +154
Branches 337 355 +18
==========================================
+ Hits 2079 2214 +135
- Misses 133 149 +16
- Partials 71 74 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not duplicate my comments from #206, so please incorporate those too as appropriate.
Instead of two sub-classes of AuxAlignment
, what about storing an optional enum for if the alignment is secondary or supplementary (or None
if neither or unknown)? Then for the from_tag(value: str)
method, you could condition on if it's 4 values (XA), or 6 values with strand as the third item (SA), or 6 values with the cigar as the third item (XB). Alternatively, could you explain the motivation for the three classes beyond how they parse differently (which I think is resolved above)? Do we want to match on the class/type?
fgpyo/sam/__init__.py
Outdated
if self.alignment_score is not None and self.alignment_score < 0: | ||
errors.append(f"Alignment score cannot be less than 0! Found: {self.alignment_score}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not? I think a negative alignment score is aligned, especially in a global alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to learn more about this concern! I haven't seen a score below zero for any output from bwa
so I figured it would be a sign that data was corrupt. Couple questions:
- Is there a way to run
bwa
in which the score can go below zero? - Knowing that this code will probably parse
bwa
tags for the forseeable future, do you think keeping the strict check is better for safety-sake or would hinder someone in the future with a popular or custom global aligner putting auxiliary alignments in SAM tags?
5277047
to
6d887a1
Compare
6d887a1
to
2369449
Compare
2369449
to
302bf2a
Compare
Closing this and will open a clean PR with a refactor. |
This is a draft PR to explore a common hierarchy for "alignments from SAM tags".
Motivated by:
The diff is ugly but there are only 3 classes. I suggest reviewing like:
AuxAlignment
: abstract parent with some common concrete shared functionsSecondaryAlignment
: functionality specific to secondary alignmentsSupplementaryAlignment
: functionality specific to supplementary alignmentsI was able to make almost everything backwards compatible except:
SupplementaryAlignment
is now a dataclass vs attrsSupplementaryAlignment
had a few init fields renamed@tfenne what do you think?
I'm looking for a quick 👍 👎 so I can abandon the idea, or merge it into my actual feature branch for additional polish and a real round of review.