1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-12-23 21:28:18 +00:00

Merge branch 'master' into develop

This commit is contained in:
Ciarán O'Mara 2020-03-13 22:58:02 +11:00
commit 7a4d6d143d
3 changed files with 16 additions and 8 deletions

View file

@ -1,7 +1,7 @@
name = "XAM"
uuid = "d759349c-bcba-11e9-07c2-5b90f8f05f7c"
authors = ["Kenta Sato <bicycle1885@gmail.com>", "Ben J. Ward <ward9250@gmail.com>", "Ciarán O'Mara <Ciaran.OMara@utas.edu.au>"]
version = "0.1.0"
version = "0.1.1"
[deps]
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"

View file

@ -321,15 +321,15 @@ function alignlength(record::Record)::Int
len = 0 # operation length
for i in record.cigar
c = record.data[i]
if c UInt8('0'):UInt8('9')
if in(c, UInt8('0'):UInt8('9'))
len = len * 10 + (c - UInt8('0'))
else
op = convert(BioAlignments.Operation, Char(c))
if BioAlignments.ismatchop(op) || BioAlignments.isdeleteop(op)
ret += len
len = 0
end
continue
end
op = convert(BioAlignments.Operation, Char(c))
if BioAlignments.ismatchop(op) || BioAlignments.isdeleteop(op) #Note: reference consuming ops ('M', 'D', 'N', '=', 'X').
ret += len
end
len = 0
end
return ret
end

View file

@ -151,6 +151,10 @@ end
@test eof(reader)
close(reader)
# rightposition (also implicitly alignlength)
records = collect(open(SAM.Reader, joinpath(samdir, "ce#5b.sam")))
@test SAM.rightposition(records[6]) == rightposition(records[6]) == 83
# iterator
@test length(collect(open(SAM.Reader, joinpath(samdir, "ce#1.sam")))) == 1
@test length(collect(open(SAM.Reader, joinpath(samdir, "ce#2.sam")))) == 2
@ -308,6 +312,10 @@ end
@test record.tlen == new_record.tlen
@test record.data == new_record.data
# rightposition (also implicitly alignlength)
records = collect(open(BAM.Reader, joinpath(bamdir, "ce#5b.bam")))
@test BAM.rightposition(records[6]) == rightposition(records[6]) == 83
# iterator
@test length(collect(open(BAM.Reader, joinpath(bamdir, "ce#1.bam")))) == 1
@test length(collect(open(BAM.Reader, joinpath(bamdir, "ce#2.bam")))) == 2