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

avoid exceptions when a non-existing gene is requested #558

Merged
merged 1 commit into from
May 17, 2019

Conversation

talavis
Copy link
Contributor

@talavis talavis commented May 13, 2019

Describe the pull request:

  • Bug fix
  • Functional change
  • New feature
  • Code cleanup
  • Build system change
  • Documentation change
  • Language translation

Pull request long description:

Handle a couple of situations where a non-existing gene is requested.

variants = list(map(format_variant, variants))
if variants:
for variant in variants:
if datatype in ('gene', 'transcript'):
Copy link
Member

Choose a reason for hiding this comment

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

I know this is not what was focused on in the PR, but this if statement seems superflous to me. Wouldn't it be better with this approximate structure:

anno = None
if datatype == 'transcript':
    # ...
elif datatype == 'gene':
    # ...
if anno:
    variant['vep_annotations'] = anno

This code is too complex in general, it needs to be simplified somehow but I don't know quite how at the moment. Maybe a solution is to have different classes for gene, region and transcript and dispatch based on that. Not now though.

@viklund viklund merged commit 80a7d65 into develop May 17, 2019
@viklund viklund deleted the bugfix/gene-exception branch May 17, 2019 11:39
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.

2 participants