Skip to content

Commit

Permalink
Add info to printing and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobnissen committed Jul 22, 2021
1 parent d71c399 commit 2c6f47f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ authors = ["Kenta Sato <[email protected]>", "Ben J. Ward <benjward@protonma
version = "2.0.0"

[deps]
BioGenerics = "47718e42-2ac5-11e9-14af-e5595289c2ea" # Note: required for distance function.
BioGenerics = "47718e42-2ac5-11e9-14af-e5595289c2ea"
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
BioSymbols = "3c28c6f8-a34d-59c4-9654-267d177fcfa9"
IntervalTrees = "524e6230-43b7-53ae-be76-1e9e4d08d11b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[compat]
julia = "1"
BioGenerics = "0.1"
BioSequences = "2"
BioSymbols = "4"
IntervalTrees = "1"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
8 changes: 7 additions & 1 deletion src/pairwise/alignment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ aln2ref(aln::PairwiseAlignment, i::Integer) = aln2ref(aln.a, i)
# Printers
# --------

showshort(io::IO, aln::PairwiseAlignment) = print(io, summary(aln), "()")
function showshort(io::IO, aln::PairwiseAlignment)
print(io, summary(aln), "(lengths=(",
length(aln.a.seq), ", ", length(aln.b),
")/", length(aln), ')'
)
end

Base.show(io::IO, aln::PairwiseAlignment) = showshort(io, aln)

function Base.show(io::IO, ::MIME"text/plain", aln::PairwiseAlignment)
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,12 @@ end
| |||| | |
ref: 49 CVVESSVLRA 58
"""
buf = IOBuffer()
print(buf, (aln,))
@test String(take!(buf)) == (
"""(PairwiseAlignment{$seqtype,$(VERSION >= v"1.6" ? " " : "")$(seqtype)}""" *
"""(lengths=(58, 58)/60),)"""
)
# Result from EMBOSS Needle:
# EMBOSS_001 1 EPVTSHPKAVSPTETK--PTEKGQHLPVSAPPKITQSLKAEASKDIAKLT 48
# || |||||||||||| ||||.|||||||||||||.|||||||:|||||
Expand Down

0 comments on commit 2c6f47f

Please sign in to comment.