From 3b08ecf0bf8e5856fd1e1d0e58f7beacff4f9e55 Mon Sep 17 00:00:00 2001 From: Tatiana Gurbich Date: Thu, 15 Aug 2024 12:10:47 +0100 Subject: [PATCH] Added a migration script to add new annotation files --- .../0018_genome_annotations_v2_4_downloads.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 emgapi/migrations/0018_genome_annotations_v2_4_downloads.py diff --git a/emgapi/migrations/0018_genome_annotations_v2_4_downloads.py b/emgapi/migrations/0018_genome_annotations_v2_4_downloads.py new file mode 100644 index 000000000..b605eb8af --- /dev/null +++ b/emgapi/migrations/0018_genome_annotations_v2_4_downloads.py @@ -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, + ), + ]