diff --git a/src/bam/record.jl b/src/bam/record.jl index 13c5608..bf65078 100644 --- a/src/bam/record.jl +++ b/src/bam/record.jl @@ -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 diff --git a/src/sam/record.jl b/src/sam/record.jl index a61e0df..f7f381c 100644 --- a/src/sam/record.jl +++ b/src/sam/record.jl @@ -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)