Repository navigation
pairwise2: Improved format_alignment for local alignments and alignments of lists - #1505
Conversation
|
OK, need to have a look at the tutorial. |
Codecov Report
@@ Coverage Diff @@
## master #1505 +/- ##
==========================================
+ Coverage 83.71% 85.04% +1.32%
==========================================
Files 310 311 +1
Lines 50077 50137 +60
==========================================
+ Hits 41923 42640 +717
+ Misses 8154 7497 -657
Continue to review full report at Codecov.
|
|
Ping @JoaoRodrigues and @bow who also joined in the earlier discussion. I know we talked about this before (on #1352), but one-based coordinates make me a little uneasy. I won't attempt to veto this, as I accept this is being used in a human facing pretty-print, rather than a developer facing Otherwise this looks good to merge. |
|
Would it improve things if we are explicit about the coordinate system? IMO part of the problem with 0/1-based coordinates is that we often have to guess which one is being used. For pretty-printing, I don't think it would hurt if we simply also output whether we are using 0 or 1-based coordinate. |
|
My reason for using the 1-based start position is that the output of just expect that this is 1-based. (Actually I do not know any software that uses 0-based numbering in pretty print output, but I only know a few) People who need the real coordinates won't fetch them from the pretty print output, these numbers are given in the alignment result itself. I don't like the idea to add something in the pretty print output regarding the coordinate system for several reasons:
|
5787e3c to
b6387c6
Compare
|
Apologies that this PR got forgotten about. @mdehoon - do you agree with merging this? |
|
I have no objections. |
b6387c6 to
ab2bd18
Compare
|
Thank you very much for approving, merging this now. |
|
Sorry, I'm a little confused about the coordinates right now: The SeqIO documentation says "When storing sequence coordinates (start and end values), Bio.SearchIO uses the Python-style slice convention: zero-based and half-open intervals. For example, if in a BLAST XML output file the start and end coordinates of an HSP are 10 and 28, they would become 9 and 28 in Bio.SearchIO." However, I'm parsing a blast xml output, and I'm under the impression that the coordinates (especially hsp.query_start) are actually 1-based. (In general, keeping the 1-based coordinates as given by blast might better correspond to the Principle of Least Surprise, than converting them to 0-based, no?) |
|
Sorry, my fault, I just noticed that I used Bio.Blast.NCBIXML as the parser, not SeqIO. That probably explains it. Thanks. |
This pull request builds upon #1352 where the pretty print output of
pairwise2was already improved by changing the match line for distinguishing between matches and mismatches.This PR addresses local alignments and alignments of lists:
For local alignments only the aligned part will be shown, together with the starting positions:
pairwise2allows to supply the sequences as lists, however,print_formatwas not able to print them in a pretty way:Example from SO question: https://stackoverflow.com/questions/36142371/nucleotides-separator-in-the-pairwise-sequence-alignment-bio-python
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile and understand that AppVeyor andTravisCI will be used to confirm the Biopython unit tests and
flake8stylechecks pass with these changes.
I am happy be thanked by name in the
NEWS.rstandCONTRIB.rstfiles,and have added myself to those files as part of this pull request. (This
acknowledgement is optional. Note we list the names sorted alphabetically.)