BioJulia / FASTX.jl

Parse and process FASTA and FASTQ formatted files of biological sequences.
https://biojulia.dev
MIT License
61 stars 20 forks source link

Implement generic methods for commonly used functions and export them #11

Closed harryscholes closed 4 years ago

harryscholes commented 5 years ago

Types of changes

This PR implements the following changes: (Please tick any or all of the following that are applicable)

:clipboard: Additional detail

FASTA.identifier(record)
FASTA.description(record
FASTA.sequence(record)

which is a bit annoying. Not massively annoying, but a bit annoying.

Also, due to lovely stuff like multiple dispatch, it feels more Julian to use generic methods that are not hidden in a namespace. This will allow cleaner code and more consistent APIs.

The same could be done for lots of other functions that are common to the FASTA and FASTQ modules. I just started with these as a proof of concept. Would be keen to hear people's thoughts on this!

record = FASTA.Record("abc", "def", "ACGT") identifier(record) description(record) sequence(record)

record = FASTQ.Record("abc", "def", "ACGT", collect("JJJJ")) identifier(record) description(record) sequence(record) quality(record)



- If you have changed current behaviour...
  - **Describe the behaviour prior to you changes**
These methods had to be accessed from the `FASTA` and `FASTQ` namespaces.

  - **Describe the behaviour after your changes** and justify why you have made the changes,
    Please describe any breakages you anticipate as a result of these changes.
The methods are now exported by `FASTX`. No breaking changes.

  - **Does your change alter APIs or existing exposed methods/types?**
    If so, this may cause dependency issues and breakages, so the maintainer
    will need to consider this when versioning the next release.
Sort of, but it won't break anything.

## :ballot_box_with_check: Checklist

- [x] :art: The changes implemented is consistent with the [julia style guide](https://docs.julialang.org/en/stable/manual/style-guide/).
- [ ] :blue_book: I have updated and added relevant docstrings, in a manner consistent with the [documentation styleguide](https://docs.julialang.org/en/stable/manual/documentation/).
- [ ] :blue_book: I have added or updated relevant user and developer manuals/documentation in `docs/src/`.
- [ ] :ok: There are unit tests that cover the code changes I have made.
- [ ] :ok: The unit tests cover my code changes AND they pass.
- [ ] :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.
- [ ] :thought_balloon: I have commented liberally for any complex pieces of internal code.
harryscholes commented 5 years ago

I just removed the generic method for quality because only FASTQ defines it.

codecov[bot] commented 5 years ago

Codecov Report

Merging #11 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #11   +/-   ##
=======================================
  Coverage   88.76%   88.76%           
=======================================
  Files          13       13           
  Lines         445      445           
=======================================
  Hits          395      395           
  Misses         50       50
Impacted Files Coverage Δ
src/fasta/fasta.jl 100% <ø> (ø) :arrow_up:
src/fastq/fastq.jl 100% <ø> (ø) :arrow_up:
src/FASTX.jl 100% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fd09319...15fa8f6. Read the comment docs.