Skip to content

Commit

Permalink
Added a migration script to add new annotation files
Browse files Browse the repository at this point in the history
  • Loading branch information
tgurbich committed Aug 15, 2024
1 parent 724059f commit 3b08ecf
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions emgapi/migrations/0018_genome_annotations_v2_4_downloads.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Generated by Django 3.2.12 on 2024-08-15 00:00

from django.db import migrations


def create_v2_4_genome_download_description(apps, schema_editor):
DownloadDescriptionLabel = apps.get_model("emgapi", "DownloadDescriptionLabel")

DownloadDescriptionLabel.objects.create(
description="CAZy and putative polysaccharide utilization loci annotations produced by dbCAN",
description_label="Genome dbCAN Annotation"
)
DownloadDescriptionLabel.objects.create(
description="Anti-phage defence system annotations produced by Defense Finder",
description_label="Genome Defense Finder Annotation"
)
DownloadDescriptionLabel.objects.create(
description="BGC annotations produced by GECCO",
description_label="Genome GECCO Annotation"
)
DownloadDescriptionLabel.objects.create(
description="Completeness of identified KEGG pathways",
description_label="KEGG Pathway Completeness"
)


def remove_v2_4_genome_download_description(apps, schema_editor):
DownloadDescriptionLabel = apps.get_model("emgapi", "DownloadDescriptionLabel")
DownloadDescriptionLabel.objects.filter(description_label__in=[
"Genome dbCAN Annotation",
"Genome Defense Finder Annotation",
"Genome GECCO Annotation",
"KEGG Pathway Completeness",
]).delete()


class Migration(migrations.Migration):

dependencies = [
('emgapi', '0017_auto_20240129_1401'),
]

operations = [
migrations.RunPython(
code=create_v2_4_genome_download_description,
reverse_code=remove_v2_4_genome_download_description,
),
]

0 comments on commit 3b08ecf

Please sign in to comment.