From d6f2014b2286bbd2e1a237a82b56b96d2ad4c280 Mon Sep 17 00:00:00 2001
From: Tatiana Gurbich <tgurbich@gmail.com>
Date: Thu, 15 Aug 2024 11:38:53 +0100
Subject: [PATCH 1/4] Added new file types

---
 emgapianns/management/commands/import_genomes.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/emgapianns/management/commands/import_genomes.py b/emgapianns/management/commands/import_genomes.py
index 4d82dfa96..2ab815e98 100644
--- a/emgapianns/management/commands/import_genomes.py
+++ b/emgapianns/management/commands/import_genomes.py
@@ -387,6 +387,15 @@ def upload_genome_files(self, genome, directory, has_pangenome):
                                 genome.accession + '_crisprcasfinder.tsv', 'Genome analysis', 'genome', False)
         self.upload_genome_file(genome, directory, 'Genome Mobilome Annotation', 'gff',
                                 genome.accession + '_mobilome.gff', 'Genome analysis', 'genome', False)
+        # pipeline v2.4.0 files (if not empty):
+        self.upload_genome_file(genome, directory, 'Genome dbCAN annotation', 'gff',
+                                genome.accession + '_dbcan.gff', 'Genome analysis', 'genome', False)
+        self.upload_genome_file(genome, directory, 'Genome Defense Finder annotation', 'gff',
+                                genome.accession + '_defense_finder.gff', 'Genome analysis', 'genome', False)
+        self.upload_genome_file(genome, directory, 'Genome GECCO annotation', 'gff',
+                                genome.accession + '_gecco.gff', 'Genome analysis', 'genome', False)
+        self.upload_genome_file(genome, directory, 'KEGG pathway completeness', 'tsv',
+                                genome.accession + '_kegg_pathways.tsv', 'Genome analysis', 'genome', False)
 
         if has_pangenome:
             self.upload_genome_file(genome, directory, 'Pangenome core genes list', 'tab',

From 724059fc71c8d8d1195768a9e591736539d9a73a Mon Sep 17 00:00:00 2001
From: Tatiana Gurbich <tgurbich@gmail.com>
Date: Thu, 15 Aug 2024 12:02:22 +0100
Subject: [PATCH 2/4] Capitalized letters in labels

---
 emgapianns/management/commands/import_genomes.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/emgapianns/management/commands/import_genomes.py b/emgapianns/management/commands/import_genomes.py
index 2ab815e98..15af6f158 100644
--- a/emgapianns/management/commands/import_genomes.py
+++ b/emgapianns/management/commands/import_genomes.py
@@ -388,13 +388,13 @@ def upload_genome_files(self, genome, directory, has_pangenome):
         self.upload_genome_file(genome, directory, 'Genome Mobilome Annotation', 'gff',
                                 genome.accession + '_mobilome.gff', 'Genome analysis', 'genome', False)
         # pipeline v2.4.0 files (if not empty):
-        self.upload_genome_file(genome, directory, 'Genome dbCAN annotation', 'gff',
+        self.upload_genome_file(genome, directory, 'Genome dbCAN Annotation', 'gff',
                                 genome.accession + '_dbcan.gff', 'Genome analysis', 'genome', False)
-        self.upload_genome_file(genome, directory, 'Genome Defense Finder annotation', 'gff',
+        self.upload_genome_file(genome, directory, 'Genome Defense Finder Annotation', 'gff',
                                 genome.accession + '_defense_finder.gff', 'Genome analysis', 'genome', False)
-        self.upload_genome_file(genome, directory, 'Genome GECCO annotation', 'gff',
+        self.upload_genome_file(genome, directory, 'Genome GECCO Annotation', 'gff',
                                 genome.accession + '_gecco.gff', 'Genome analysis', 'genome', False)
-        self.upload_genome_file(genome, directory, 'KEGG pathway completeness', 'tsv',
+        self.upload_genome_file(genome, directory, 'KEGG Pathway Completeness', 'tsv',
                                 genome.accession + '_kegg_pathways.tsv', 'Genome analysis', 'genome', False)
 
         if has_pangenome:

From 3b08ecf0bf8e5856fd1e1d0e58f7beacff4f9e55 Mon Sep 17 00:00:00 2001
From: Tatiana Gurbich <tgurbich@gmail.com>
Date: Thu, 15 Aug 2024 12:10:47 +0100
Subject: [PATCH 3/4] 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,
+        ),
+    ]

From 90b78b496b7c7fdccdbf47e3f02a3fe55e28153d Mon Sep 17 00:00:00 2001
From: Sandy Rogers <sandyr@ebi.ac.uk>
Date: Thu, 15 Aug 2024 12:25:17 +0100
Subject: [PATCH 4/4] adds the new optional genome dl files to webuploader text
 fixture

---
 emgcli/__init__.py                | 2 +-
 pyproject.toml                    | 2 +-
 tests/webuploader/test_genomes.py | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/emgcli/__init__.py b/emgcli/__init__.py
index afd05b54b..6498eceaf 100644
--- a/emgcli/__init__.py
+++ b/emgcli/__init__.py
@@ -1 +1 @@
-__version__: str = "2.4.48"
+__version__: str = "2.4.49"
diff --git a/pyproject.toml b/pyproject.toml
index f0c7ca7d4..9e45f9243 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -117,7 +117,7 @@ max-line-length = 119
 """
 
 [tool.bumpversion]
-current_version = "2.4.48"
+current_version = "2.4.49"
 
 [[tool.bumpversion.files]]
 filename = "emgcli/__init__.py"
diff --git a/tests/webuploader/test_genomes.py b/tests/webuploader/test_genomes.py
index 46119ea6b..0227a071c 100644
--- a/tests/webuploader/test_genomes.py
+++ b/tests/webuploader/test_genomes.py
@@ -65,6 +65,10 @@ def _setup(self):
             ("Additional data for CRISPRCasFinder records reported in the CRISPRCasFinder GFF", "Genome CRISPRCasFinder Additional Records"),
             ("Annotated viral sequence and mobile elements", "Genome Mobilome Annotation"),
             ("List of genes in the pan-genome with their annotation and MGYG accessions.", "Gene Presence / Absence list"),
+            ("CAZy and putative polysaccharide utilization loci annotations produced by dbCAN", "Genome dbCAN Annotation"),
+            ("Anti-phage defence system annotations produced by Defense Finder", "Genome Defense Finder Annotation"),
+            ("BGC annotations produced by GECCO", "Genome GECCO Annotation"),
+            ("Completeness of identified KEGG pathways", "KEGG Pathway Completeness"),
         )
         for d in downloads:
             emg_models.DownloadDescriptionLabel.objects.get_or_create(