Skip to content

Commit

Permalink
Merge pull request #369 from EBI-Metagenomics/Feature/Agnostic-Ro-Cra…
Browse files Browse the repository at this point in the history
…te-Accessions

Adjusted run annotations import script to be accession agnostic
  • Loading branch information
MGS-sails authored Oct 28, 2024
2 parents 4a62ddd + ba34640 commit 109ff60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions emgapianns/management/commands/import_extra_run_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.core.management import BaseCommand

logger = logging.getLogger(__name__)

import re

class Command(BaseCommand):
help = "Imports a directory of GFFs that as 'extra run annotations', " \
Expand Down Expand Up @@ -61,15 +61,15 @@ def handle(self, *args, **options):
logger.info('Looking for RO Crates (.zips')
for file in Path(self.gffs_dir).glob('**/*.zip'):
logger.info(f'Handling RO Crate Zip file {file}')
# erz = 'ERZ' + file.name.split('ERZ')[1].strip('.zip')
logger.info('this is the FILE NAME ' + file.name)
srr = 'SRR' + file.name.split('SRR')[1].strip('.zip')
accession_prefix = re.search(r'[A-Z]{3}\d+', file.name)
accession_prefix = accession_prefix.group().strip()
try:
run = emg_models.Run.objects.get(accession=srr)
run = emg_models.Run.objects.get(accession=accession_prefix)
except emg_models.Run.DoesNotExist:
logger.warning(f'No Run found for RO Crate apparent ERZ {srr}')
logger.warning(f'No Run found for RO Crate {accession_prefix}')
continue
logger.info(f'Will upload RO Crate for {srr}')
logger.info(f'Will upload RO Crate for {accession_prefix}')
self.upload_rocrate(run, gffs_directory, file.name)

def upload_rocrate(
Expand Down

0 comments on commit 109ff60

Please sign in to comment.