mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-12-23 21:28:18 +00:00
Merge branch 'hotfix/SAM'
This commit is contained in:
commit
5aca5f0011
3 changed files with 16 additions and 8 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue