# \[BioSequences\] data structure to keep mutations (delta) of a sequence

**URL:** <https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263>\
**Category:** Biology, Health, and Medicine\
**Created:** [March 6, 2024, 9:46pm UTC](https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263 "2024-03-06T21:46:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Antoniotti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marco_antoniotti/32/18697_2.png) [@Marco\_Antoniotti](https://discourse.julialang.org/u/Marco_Antoniotti)\
**Post date:** [March 6, 2024, 9:46pm UTC](https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263/1 "2024-03-06T21:46:22Z")

</div>

Hi

we are looking to a data structure to keep tract of the “evolution” of a sequence. What suggestions do you have in this respect? `LongSubSeq` views look useful, but they always refer to the the “main” sequence. What we need is to keep a “list” accumulating differences with a “reference” sequence. Maybe GenomeGrapsh.jl?

Thanks

All the best

Marco

---

<div class="post-metadata">

**Author:** ![camilogarciabotero](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/camilogarciabotero/32/35000_2.png) [@camilogarciabotero](https://discourse.julialang.org/u/camilogarciabotero)\
**Post date:** [March 6, 2024, 10:32pm UTC](https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263/2 "2024-03-06T22:32:44Z")

</div>

You might be intersted in [SequenceVariation.jl](https://biojulia.dev/SequenceVariation.jl/dev/variations/). There is a current [discussion](https://github.com/BioJulia/SequenceVariation.jl/discussions/43) to change the API that also might be important to keep in mind.

---

<div class="post-metadata">

**Author:** ![MillironX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/millironx/32/28274_2.png) [@MillironX](https://discourse.julialang.org/u/MillironX)\
**Post date:** [March 7, 2024, 4:38am UTC](https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263/3 "2024-03-07T04:38:29Z")

</div>

Hi @Marco_Antoniotti, the current maintainer of SequenceVariation.jl here.

SequenceVariation.jl works exactly by storing a reference sequence and a vector of `Edit`s that modify the sequence using the [`Haplotype` type](https://biojulia.dev/SequenceVariation.jl/stable/haplotypes/). The caveat where you might be concerned, is that the vector of `Edit`s is always sorted by position, and won’t be able to store any “accumulation” of mutations to simulate evolution. You could work around that by [`translate`ing](https://biojulia.dev/SequenceVariation.jl/stable/haplotypes/) the more mutated sequences to the less mutated sequences, but there isn’t a very clean way to do that yet (in fact, that very idea is what sparked our discussion on how to restructure the API).

If you have any questions about or suggestions for SequenceVariation for your use case, hit me up, I’d be glad to help.

---

<div class="post-metadata">

**Author:** ![Marco\_Antoniotti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marco_antoniotti/32/18697_2.png) [@Marco\_Antoniotti](https://discourse.julialang.org/u/Marco_Antoniotti)\
**Post date:** [March 7, 2024, 2:16pm UTC](https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263/4 "2024-03-07T14:16:07Z")

</div>

Thanks. I would not mind joining in the discussion.

Let me catch up…

MA

---

<div class="post-metadata">

**Author:** ![Marco\_Antoniotti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marco_antoniotti/32/18697_2.png) [@Marco\_Antoniotti](https://discourse.julialang.org/u/Marco_Antoniotti)\
**Post date:** [March 7, 2024, 9:38pm UTC](https://discourse.julialang.org/t/biosequences-data-structure-to-keep-mutations-delta-of-a-sequence/111263/5 "2024-03-07T21:38:40Z")

</div>

Hi @MillironX

I read the discussion about the new interface you propose ([Idea for reworking the type structure (adding abstract types) · BioJulia/SequenceVariation.jl · Discussion #43 · GitHub](https://github.com/BioJulia/SequenceVariation.jl/discussions/43))

Let me say that I agree with you. First you get it right (and **clean** ), and then you get it fast (e.g., using something like [Home · Match.jl](https://juliaservices.github.io/Match.jl/stable/) if you must; no need to evoke rusting concepts - after all Julia has decent macros).

I think the data structures may work, the issue is whether you can have an `Edit` of an `Edit`. If you could, we’d be home free.

I can put a student to work on this. Maybe we can also chat over Zoom/WebEx/Meet/Whatever.

All the best

Marco
