mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-11-14 22:33:14 +00:00
Bring up-to-date with master branch of BioAlignments.jl
Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
parent
e5c553aa45
commit
de252188e8
3 changed files with 14 additions and 11 deletions
|
@ -436,7 +436,9 @@ function alignment(record::Record)::BioAlignments.Alignment
|
||||||
end
|
end
|
||||||
seqpos = 0
|
seqpos = 0
|
||||||
refpos = position(record) - 1
|
refpos = position(record) - 1
|
||||||
anchors = [BioAlignments.AlignmentAnchor(seqpos, refpos, BioAlignments.OP_START)]
|
alnpos = 0
|
||||||
|
|
||||||
|
anchors = [BioAlignments.AlignmentAnchor(seqpos, refpos, alnpos, BioAlignments.OP_START)]
|
||||||
for (op, len) in zip(cigar_rle(record)...)
|
for (op, len) in zip(cigar_rle(record)...)
|
||||||
if BioAlignments.ismatchop(op)
|
if BioAlignments.ismatchop(op)
|
||||||
seqpos += len
|
seqpos += len
|
||||||
|
@ -448,7 +450,8 @@ function alignment(record::Record)::BioAlignments.Alignment
|
||||||
else
|
else
|
||||||
error("operation $(op) is not supported")
|
error("operation $(op) is not supported")
|
||||||
end
|
end
|
||||||
push!(anchors, BioAlignments.AlignmentAnchor(seqpos, refpos, op))
|
alnpos += len
|
||||||
|
push!(anchors, BioAlignments.AlignmentAnchor(seqpos, refpos, alnpos, op))
|
||||||
end
|
end
|
||||||
return BioAlignments.Alignment(anchors)
|
return BioAlignments.Alignment(anchors)
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,10 +79,10 @@
|
||||||
@test BAM.flag(record) === UInt16(16)
|
@test BAM.flag(record) === UInt16(16)
|
||||||
@test BAM.cigar(record) == "27M1D73M"
|
@test BAM.cigar(record) == "27M1D73M"
|
||||||
@test BAM.alignment(record) == Alignment([
|
@test BAM.alignment(record) == Alignment([
|
||||||
AlignmentAnchor( 0, 1, OP_START),
|
AlignmentAnchor( 0, 1, 0, OP_START),
|
||||||
AlignmentAnchor( 27, 28, OP_MATCH),
|
AlignmentAnchor( 27, 28, 27, OP_MATCH),
|
||||||
AlignmentAnchor( 27, 29, OP_DELETE),
|
AlignmentAnchor( 27, 29, 28, OP_DELETE),
|
||||||
AlignmentAnchor(100, 102, OP_MATCH)])
|
AlignmentAnchor(100, 102, 101, OP_MATCH)])
|
||||||
@test record["XG"] == 1
|
@test record["XG"] == 1
|
||||||
@test record["XM"] == 5
|
@test record["XM"] == 5
|
||||||
@test record["XN"] == 0
|
@test record["XN"] == 0
|
||||||
|
|
|
@ -104,10 +104,10 @@
|
||||||
@test SAM.flag(record) == 16
|
@test SAM.flag(record) == 16
|
||||||
@test SAM.cigar(record) == "27M1D73M"
|
@test SAM.cigar(record) == "27M1D73M"
|
||||||
@test SAM.alignment(record) == Alignment([
|
@test SAM.alignment(record) == Alignment([
|
||||||
AlignmentAnchor( 0, 1, OP_START),
|
AlignmentAnchor( 0, 1, 0, OP_START),
|
||||||
AlignmentAnchor( 27, 28, OP_MATCH),
|
AlignmentAnchor( 27, 28, 27, OP_MATCH),
|
||||||
AlignmentAnchor( 27, 29, OP_DELETE),
|
AlignmentAnchor( 27, 29, 28, OP_DELETE),
|
||||||
AlignmentAnchor(100, 102, OP_MATCH)])
|
AlignmentAnchor(100, 102, 101, OP_MATCH)])
|
||||||
@test record["XG"] == 1
|
@test record["XG"] == 1
|
||||||
@test record["XM"] == 5
|
@test record["XM"] == 5
|
||||||
@test record["XN"] == 0
|
@test record["XN"] == 0
|
||||||
|
|
Loading…
Reference in a new issue