1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-11-14 22:33:14 +00:00

Record equivalency functions

This commit is contained in:
Ciarán O'Mara 2020-04-17 15:55:41 +10:00
parent 5fa8c5bd2e
commit 300158dbef
2 changed files with 30 additions and 0 deletions

View file

@ -45,6 +45,19 @@ function Base.convert(::Type{Record}, data::Vector{UInt8})
return record
end
function Base.:(==)(a::Record, b::Record)
return a.block_size == b.block_size &&
a.refid == b.refid &&
a.pos == b.pos &&
a.bin_mq_nl == b.bin_mq_nl &&
a.flag_nc == b.flag_nc &&
a.l_seq == b.l_seq &&
a.next_refid == b.next_refid &&
a.next_pos == b.next_pos &&
a.tlen == b.tlen &&
a.data[1:data_size(a)] == b.data[1:data_size(b)]
end
function Base.copy(record::Record)
copy = Record()
copy.block_size = record.block_size

View file

@ -74,6 +74,23 @@ function Base.convert(::Type{Record}, str::AbstractString)
return Record(Vector{UInt8}(str))
end
function Base.:(==)(a::Record, b::Record)
return a.filled == b.filled &&
a.qname == b.qname &&
a.flag == b.flag &&
a.rname == b.rname &&
a.pos == b.pos &&
a.mapq == b.mapq &&
a.cigar == b.cigar &&
a.rnext == b.rnext &&
a.pnext == b.pnext &&
a.tlen == b.tlen &&
a.seq == b.seq &&
a.qual == b.qual &&
a.fields == b.fields &&
a.data[a.filled] == b.data[b.filled]
end
function Base.show(io::IO, record::Record)
print(io, summary(record), ':')
if isfilled(record)