Skip to content

Commit

Permalink
Merge 3ae12b5 into 2e34f88
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Apr 1, 2021
2 parents 2e34f88 + 3ae12b5 commit 3b25ebb
Show file tree
Hide file tree
Showing 22 changed files with 637 additions and 14 deletions.
10 changes: 7 additions & 3 deletions HISTORY.rst
Expand Up @@ -2,9 +2,9 @@
History / Changelog
===================

-----------------
HEAD (unreleased)
-----------------
-------
v0.23.0
-------

End-User Summary
================
Expand All @@ -30,6 +30,8 @@ End-User Summary
- Rebuild of variant summary database table happens every Sunday at 2:22am.
- Added celery queues ``maintenance`` and ``export``.
- Adding support for connecting two sites via the GAGH Beacon protocol.
- Adding link-out to "GenCC".
- Adding "submit to SPANR" feature.

Full Change List
================
Expand Down Expand Up @@ -58,6 +60,8 @@ Full Change List
- Added celery queues ``maintenance`` and ``export``.
- Adding support for connecting two sites via the GAGH Beacon protocol.
- Making CADD version behind CADD REST API configurable.
- Adding link-out to "GenCC".
- Adding "submit to SPANR" feature.

-------
v0.22.1
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Expand Up @@ -5,6 +5,10 @@ MANAGE = time python manage.py
black:
black -l 100 --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.?v?env|_build|buck-out|build|dist|src)/' $(arg) .

.PHONY: npm-install
npm-install:
cd varfish/vueapp && npm ci

.PHONY: serve
serve:
$(MANAGE) runserver
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -70,5 +70,5 @@ VarFish Data Release Compatibility Table
===================== ============ ==============
VarFish DB Downloader Data Release VarFish Server
===================== ============ ==============
v0.2 20201006 <= v0.22.1
v0.2 20201006 <= v0.23
===================== ============ ==============
3 changes: 3 additions & 0 deletions config/settings/base.py
Expand Up @@ -487,6 +487,9 @@ def fixed_array_type(field):
VARFISH_MUTATIONTASTER_BATCH_VARS = env.int("VARFISH_MUTATIONTASTER_BATCH_VARS", 50)
VARFISH_MUTATIONTASTER_MAX_VARS = env.int("VARFISH_MUTATIONTASTER_MAX_VARS", 500)

# VarfFish: Enable SPANR
VARFISH_ENABLE_SPANR_SUBMISSION = env.bool("VARFISH_ENABLE_SPANR_SUBMISSION", False)

# Varfish: UMD URL
VARFISH_UMD_REST_API_URL = env.str(
"VARFISH_UMD_REST_API_URL", "http://umd-predictor.eu/webservice.php"
Expand Down
14 changes: 5 additions & 9 deletions docs_manual/admin_upgrade.rst
Expand Up @@ -6,20 +6,16 @@ Upgrade Varfish Installation

This section contains upgrade instructions for upgrading your VarFish Server installation using `VarFish Docker Compose <https://github.com/bihealth/varfish-docker-compose>`__.

-------------------------------------
v0.22.1 to v0.23.0 (work in progress)
-------------------------------------

.. warning::

Version v0.23.0 has not been released yet.
We can only provide support once v0.23.0 has been officially released.
------------------
v0.22.1 to v0.23.0
------------------

**Summary**

- The Docker Compose installer now provides support for setting up CADD score annotation via `cadd-rest-api <https://github.com/bihealth/cadd-rest-api>`__.
- The environment variable ``FIELD_ENCRYPTION_KEY`` **should** be setup properly.
- The environment variable ``FIELD_ENCRYPTION_KEY`` **should** be setup properly by the user.
- Two new celery queues are needed: ``maintenance`` and ``export``.
- To enable the new and optional feature for uploading variants to SPANR you have to set the environment variable ``VARFISH_ENABLE_SPANR_SUBMISSION`` to ``1``.

Detailed Instructions
=====================
Expand Down
7 changes: 7 additions & 0 deletions docs_manual/variants_filtration.rst
Expand Up @@ -324,6 +324,13 @@ Here are the actions to create the recommended settings for submitting to Mutati
The MutationDistiller submission uses the same feature as th VarFish VCF export.
Thus, the limitations described in :ref:`download-as-file` apply.

Submit to SPANR
---------------

Also, the little triangle next to the :guilabel:`Filter & Display` gives you access to the :guilabel:`Submit to SPANR` action.
This is similar to submitting ot MutationDistiller described above.
Clicking the button will submit the data to SPANR after confirming this once again in popup window.

--------------------------
Variant Filtration Results
--------------------------
Expand Down
2 changes: 2 additions & 0 deletions variants/admin.py
Expand Up @@ -16,6 +16,7 @@
SyncCaseResultMessage,
ImportVariantsBgJob,
SmallVariantSet,
SpanrSubmissionBgJob,
CasePhenotypeTerms,
)

Expand All @@ -37,6 +38,7 @@
SyncCaseResultMessage,
ImportVariantsBgJob,
SmallVariantSet,
SpanrSubmissionBgJob,
CasePhenotypeTerms,
)
)
1 change: 1 addition & 0 deletions variants/file_export.py
Expand Up @@ -437,6 +437,7 @@ def write_tmp_file(self):
self._write_variants()
self._write_trailing()
#: Rewind temporary file to beginning and return it.
self.tmp_file.flush()
self.tmp_file.seek(0)
return self.tmp_file

Expand Down
1 change: 1 addition & 0 deletions variants/forms.py
Expand Up @@ -1375,6 +1375,7 @@ class FilterForm(
("download", "Generate downloadable file in background"),
("submit-mutationdistiller", "Submit to MutationDistiller"),
("submit-cadd", "Submit to CADD"),
("submit-spanr", "Submit to SPANR"),
)
)

