1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-11-23 10:19:56 +00:00

Merge branch 'hotfix/SAM'

This commit is contained in:
Ciarán O'Mara 2020-03-13 22:42:25 +11:00
commit 5aca5f0011
3 changed files with 16 additions and 8 deletions

View file

@ -1,7 +1,7 @@
name = "XAM" name = "XAM"
uuid = "d759349c-bcba-11e9-07c2-5b90f8f05f7c" 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>"] 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] [deps]
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b" Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"

View file

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

View file

@ -151,6 +151,10 @@ end
@test eof(reader) @test eof(reader)
close(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 # iterator
@test length(collect(open(SAM.Reader, joinpath(samdir, "ce#1.sam")))) == 1 @test length(collect(open(SAM.Reader, joinpath(samdir, "ce#1.sam")))) == 1
@test length(collect(open(SAM.Reader, joinpath(samdir, "ce#2.sam")))) == 2 @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.tlen == new_record.tlen
@test record.data == new_record.data @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 # iterator
@test length(collect(open(BAM.Reader, joinpath(bamdir, "ce#1.bam")))) == 1 @test length(collect(open(BAM.Reader, joinpath(bamdir, "ce#1.bam")))) == 1
@test length(collect(open(BAM.Reader, joinpath(bamdir, "ce#2.bam")))) == 2 @test length(collect(open(BAM.Reader, joinpath(bamdir, "ce#2.bam")))) == 2