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, + ), + ] diff --git a/emgapianns/management/commands/import_genomes.py b/emgapianns/management/commands/import_genomes.py index 4d82dfa96..15af6f158 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', 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(