Repository navigation
Show matches vs mismatches in pairwise2 printing - #1352
Conversation
|
@peterjc I have thought about similar things since I'm working on |
|
I agree this could be made much more complicated by considering the scoring, there are conventions in EMBOSS and ClustalW which might make sense to follow here. It looks like I missed updating the doctests in the pull request; I will leave that extra work for now since you are not keen. Any thoughts @bow? Should we close this? |
|
As far as visualizations aid go, I'm almost ok with the changes actually (but I don't feel strongly about accepting/rejecting it either). The only changes I would make is indeed to distinguish between gaps and mismatches. But even then, these are only visualization aids and not meant to be something that end users can work with (e.g. so that they can query the what the second mismatch of the alignment). If we are making the alignments interpretable, I think a more suitable solution would be having something like CIGAR strings (but different, since CIGARs do not distinguish matches and mismatches). |
|
FYI, CIGAR (in the SAM/BAM format) has |
|
Given the only change is to the "human readable" output, I doubt this would break existing scripts. Regarding showing gaps more clearly, any suggestion for the symbol to use (dot?), and how to implement that cleanly? |
|
Ah, indeed there are the |
|
Current releases local alignment example from Current suggestion on pull request using Bow's suggestion using That looks better than I expected. Worth trying? |
|
EMBOSS uses a
A local alignment would have leading and trailing blanks which should be clear (since a local alignment will always begin with a match/mismatch). |
|
You've convinced me Given this code uses blanks for unaligned (for local alignments), using it for gaps seems a little bit confusing - but again, it would match other tools like EMBOSS. |
|
As long as you are aware if it was a local or global alignment, then yes, the leading/trailing spaces on the middle line are not ambiguous. |
|
The problem with You can infer from the alignment result if it was global or local from the end and start positions (global alignments alway start at 0 and end at the length of th alignment): |
TODO: Show only aligned region for local alignments?
Codecov Report
@@ Coverage Diff @@
## master #1352 +/- ##
==========================================
+ Coverage 84.48% 84.48% +<.01%
==========================================
Files 319 319
Lines 48851 48852 +1
==========================================
+ Hits 41271 41272 +1
Misses 7580 7580
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1352 +/- ##
==========================================
+ Coverage 84.48% 84.48% +<.01%
==========================================
Files 319 319
Lines 48851 48858 +7
==========================================
+ Hits 41271 41280 +9
+ Misses 7580 7578 -2
Continue to review full report at Codecov.
|
|
@MarkusPiotrowski I like your idea to solve the space issue by changing the display of local alignments. Would you like to implement that on top of this branch? |
|
Yes, I will try this locally (after this branch has been merged) and then make a separate PR. |
|
The newly introduced trailing whitespace has its downsides for linting with flake8. Over to you @MarkusPiotrowski - merge as is and then work on changing how local alignments are shown? |
|
Yes, please. |
|
Thank you both for looking at this. |
See pull request #1352 and discussion there-in.
See pull request biopython#1352 and discussion there-in.
See pull request biopython#1352 and discussion there-in.
|
@peterjc My question is: zero-based or one-based positions? Since this is a pretty print I would prefer the one-based output, which is what EMBOSS' Water is doing: |
|
Ping @bow - how do SearchIO or the BLAST alignment objects present coordinates in their alignment pretty prints? Otherwise given this is pretty printing, I have no particular stance here. As long as it explicit in the docstring ;) |
|
SearchIO displays a 0-based coordinate. Here's an example parsing one of our test cases: My reason for doing so was simply because it's part of SearchIO's 'contract' with users that coordinates are all converted to 0-based, half open (per the documentation). For pretty-printing alignment formats, since there are no specific object model per-se (and different alignment tool may do it differently), I would probably go with 1-based. Regardless of the indexing base, I would personally find it helpful if the output includes a mention of the coordinate base (i.e. just output |
|
As someone who often writes this kind of little helper function for alignments, I'd go with 1-based as well as it's the natural way of counting amino acids/nucleotides in a sequence. |
This would help with situations like https://www.biostars.org/p/265338/#265624 by making the matches and mismatches of the aligned region easier to see.
Note space is already used to mean an unaligned region, thus I picked
:to go with|.@MarkusPiotrowski and @bow: Could you review this please (eg is there any convention in
Bio.SearchIOwe could follow here)?