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

Allow compact printing of alignments #53

Merged
merged 2 commits into from
Jul 22, 2021

Conversation

jakobnissen
Copy link
Member

This changes printing of PairwiseAlignment and PairwiseAlignmentResult, such that they are displayed compactly in vectors and other structs. (I was getting annoyed by having my terminal wrecked when printing vectors of alignments).

When compact, they are now displayed like this:

julia> [aln]
1-element Vector{PairwiseAlignment{LongDNASeq, LongDNASeq}}:
 PairwiseAlignment{LongDNASeq, LongDNASeq}()

julia> [alnresult]
1-element Vector{PairwiseAlignmentResult{Int64, LongDNASeq, LongDNASeq}}:
 PairwiseAlignmentResult{Int64, LongDNASeq, LongDNASeq}(score=15)

This does violate the principle that the thing being printed should contain all the relevant information in the object, but in this case, I think there is no way to do this.

@codecov
Copy link

codecov bot commented Jul 18, 2021

Codecov Report

Merging #53 (2c6f47f) into master (492cd58) will decrease coverage by 0.58%.
The diff coverage is 36.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
- Coverage   88.32%   87.73%   -0.59%     
==========================================
  Files          17       16       -1     
  Lines        1079     1052      -27     
==========================================
- Hits          953      923      -30     
- Misses        126      129       +3     
Impacted Files Coverage Δ
src/pairwise/result.jl 43.47% <0.00%> (-9.16%) ⬇️
src/pairwise/alignment.jl 98.21% <87.50%> (-0.86%) ⬇️
src/operations.jl 85.71% <0.00%> (-4.61%) ⬇️
src/pairwise/algorithms/banded_needleman_wunsch.jl 76.35% <0.00%> (-2.96%) ⬇️
src/pairwise/algorithms/common.jl 90.32% <0.00%> (-0.86%) ⬇️
src/pairwise/algorithms/needleman_wunsch.jl 84.29% <0.00%> (-0.38%) ⬇️
src/BioAlignments.jl
src/submat.jl 98.07% <0.00%> (+0.01%) ⬆️
src/alignment.jl 79.16% <0.00%> (+0.83%) ⬆️
src/anchors.jl 100.00% <0.00%> (+16.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 492cd58...2c6f47f. Read the comment docs.

@BioTurboNick
Copy link

Is there some summary information that would be useful to print? aligned length, ungapped length of each sequence?

@CiaranOMara
Copy link
Member

Does IOContext offer anything here?

@jakobnissen
Copy link
Member Author

Does IOContext offer anything here?

Not 100% sure, but the docs for show states:

Checking the :compact IOContext property of io in such methods is recommended, since some containers show their elements by calling this method with :compact => true.

But yeah, good point @BioTurboNick , I'll add some more info. And also a few more tests of printing, just to make codecov happy :)

@jakobnissen jakobnissen merged commit 5a3354e into BioJulia:master Jul 22, 2021
@jakobnissen
Copy link
Member Author

Codecov is acting up, this is most definitely covered by the tests. Merging

CiaranOMara pushed a commit to CiaranOMara/BioAlignments.jl that referenced this pull request Jun 6, 2022
Allow compact printing of alignments
CiaranOMara pushed a commit to CiaranOMara/BioAlignments.jl that referenced this pull request Jun 7, 2022
Allow compact printing of alignments
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 this pull request may close these issues.

None yet

3 participants