0068_auto_20210310_1052.py 1.78 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
# Generated by Django 2.2.1 on 2021-03-10 10:52

from django.db import migrations, models


def init_isolevel(apps, schema_editor):
    Chain = apps.get_model("ippidb", "Chain")
    InteractFile = apps.get_model("ippidb", "InteractFile")
    Chains = Chain.objects.all()
    if Chains:
11
12
        Chain.update(default_isolevel=0.5)
    InteractFiles = InteractFile.objects.filter(label="all")
13
    if InteractFiles:
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
        InteractFiles.update(default_isolevel=0.7)
    InteractFiles = InteractFile.objects.filter(label="hydrophobic")
    if InteractFiles:
        InteractFiles.update(default_isolevel=0.3)
    InteractFiles = InteractFile.objects.filter(label="hbond donor-acceptor")
    if InteractFiles:
        InteractFiles.update(default_isolevel=0.3)
    InteractFiles = InteractFile.objects.filter(label="negative")
    if InteractFiles:
        InteractFiles.update(default_isolevel=0.08)
    InteractFiles = InteractFile.objects.filter(label="positive")
    if InteractFiles:
        InteractFiles.update(default_isolevel=0.05)
    InteractFiles = InteractFile.objects.filter(label="backbone")
    if InteractFiles:
        InteractFiles.update(default_isolevel=0.18)
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50


class Migration(migrations.Migration):

    dependencies = [
        ("ippidb", "0067_metainformation_normalize_factor"),
    ]

    operations = [
        migrations.AddField(
            model_name="chain",
            name="default_isolevel",
            field=models.FloatField(default=0.7, verbose_name="Default isolevel value"),
        ),
        migrations.AddField(
            model_name="interactfile",
            name="default_isolevel",
            field=models.FloatField(default=0.7, verbose_name="Default isolevel value"),
        ),
        migrations.RunPython(init_isolevel, reverse_code=migrations.RunPython.noop),
    ]