Skip to content
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

Addresses part of issue #18, Allele class refactoring. #1370

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vruano
Copy link
Contributor

@vruano vruano commented May 18, 2019

More concretely it refactor the Allele class:

  • Is now an interface.
  • Added several methods to access properties from several allele types like breakends and whole contig insertions.
  • Disentangles the current mixture of "display" bytes vs base bytes in the bases array... now only base are stored like that if it applies.
  • Adds a "hidden" hierarchy of implementations for different allele subtypes.
  • Improves reusing instances for common variants (single base and common symbolic alleles)
  • Mark as deprecated several method that seem unnecessary.
  • Disable the possibility of changing an allele bases and adds an API (BaseSequence interface) to access these efficiently
    wihtout the need of cloning a byte[] array each time.
  • Makes impossible to create alleles that have invalid base (IUPAC codes that are not allowed by the VCF spec).
  • Fixes (and also deprecates) some not well-though Allele method that only make sense for some subtypes of alleles.
  • Breakend API, access to contig, position type of breakend and base.

Description

Please explain the changes you made here.
Explain the motivation for making this change. What existing problem does the pull request solve?

Checklist

  • Code compiles correctly
  • New tests covering changes and new functionality
  • All tests passing
  • Extended the README / documentation, if necessary
  • Is not backward compatible (breaks binary or source compatibility)

More concretely it refactor the Allele class:

* Is now and interface.
* Added several methods to access properties from several allele types like breakends and whole contig insertions.
* Disentagles the current mixture of "display" bytes vs base bytes in the bases array... now only base are stored like that if it applies.
* Adds a "hidden" heriarchy of implementations for different allele subtypes.
* Improves reusing instances for common variants (single base and common symbolic alleles)
* Mark as deprecated several method that seem unecessary.
* Disable the possibility of changing an allele bases and adds an API (BaseSequence interface) to access these efficiently
  wihtout the need of clonning a byte[] array each time.
* Makes impossible to create alleles that have invalid base (IUPAC codes that are not allowed by the VCF spec).
* Fixes (and also deprecates) some not well-though Allele method that only make sense for some subtypes of alleles.
* Breakend API, access to contig, position type of breakend and base.
@vruano vruano changed the title Addresses part of issue #18. Addresses part of issue #18, Allele class refactoring. May 18, 2019
@vruano
Copy link
Contributor Author

vruano commented May 18, 2019

Allele.java diffs rather messy perhaps reviewers should consider to assess it on the changed version of the file and go back to the github diff just report what they don't like.

@vruano
Copy link
Contributor Author

vruano commented May 18, 2019

Current test pass but need to add new ones, please review in the meantime.

@vruano vruano requested a review from droazen May 18, 2019 04:25
@vruano
Copy link
Contributor Author

vruano commented May 20, 2019

I'm adding test code and fixing issues in the code as I come across them, you can start reviewing the first commit only for stability.

/**
* Enumeration of possible allele types/categories.
*/
public enum AlleleType {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups this class is actually not in use. I forgot to delete it I guess. Is not much point to it as 99.9% of the time code only know how to deal with one type so call to the corresponding isBlahBlah() method is sufficient. You can ignore this class in your review(s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Large 🐋 Waiting for Review This PR is waiting for a reviewer to respond
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants