Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #237 from bicycle1885/backports-0.2
Browse files Browse the repository at this point in the history
Backports for 0.2
  • Loading branch information
bicycle1885 authored Jul 29, 2016
2 parents 0e0664c + d1877c1 commit 8f87dad
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Compat
IndexableBitVectors 0.1.1
IntervalTrees
Iterators
Libz 0.1.1
Libz 0.2
LightGraphs
LightXML
8 changes: 8 additions & 0 deletions src/align/pairwise/alignment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ function count_aligned(aln::PairwiseAlignment)
return n
end

function ref2seq(i::Integer, aln::PairwiseAlignment)
return ref2seq(i, aln.a)
end

function seq2ref(i::Integer, aln::PairwiseAlignment)
return seq2ref(i, aln.a)
end


# Printers
# --------
Expand Down
4 changes: 2 additions & 2 deletions src/intervals/bigbed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ function Base.start(bb::BigBedData)
parser_isdone = isnull(tryread!(parser, next_interval))

return BigBedIteratorState(seq_names, data_count, 1,
getindex(zlib_stream.source.zstream).total_in,
zlib_stream.source.zstream.total_in,
parser, parser_isdone, next_interval)
end

Expand All @@ -535,7 +535,7 @@ function Base.next(bb::BigBedData, state::BigBedIteratorState)
state.parser = BigBedDataParser(
BufferedInputStream(bb.uncompressed_data, unc_block_size),
seq_names=Nullable(state.seq_names))
state.data_offset += getindex(zlib_stream.source.zstream).total_in
state.data_offset += zlib_stream.source.zstream.total_in

state.parser_isdone = isnull(tryread!(state.parser, state.next_interval))
@assert !state.parser_isdone
Expand Down
19 changes: 19 additions & 0 deletions test/align/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,25 @@ end
@test count_aligned(aln) == 16
end

@testset "Interfaces" begin
seq = dna"ACGTATAGT"
ref = dna"ATCGTATTGGT"
# seq: 1 A-CGTATAG-T 9
# | ||||| | |
# ref: 1 ATCGTATTGGT 11
model = AffineGapScoreModel(EDNAFULL, gap_open=-4, gap_extend=-1)
result = pairalign(GlobalAlignment(), seq, ref, model)
@test isa(result, PairwiseAlignmentResult)
aln = alignment(result)
@test isa(aln, PairwiseAlignment)
@test seq2ref(1, aln) == (1, OP_SEQ_MATCH)
@test seq2ref(2, aln) == (3, OP_SEQ_MATCH)
@test seq2ref(3, aln) == (4, OP_SEQ_MATCH)
@test ref2seq(1, aln) == (1, OP_SEQ_MATCH)
@test ref2seq(2, aln) == (1, OP_DELETE)
@test ref2seq(3, aln) == (2, OP_SEQ_MATCH)
end

@testset "GlobalAlignment" begin
affinegap = AffineGapScoreModel(
match=0,
Expand Down
6 changes: 5 additions & 1 deletion test/tools/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ else
const Test = BaseTestNext
end

using Compat
using Bio.Seq,
Bio.Tools.BLAST,
TestFunctions

get_bio_fmt_specimens()
path = Pkg.dir("Bio", "test", "BioFmtSpecimens")

if !is_windows() # temporarily disable the BLAST tests on Windows (issue: #197)

@testset "BLAST+ blastn" begin
na1 = dna"""
CGGACCAGACGGACACAGGGAGAAGCTAGTTTCTTTCATGTGATTGANAT
Expand All @@ -35,7 +38,6 @@ path = Pkg.dir("Bio", "test", "BioFmtSpecimens")
@test typeof(blastn(na1, nucldb, db=true)) == Array{BLASTResult, 1}
@test typeof(blastn(na1, fna)) == Array{BLASTResult, 1}
@test typeof(blastn(fna, nucldb, db=true)) == Array{BLASTResult, 1}

end

@testset "BLAST+ blastp" begin
Expand All @@ -61,4 +63,6 @@ end
@test typeof(blastp(faa, protdb, db=true)) == Array{BLASTResult, 1}
end

end # if !is_windows()

end # TestTools

0 comments on commit 8f87dad

Please sign in to comment.