Skip to content

Commit

Permalink
issue #1090 VEP minor release changes (git hash) cause VEPVersionMism…
Browse files Browse the repository at this point in the history
…atchError
  • Loading branch information
davmlaw committed Jul 8, 2024
1 parent d800895 commit 7e2ca32
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
26 changes: 26 additions & 0 deletions annotation/migrations/0108_one_off_vep_version_major_only.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.10 on 2024-07-08 03:35

from django.db import migrations


def _major_version(version_str) -> str:
return version_str.split(".")[0]


def _one_off_vep_version_major_only(apps, schema_editor):
VariantAnnotationVersion = apps.get_model('annotation', 'VariantAnnotationVersion')

for vav in VariantAnnotationVersion.objects.all():
vav.ensembl = _major_version(vav.ensembl)
vav.ensembl_io = _major_version(vav.ensembl_io)
vav.save()


class Migration(migrations.Migration):
dependencies = [
('annotation', '0107_one_off_change_hgvs_g_too_long_message'),
]

operations = [
migrations.RunPython(_one_off_vep_version_major_only)
]
12 changes: 10 additions & 2 deletions annotation/vep_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,22 @@ def get_vep_version(genome_build: GenomeBuild, annotation_consortium):


def vep_dict_to_variant_annotation_version_kwargs(vep_config, vep_version_dict: dict) -> dict:
def vep_int_version(vep_string_version):
def _vep_int_version(vep_string_version):
m = re.match(r"v(\d+)", vep_string_version)
return int(m.group(1))

# We strip off the hash ie '110.73b02d8' -> '110' so that we can re-use annotation
# if VEP do a minor bugfix change to their releases etc
def _major_version(version_str) -> str:
return version_str.split(".")[0]


FIELD_CONVERSION = {
"vep": vep_int_version,
"vep": _vep_int_version,
"cosmic": int,
"dbsnp": int,
"ensembl": _major_version,
"ensembl_io": _major_version,
}

FIELD_LOOKUP = {
Expand Down

0 comments on commit 7e2ca32

Please sign in to comment.