BioAlignments.jl icon indicating copy to clipboard operation
BioAlignments.jl copied to clipboard

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

Open MillironX opened this issue 1 year ago • 0 comments

Types of changes

This PR implements the following changes:

  • [x] :sparkles: New feature (A non-breaking change which adds functionality).
  • [ ] :bug: Bug fix (A non-breaking change, which fixes an issue).
  • [ ] :boom: Breaking change (fix or feature that would cause existing functionality to change).

:clipboard: Additional detail

The idea for these getter functions first came up in the discussion at https://github.com/BioJulia/BioAlignments.jl/discussions/80#discussioncomment-2959292. 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.

:ballot_box_with_check: Checklist

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

MillironX avatar Jul 26 '22 22:07 MillironX