Skip to content

Commit

Permalink
Add variations models
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Apr 2, 2024
1 parent ce65d4e commit 2f149a3
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 7 deletions.
14 changes: 7 additions & 7 deletions resolwe_bio/variants/apps.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
""".. Ignore pydocstyle D400.
================================
Mutations Base App Configuration
================================
===============================
Variants Base App Configuration
===============================
"""
from django.apps import AppConfig


class MutationsConfig(AppConfig):
class VariantsConfig(AppConfig):
"""App configuration."""

name = "resolwe_bio.mutations"
label = "resolwe_bio_mutations"
verbose_name = "Resolwe Bioinformatics Mutations Base"
name = "resolwe_bio.variants"
label = "resolwe_bio_variants"
verbose_name = "Resolwe Bioinformatics Variants Base"
192 changes: 192 additions & 0 deletions resolwe_bio/variants/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# Generated by Django 4.2.11 on 2024-03-25 10:07

from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("flow", "0021_annotationvalue_modified"),
]

operations = [
migrations.CreateModel(
name="Variant",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("species", models.CharField(max_length=50)),
("genome_assembly", models.CharField(max_length=20)),
("chromosome", models.CharField(max_length=20)),
("position", models.PositiveBigIntegerField()),
("reference", models.CharField(max_length=100)),
("alternative", models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name="VariantExperiment",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("variant_data_source", models.CharField(max_length=100)),
("date", models.DateTimeField(auto_now_add=True, db_index=True)),
(
"contributor",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name="VariantCall",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("quality", models.FloatField()),
("depth", models.PositiveIntegerField()),
("filter", models.CharField(max_length=20)),
("genotype", models.CharField(blank=True, max_length=100, null=True)),
(
"data",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="variant_calls",
to="flow.data",
),
),
(
"experiment",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="variant_calls",
to="resolwe_bio_variants.variantexperiment",
),
),
(
"sample",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="variant_calls",
to="flow.entity",
),
),
(
"variant",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="variant_calls",
to="resolwe_bio_variants.variant",
),
),
],
),
migrations.CreateModel(
name="VariantAnnotation",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("type", models.CharField(blank=True, max_length=100, null=True)),
("annotation", models.CharField(max_length=200)),
("annotation_impact", models.CharField(max_length=20)),
("gene", models.CharField(max_length=100)),
("protein_impact", models.CharField(max_length=100)),
(
"feature_id",
django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=200),
default=list,
size=None,
),
),
(
"clinical_diagnosis",
models.CharField(blank=True, max_length=200, null=True),
),
(
"clinical_significance",
models.CharField(blank=True, max_length=100, null=True),
),
("dbsnp_id", models.CharField(blank=True, max_length=20, null=True)),
(
"clinical_var_id",
models.CharField(blank=True, max_length=20, null=True),
),
(
"data",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="variant_annotations",
to="flow.data",
),
),
(
"variant",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="annotation",
to="resolwe_bio_variants.variant",
),
),
],
),
migrations.AddConstraint(
model_name="variant",
constraint=models.UniqueConstraint(
fields=(
"species",
"genome_assembly",
"chromosome",
"position",
"reference",
"alternative",
),
name="uniq_composite_key_variants",
),
),
]
Empty file.

0 comments on commit 2f149a3

Please sign in to comment.