Skip to content

Add getter methods (and forwarded getter methods) for alignment types #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 1, 2022

Conversation

MillironX
Copy link
Member

Types of changes

This PR implements the following changes:

  • ✨ New feature (A non-breaking change which adds functionality).
  • 🐛 Bug fix (A non-breaking change, which fixes an issue).
  • 💥 Breaking change (fix or feature that would cause existing functionality to change).

📋 Additional detail

The idea for these getter functions first came up in the discussion at #80 (comment). These functions are intended to be user-friendly band-aids over the disjointed API between Alignment, AlignedSequence, PairwiseAlignment, and PairwiseAlignmentResult. There are five new methods, with one new exported function.

  • alignment(::AlignedSequence) -> Alignment
  • alignment(::PairwiseAlignment) -> Alignment
  • new sequence(::AlignedSequence) -> LongSequence
  • new sequence(::PairwiseAlignment) -> LongSequence
  • new sequence(::PairwiseAlignmentResult) -> LongSequence

Note that alignment(::PairwiseAlignmentResult) already returns a PairwiseAlignment. I opted for liberal documentation over breaking the API.

I added extra documentation and tests in the form of doctests. I didn't add any additional tests to the regular test suite, as getter function tests are pretty redundant.

My hope is that this closes out the feature list of BioAlignments v2, and we can get #44 merged and move on to BioAlignments v3 after this.

Note: I branched off of the hotfix/v2.2.0 branch, so this branch is out-of-date with master and will likely need merged manually. Another reason to move beyond #44.

☑️ Checklist

  • 🎨 The changes implemented is consistent with the julia style guide.
  • 📘 I have updated and added relevant docstrings, in a manner consistent with the documentation styleguide.
  • 📘 I have added or updated relevant user and developer manuals/documentation in docs/src/.
  • 🆗 There are unit tests that cover the code changes I have made.
  • 🆗 The unit tests cover my code changes AND they pass.
  • 📝 I have added an entry to the [UNRELEASED] section of the manually curated CHANGELOG.md file for this repository.
  • 🆗 All changes should be compatible with the latest stable version of Julia.
  • 💭 I have commented liberally for any complex pieces of internal code.

alignment(::AlignedSequence) and alignment(::PairwiseAlignmentResult)
both return an Alignment, but alignment(::PairwiseAlignmentResult) has
always returned a PairwiseAlignment. I don't want to break the current
implementation for alignment(::PairwiseAlignmentResult), but the the
implementation of the two others makes sense in the context of their types.
Ideally, I would separate the alignment(::PairwiseAlignmentResult) function
into separate getter functions like
alignment(::PairwiseAlignmentResult)::Alignment and
pairwise_alignment(::PairwiseAlignmentResult)::PairwiseAlignment, but
again, that would be breaking. So instead, settle for a really
dirty-feeling compromise of documenting the difference and explaining the
reasoning behind it with the hope that BioAlignments v4 is able to
reconcile this bandaged solution.
@MillironX MillironX force-pushed the feature/getter-methods branch 2 times, most recently from fb312a5 to 797c566 Compare September 29, 2022 18:17
@codecov
Copy link

codecov bot commented Sep 29, 2022

Codecov Report

Base: 88.50% // Head: 87.60% // Decreases project coverage by -0.90% ⚠️

Coverage data is based on head (fb312a5) compared to base (6d96e79).
Patch coverage: 83.65% of modified lines in pull request are covered.

❗ Current head fb312a5 differs from pull request most recent head 797c566. Consider uploading reports for the commit 797c566 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #83      +/-   ##
==========================================
- Coverage   88.50%   87.60%   -0.91%     
==========================================
  Files          16       16              
  Lines        1114     1138      +24     
==========================================
+ Hits          986      997      +11     
- Misses        128      141      +13     
Impacted Files Coverage Δ
src/pairwise/result.jl 44.00% <0.00%> (-1.84%) ⬇️
src/alignment.jl 80.46% <77.77%> (-4.54%) ⬇️
src/pairwise/alignment.jl 96.58% <80.00%> (-1.77%) ⬇️
src/alignedseq.jl 94.93% <83.33%> (-2.33%) ⬇️
src/anchors.jl 100.00% <100.00%> (ø)
src/operations.jl 87.50% <100.00%> (ø)
src/pairwise/algorithms/common.jl 90.62% <100.00%> (+5.62%) ⬆️
src/pairwise/algorithms/hamming_distance.jl 100.00% <100.00%> (ø)
src/submat.jl 97.67% <0.00%> (-0.78%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MillironX MillironX mentioned this pull request Sep 29, 2022
@MillironX MillironX merged commit 3347748 into BioJulia:master Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant