1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-12-22 12:58:19 +00:00

Minimal adjustements

This commit is contained in:
Ciarán O'Mara 2020-08-13 14:06:43 +10:00
parent 433b8d14e8
commit d38c2becf0
2 changed files with 18 additions and 13 deletions

View file

@ -511,9 +511,12 @@ end
Get the segment sequence of `record`.
"""
function sequence(record::Record)::BioSequences.LongDNASeq
function sequence(record::Record)
checkfilled(record)
seqlen = seqlength(record)
if seqlen == 0
return nothing
end
data = Vector{UInt64}(undef, cld(seqlen, 16))
src::Ptr{UInt64} = pointer(record.data, seqname_length(record) + n_cigar_op(record, false) * 4 + 1)
for i in 1:lastindex(data)

View file

@ -206,9 +206,9 @@ Get the 1-based leftmost mapping position of `record`.
function position(record::Record)::Int
checkfilled(record)
pos = unsafe_parse_decimal(Int, record.data, record.pos)
if pos == 0
missingerror(:position)
end
# if pos == 0
# missingerror(:position)
# end
return pos
end
@ -263,9 +263,9 @@ Get the position of the mate/next read of `record`.
function nextposition(record::Record)::Int
checkfilled(record)
pos = unsafe_parse_decimal(Int, record.data, record.pnext)
if pos == 0
missingerror(:nextposition)
end
# if pos == 0
# missingerror(:nextposition)
# end
return pos
end
@ -299,7 +299,8 @@ Get the CIGAR string of `record`.
function cigar(record::Record)::String
checkfilled(record)
if ismissing(record, record.cigar)
missingerror(:cigar)
# missingerror(:cigar)
return ""
end
return String(record.data[record.cigar])
end
@ -377,9 +378,9 @@ Get the template length of `record`.
function templength(record::Record)::Int
checkfilled(record)
len = unsafe_parse_decimal(Int, record.data, record.tlen)
if len == 0
missingerror(:tlen)
end
# if len == 0
# missingerror(:tlen)
# end
return len
end
@ -392,10 +393,11 @@ end
Get the segment sequence of `record`.
"""
function sequence(record::Record)::BioSequences.LongDNASeq
function sequence(record::Record)
checkfilled(record)
if ismissing(record, record.seq)
missingerror(:sequence)
# missingerror(:sequence)
return nothing
end
seqlen = length(record.seq)
ret = BioSequences.LongDNASeq(seqlen)