Skip to content

Commit 22f939f

Browse files
authored
Merge pull request #57 from BioJulia/release/0.3.1
Release v0.3.1
2 parents 946e77a + fe83a74 commit 22f939f

File tree

5 files changed

+23
-32
lines changed

5 files changed

+23
-32
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [0.3.0]
10+
## [0.3.1]
11+
12+
### Changed
13+
14+
- Upgraded to BioAlignments v3 ([#55](https://github.com/BioJulia/XAM.jl/pull/55))
15+
16+
## [0.3.0] - 2022-10-10
1117

1218
## Added
1319

@@ -23,5 +29,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2329

2430
- `BAM.Record` layout now matches the BAM specs ([#26](https://github.com/BioJulia/XAM.jl/pull/26))
2531

26-
[Unreleased]: https://github.com/BioJulia/XAM.jl/compare/v0.3.0...HEAD
32+
[Unreleased]: https://github.com/BioJulia/XAM.jl/compare/v0.3.1...HEAD
33+
[0.3.1]: https://github.com/BioJulia/XAM.jl/compare/v0.3.0...v0.3.1
2734
[0.3.0]: https://github.com/BioJulia/XAM.jl/compare/v0.2.8...v0.3.0

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "XAM"
22
uuid = "d759349c-bcba-11e9-07c2-5b90f8f05f7c"
33
authors = ["Kenta Sato <bicycle1885@gmail.com>", "Ben J. Ward <ward9250@gmail.com>", "Ciarán O'Mara <Ciaran.OMara@utas.edu.au>"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
@@ -17,7 +17,7 @@ TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
1717
[compat]
1818
Automa = "0.7, 0.8"
1919
BGZFStreams = "0.3.1"
20-
BioAlignments = "2.2"
20+
BioAlignments = "3"
2121
BioGenerics = "0.1"
2222
BioSequences = "3"
2323
FormatSpecimens = "1.1"

src/bam/record.jl

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -430,27 +430,11 @@ end
430430
Get the alignment of `record`.
431431
"""
432432
function alignment(record::Record)::BioAlignments.Alignment
433-
checkfilled(record)
434-
if !ismapped(record)
435-
return BioAlignments.Alignment(BioAlignments.AlignmentAnchor[])
436-
end
437-
seqpos = 0
438-
refpos = position(record) - 1
439-
anchors = [BioAlignments.AlignmentAnchor(seqpos, refpos, BioAlignments.OP_START)]
440-
for (op, len) in zip(cigar_rle(record)...)
441-
if BioAlignments.ismatchop(op)
442-
seqpos += len
443-
refpos += len
444-
elseif BioAlignments.isinsertop(op)
445-
seqpos += len
446-
elseif BioAlignments.isdeleteop(op)
447-
refpos += len
448-
else
449-
error("operation $(op) is not supported")
450-
end
451-
push!(anchors, BioAlignments.AlignmentAnchor(seqpos, refpos, op))
433+
if ismapped(record)
434+
return BioAlignments.Alignment(cigar(record), 1, position(record))
452435
end
453-
return BioAlignments.Alignment(anchors)
436+
437+
return BioAlignments.Alignment(BioAlignments.AlignmentAnchor[])
454438
end
455439

456440
function hasalignment(record::Record)

test/test_bam.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@
7979
@test BAM.flag(record) === UInt16(16)
8080
@test BAM.cigar(record) == "27M1D73M"
8181
@test BAM.alignment(record) == Alignment([
82-
AlignmentAnchor( 0, 1, OP_START),
83-
AlignmentAnchor( 27, 28, OP_MATCH),
84-
AlignmentAnchor( 27, 29, OP_DELETE),
85-
AlignmentAnchor(100, 102, OP_MATCH)])
82+
AlignmentAnchor( 0, 1, 0, OP_START),
83+
AlignmentAnchor( 27, 28, 27, OP_MATCH),
84+
AlignmentAnchor( 27, 29, 28, OP_DELETE),
85+
AlignmentAnchor(100, 102, 101, OP_MATCH)])
8686
@test record["XG"] == 1
8787
@test record["XM"] == 5
8888
@test record["XN"] == 0

test/test_sam.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@
104104
@test SAM.flag(record) == 16
105105
@test SAM.cigar(record) == "27M1D73M"
106106
@test SAM.alignment(record) == Alignment([
107-
AlignmentAnchor( 0, 1, OP_START),
108-
AlignmentAnchor( 27, 28, OP_MATCH),
109-
AlignmentAnchor( 27, 29, OP_DELETE),
110-
AlignmentAnchor(100, 102, OP_MATCH)])
107+
AlignmentAnchor( 0, 1, 0, OP_START),
108+
AlignmentAnchor( 27, 28, 27, OP_MATCH),
109+
AlignmentAnchor( 27, 29, 28, OP_DELETE),
110+
AlignmentAnchor(100, 102, 101, OP_MATCH)])
111111
@test record["XG"] == 1
112112
@test record["XM"] == 5
113113
@test record["XN"] == 0

0 commit comments

Comments
 (0)