Expand Down
72 changes: 72 additions & 0 deletions variants/migrations/0080_spanrsubmissionbgjob.py
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-04-01 08:45
from __future__ import unicode_literals
import uuid

import bgjobs.models
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("projectroles", "0015_fix_appsetting_constraint"),
("bgjobs", "0006_auto_20200526_1657"),
("variants", "0079_auto_20210204_1006"),
]

operations = [
migrations.CreateModel(
name="SpanrSubmissionBgJob",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
(
"sodar_uuid",
models.UUIDField(default=uuid.uuid4, help_text="Case SODAR UUID", unique=True),
),
(
"query_args",
django.contrib.postgres.fields.jsonb.JSONField(
help_text="(Validated) query parameters"
),
),
(
"spanr_job_url",
models.CharField(help_text="The SPANR job URL", max_length=100, null=True),
),
(
"bg_job",
models.ForeignKey(
help_text="Background job for state etc.",
on_delete=django.db.models.deletion.CASCADE,
related_name="spanr_submission_bg_job",
to="bgjobs.BackgroundJob",
),
),
(
"case",
models.ForeignKey(
help_text="The case to export",
on_delete=django.db.models.deletion.CASCADE,
to="variants.Case",
),
),
(
"project",
models.ForeignKey(
help_text="Project in which this objects belongs",
on_delete=django.db.models.deletion.CASCADE,
to="projectroles.Project",
),
),
],
bases=(bgjobs.models.JobModelMessageMixin, models.Model),
),
]
38 changes: 38 additions & 0 deletions variants/models.py
Expand Up @@ -612,6 +612,7 @@ def get_background_jobs(self):
Q(variants_exportfilebgjob_related__case=self)
| Q(cadd_submission_bg_job__case=self)
| Q(distiller_submission_bg_job__case=self)
| Q(spanr_submission_bg_job__case=self)
| Q(filter_bg_job__case=self)
)

Expand Down Expand Up @@ -1228,6 +1229,43 @@ def get_absolute_url(self):
)


class SpanrSubmissionBgJob(JobModelMessageMixin, models.Model):
"""Background job for submitting variants to SPANR."""

#: Task description for logging.
task_desc = "Submission to SPANR"

#: String identifying model in BackgroundJob.
spec_name = "variants.spanr_submission_bg_job"

# Fields required by SODAR
sodar_uuid = models.UUIDField(
default=uuid_object.uuid4, unique=True, help_text="Case SODAR UUID"
)
project = models.ForeignKey(Project, help_text="Project in which this objects belongs")

bg_job = models.ForeignKey(
BackgroundJob,
null=False,
related_name="spanr_submission_bg_job",
help_text="Background job for state etc.",
on_delete=models.CASCADE,
)
case = models.ForeignKey(Case, null=False, help_text="The case to export")
query_args = JSONField(null=False, help_text="(Validated) query parameters")

spanr_job_url = models.CharField(max_length=100, null=True, help_text="The SPANR job URL")

def get_human_readable_type(self):
return "SPANR Submission"

def get_absolute_url(self):
return reverse(
"variants:spanr-job-detail",
kwargs={"project": self.project.sodar_uuid, "job": self.sodar_uuid},
)


class SmallVariantComment(models.Model):
"""Model for commenting on a ``SmallVariant``."""

Expand Down
2 changes: 2 additions & 0 deletions variants/plugins.py
Expand Up @@ -12,6 +12,7 @@
ExportFileBgJob,
ExportProjectCasesFileBgJob,
CaddSubmissionBgJob,
SpanrSubmissionBgJob,
DistillerSubmissionBgJob,
ComputeProjectVariantsStatsBgJob,
FilterBgJob,
Expand Down Expand Up @@ -280,6 +281,7 @@ class BackgroundJobsPlugin(BackgroundJobsPluginPoint):
job_specs = {
ExportFileBgJob.spec_name: ExportFileBgJob,
CaddSubmissionBgJob.spec_name: CaddSubmissionBgJob,
SpanrSubmissionBgJob.spec_name: SpanrSubmissionBgJob,
DistillerSubmissionBgJob.spec_name: DistillerSubmissionBgJob,
ComputeProjectVariantsStatsBgJob.spec_name: ComputeProjectVariantsStatsBgJob,
ExportProjectCasesFileBgJob.spec_name: ExportProjectCasesFileBgJob,
Expand Down
4 changes: 4 additions & 0 deletions variants/queries.py
Expand Up @@ -223,6 +223,8 @@ def __init__(self, *args, **kwargs):
func.max(Hgnc.sa.gene_family).label("gene_family"),
func.max(Hgnc.sa.pubmed_id).label("pubmed_id"),
func.max(Hgnc.sa.ucsc_id_novers).label("ucsc_id_novers"),
func.max(Hgnc.sa.hgnc_id).label("hgnc_id"),
func.max(Hgnc.sa.uniprot_ids).label("uniprot_ids"),
]
)
.select_from(Hgnc.sa)
Expand All @@ -242,6 +244,8 @@ def extend_fields(self, _query_parts):
func.coalesce(self.subquery_hgnc.c.name, "").label("gene_name"),
func.coalesce(self.subquery_hgnc.c.gene_family, "").label("gene_family"),
func.coalesce(self.subquery_hgnc.c.pubmed_id, "").label("pubmed_id"),
func.coalesce(self.subquery_hgnc.c.hgnc_id, "").label("hgnc_id"),
func.coalesce(self.subquery_hgnc.c.uniprot_ids, "").label("uniprot_ids"),
]


Expand Down

0 comments on commit 3b25ebb

Please sign in to comment.