mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-24 06:19:54 +00:00
Compare commits
9 commits
2ff4181dd8
...
f38f0edb00
Author | SHA1 | Date | |
---|---|---|---|
f38f0edb00 | |||
a437409afc | |||
52d401d623 | |||
381e4f9736 | |||
e621983dd5 | |||
c360caf9bd | |||
0b2879b78c | |||
6119368af3 | |||
860ce56b34 |
7 changed files with 34 additions and 4 deletions
|
@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.2.0] - 2023-01-10
|
||||
|
||||
### Added
|
||||
|
||||
- Tutorial-type documentation ([#28](https://github.com/BioJulia/SequenceVariation.jl/pull/28))
|
||||
- `Base.isless` implementation for `Edit` and `Variation` ([#31](https://github.com/BioJulia/SequenceVariation.jl/pull/31))
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -60,7 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `Variant` constructor to automatically detect mutations from a `BioAlignments.PairwiseAlignment`
|
||||
- Methods to get reference and alternate bases from a `Variation`
|
||||
|
||||
[unreleased]: https://github.com/BioJulia/SequenceVariation.jl/compare/v0.1.4...HEAD
|
||||
[unreleased]: https://github.com/BioJulia/SequenceVariation.jl/compare/v0.2.0...HEAD
|
||||
[0.2.0]: https://github.com/BioJulia/SequenceVariation.jl/compare/v0.1.4...v0.2.0
|
||||
[0.1.4]: https://github.com/BioJulia/SequenceVariation.jl/compare/v0.1.3...v0.1.4
|
||||
[0.1.3]: https://github.com/BioJulia/SequenceVariation.jl/compare/v0.1.2...v0.1.3
|
||||
[0.1.2]: https://github.com/BioJulia/SequenceVariation.jl/compare/v0.1.1...v0.1.2
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name = "SequenceVariation"
|
||||
uuid = "eef6e190-9969-4f06-a38f-35a110a8fdc8"
|
||||
authors = ["Jakob Nybo Nissen <jakobnybonissen@gmail.com>", "Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>"]
|
||||
version = "0.1.4"
|
||||
version = "0.2.0"
|
||||
|
||||
[deps]
|
||||
BioAlignments = "00701ae9-d1dc-5365-b64a-a3a3ebf5695e"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
[![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/BioJulia/SequenceVariation.jl/blob/master/LICENSE)
|
||||
[![Stable documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://biojulia.github.io/SequenceVariation.jl/stable)
|
||||
[![Latest documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://biojulia.github.io/SequenceVariation.jl/dev/)
|
||||
[![DOI](https://zenodo.org/badge/343847382.svg)](https://zenodo.org/badge/latestdoi/343847382)
|
||||
|
||||
> This project follows the [semver](https://semver.org) _pro forma_ and uses the [OneFlow branching model](https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow).
|
||||
|
||||
|
@ -23,7 +24,7 @@ add SequenceVariation
|
|||
|
||||
## Testing
|
||||
|
||||
SequenceVariation is tested against Julia `1.X` on Linux, OS X, and Windows.
|
||||
SequenceVariation is tested against Julia `1.6` (LTS), `1.X` (release) and nightly on Linux.
|
||||
|
||||
**Latest build status:**
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ add SequenceVariation
|
|||
|
||||
## Testing
|
||||
|
||||
SequenceVariation is tested against Julia `1.X` on Linux, OS X, and Windows.
|
||||
SequenceVariation is tested against Julia `1.6` (LTS), `1.X` (release) and nightly on Linux.
|
||||
|
||||
**Latest build status:**
|
||||
|
||||
|
|
|
@ -17,6 +17,13 @@ end
|
|||
Base.length(e::Edit) = length(_mutation(e))
|
||||
Base.:(==)(e1::Edit, e2::Edit) = e1.pos == e2.pos && e1.x == e2.x
|
||||
Base.hash(x::Edit, h::UInt) = hash(Edit, hash((x.x, x.pos), h))
|
||||
function Base.isless(x::Edit, y::Edit)
|
||||
if leftposition(x) == leftposition(y)
|
||||
return length(x) < length(y)
|
||||
end
|
||||
|
||||
return leftposition(x) < leftposition(y)
|
||||
end
|
||||
|
||||
function Base.parse(::Type{T}, s::AbstractString) where {T<:Edit{Se,Sy}} where {Se,Sy}
|
||||
return parse(T, String(s))
|
||||
|
|
|
@ -75,6 +75,11 @@ BioGenerics.leftposition(v::Variation) = leftposition(_edit(v))
|
|||
BioGenerics.rightposition(v::Variation) = rightposition(_edit(v))
|
||||
Base.:(==)(x::Variation, y::Variation) = x.ref == y.ref && x.edit == y.edit
|
||||
Base.hash(x::Variation, h::UInt) = hash(Variation, hash((x.ref, x.edit), h))
|
||||
function Base.isless(x::Variation, y::Variation)
|
||||
reference(x) == reference(y) ||
|
||||
error("Variations cannot be compared if their reference sequences aren't equal")
|
||||
return leftposition(x) < leftposition(y)
|
||||
end
|
||||
|
||||
"""
|
||||
_is_valid(v::Variation)
|
||||
|
|
|
@ -36,6 +36,15 @@ seq1 = ungap!(dna"--ATGCGTGTTAGCAAC--TTATCGCG")
|
|||
seq2 = ungap!(dna"TGATGCGTGT-AGCAACACTTATAGCG")
|
||||
var = Haplotype(align(seq1, seq2))
|
||||
|
||||
@testset "EditSorting" begin
|
||||
S = typeof(seq1)
|
||||
T = eltype(seq1)
|
||||
@test SequenceVariation.Edit{S,T}(Deletion(1), 1) <
|
||||
SequenceVariation.Edit{S,T}(Deletion(1), 2)
|
||||
@test SequenceVariation.Edit{S,T}(Deletion(1), 1) <
|
||||
SequenceVariation.Edit{S,T}(Deletion(2), 1)
|
||||
end
|
||||
|
||||
@testset "HaplotypeRoundtrip" begin
|
||||
for v in variations(var)
|
||||
@test v in var
|
||||
|
@ -47,6 +56,10 @@ end
|
|||
@test reconstruct(var) == seq1
|
||||
end
|
||||
|
||||
@testset "VariationSorting" begin
|
||||
@test Variation(seq2, "A3T") < Variation(seq2, "T4A")
|
||||
end
|
||||
|
||||
@testset "VariationPosition" begin
|
||||
refseq = dna"ACAACTTTATCT"
|
||||
mutseq = dna"ACATCTTTATCT"
|
||||
|
|
Loading…
Reference in a new issue