mirror of
https://github.com/MillironX/XAM.jl.git
synced 2025-01-11 00:09:40 -05:00
Add messages to assertions
TODO: determine whether these assertions are intended for debugging purposes?
This commit is contained in:
parent
ccc91123d6
commit
c3c2a9ceda
4 changed files with 6 additions and 5 deletions
|
@ -50,7 +50,9 @@ function Base.iterate(iter::OverlapIterator)
|
||||||
if refindex === nothing
|
if refindex === nothing
|
||||||
throw(ArgumentError("sequence name $(iter.refname) is not found in the header"))
|
throw(ArgumentError("sequence name $(iter.refname) is not found in the header"))
|
||||||
end
|
end
|
||||||
@assert iter.reader.index !== nothing
|
|
||||||
|
@assert iter.reader.index !== nothing "Reader index cannot be nothing."
|
||||||
|
|
||||||
chunks = Indexes.overlapchunks(iter.reader.index.index, refindex, iter.interval)
|
chunks = Indexes.overlapchunks(iter.reader.index.index, refindex, iter.interval)
|
||||||
if !isempty(chunks)
|
if !isempty(chunks)
|
||||||
seek(iter.reader, first(chunks).start)
|
seek(iter.reader, first(chunks).start)
|
||||||
|
|
|
@ -37,7 +37,7 @@ function Base.write(writer::Writer, record::Record)
|
||||||
end
|
end
|
||||||
|
|
||||||
function write_header(stream, header, refseqnames, refseqlens)
|
function write_header(stream, header, refseqnames, refseqlens)
|
||||||
@assert length(refseqnames) == length(refseqlens)
|
@assert length(refseqnames) == length(refseqlens) "Lengths of refseq names and lengths must match."
|
||||||
n = 0
|
n = 0
|
||||||
|
|
||||||
# magic bytes
|
# magic bytes
|
||||||
|
|
|
@ -16,11 +16,10 @@ for (name, bits, doc) in [
|
||||||
(:QCFAIL, UInt16(0x200), "QC failure" ),
|
(:QCFAIL, UInt16(0x200), "QC failure" ),
|
||||||
(:DUP, UInt16(0x400), "optical or PCR duplicate" ),
|
(:DUP, UInt16(0x400), "optical or PCR duplicate" ),
|
||||||
(:SUPPLEMENTARY, UInt16(0x800), "supplementary alignment" ),]
|
(:SUPPLEMENTARY, UInt16(0x800), "supplementary alignment" ),]
|
||||||
@assert bits isa UInt16
|
@assert bits isa UInt16 "The bits must be of type UInt16."
|
||||||
sym = Symbol("FLAG_", name)
|
sym = Symbol("FLAG_", name)
|
||||||
doc = string(@sprintf("0x%04x: ", bits), doc)
|
doc = string(@sprintf("0x%04x: ", bits), doc)
|
||||||
@eval begin
|
@eval begin
|
||||||
@doc $(doc) const $(sym) = $(bits)
|
@doc $(doc) const $(sym) = $(bits)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ function Base.getindex(record::Record, tag::AbstractString)
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ == UInt8('A')
|
if typ == UInt8('A')
|
||||||
@assert lo == hi
|
@assert lo == hi "Values lo and hi must be equivalent."
|
||||||
return Char(record.data[lo])
|
return Char(record.data[lo])
|
||||||
end
|
end
|
||||||
if typ == UInt8('i')
|
if typ == UInt8('i')
|
||||||
|
|
Loading…
Reference in a new issue