From b80dd8c9501cff1e87760233f77cc823b7069ae5 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Thu, 5 Jan 2023 12:32:54 -0600 Subject: [PATCH] Rename reconstruct! function to reconstruct The exclamation mark is conventionally used to mark mutating functions, but reconstruct is no longer mutating, so change the notation. --- docs/src/api.md | 2 +- docs/src/haplotypes.md | 4 ++-- src/Haplotype.jl | 4 ++-- src/SequenceVariation.jl | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/src/api.md b/docs/src/api.md index 693b315..8dcb67a 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -21,7 +21,7 @@ Insertion Haplotype reference(::Haplotype) variations -reconstruct! +reconstruct ``` ## Variations diff --git a/docs/src/haplotypes.md b/docs/src/haplotypes.md index 251670a..fe47bfe 100644 --- a/docs/src/haplotypes.md +++ b/docs/src/haplotypes.md @@ -31,11 +31,11 @@ bos_human_haplotype = Haplotype(bos_human_alignment) If the alternate sequence of a haplotype is no longer available (as is often the case when calling variants from alignment files), then the sequence can be -retrieved using the [`reconstruct!`](@ref) function. +retrieved using the [`reconstruct`](@ref) function. ```@repl call_variants human2 = copy(bovine); -reconstruct!(human2, bos_human_haplotype) +reconstruct(human2, bos_human_haplotype) human2 == bovine human2 == human ``` diff --git a/src/Haplotype.jl b/src/Haplotype.jl index 7a4842b..fc36362 100644 --- a/src/Haplotype.jl +++ b/src/Haplotype.jl @@ -162,11 +162,11 @@ reference(h::Haplotype) = h.ref Base.:(==)(x::Haplotype, y::Haplotype) = x.ref == y.ref && x.edits == y.edits """ - reconstruct!(h::Haplotype) + reconstruct(h::Haplotype) Apply the edits in `h` to the reference sequence of `h` and return the mutated sequence """ -function reconstruct!(h::Haplotype) +function reconstruct(h::Haplotype) len = length(reference(h)) + sum(edit -> _lendiff(edit), _edits(h)) seq = copy(reference(h)) resize!(seq, len % UInt) diff --git a/src/SequenceVariation.jl b/src/SequenceVariation.jl index 93305e6..0e8cadd 100644 --- a/src/SequenceVariation.jl +++ b/src/SequenceVariation.jl @@ -32,7 +32,7 @@ export Substitution export Variation export altbases export mutation -export reconstruct! +export reconstruct export refbases export reference export translate