diff --git a/Dockerfile b/Dockerfile index 924a5c6a9c40239fd653269fbdc6594dee2a4abb..e68733eff5fde8d5b355f5d122068f41aa0b61e1 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM andimajore/miniconda3_kinetic +FROM andimajore/miniconda3_lunar WORKDIR /usr/src/drugstone/ diff --git a/drugstone/management/commands/import_from_nedrex.py b/drugstone/management/commands/import_from_nedrex.py index dd8a434264392a77306afa48bb1b282af9cea010..472bca8b1854f4e16d7d71d54e4088fbe7c1fdf3 100644 --- a/drugstone/management/commands/import_from_nedrex.py +++ b/drugstone/management/commands/import_from_nedrex.py @@ -116,10 +116,13 @@ class NedrexImporter: proteins[id] = models.Protein(uniprot_code=id, protein_name=name, gene=gene) def add_edges(edge): - id = to_id(edge['sourceDomainId']) - protein = proteins[id] - protein.entrez = to_id(edge['targetDomainId']) - gene_to_prots[protein.entrez].add(id) + try: + id = to_id(edge['sourceDomainId']) + protein = proteins[id] + protein.entrez = to_id(edge['targetDomainId']) + gene_to_prots[protein.entrez].add(id) + except: + print(f'Edge could not be saved: {edge["sourceDomainId"]} - {edge["targetDomainId"]}') def add_genes(node): id = to_id(node['primaryDomainId']) diff --git a/drugstone/management/commands/populate_db.py b/drugstone/management/commands/populate_db.py index 5bc37ed7e45baa944bfe1542aa0f9040c3fd4915..0c2ec7510bda16357ec082c0e15aa40d0bc82bdb 100755 --- a/drugstone/management/commands/populate_db.py +++ b/drugstone/management/commands/populate_db.py @@ -118,6 +118,7 @@ def populate(kwargs): total_n = 0 nedrex_update = False + if 'all' in kwargs and kwargs['all']: kwargs['drugs'] = True kwargs['disorders'] = True diff --git a/drugstone/management/includes/DataPopulator.py b/drugstone/management/includes/DataPopulator.py index 01715b4b7fd52ad7590de90f28e54e3f2ab44390..4a4a570b230ee4b7e1067dc1b7332049daec152d 100755 --- a/drugstone/management/includes/DataPopulator.py +++ b/drugstone/management/includes/DataPopulator.py @@ -22,6 +22,9 @@ class DataPopulator: bulk = set() uniq = set() + if update: + uniq = {hash(expr) for expr in models.ExpressionLevel.objects.all()} + size = 0 for _, row in df.iterrows(): gene_name = row['Description'] diff --git a/drugstone/settings/celery_schedule.py b/drugstone/settings/celery_schedule.py index 6c068944fe4b6bf516a180d5677b32c2ff0d7250..0e52106d458a271b2a3c889f6c6ea3b86d632bec 100644 --- a/drugstone/settings/celery_schedule.py +++ b/drugstone/settings/celery_schedule.py @@ -3,7 +3,7 @@ from celery.schedules import crontab CELERY_BEAT_SCHEDULE = { 'update_db': { 'task': 'drugstone.tasks.task_update_db_from_nedrex', - 'schedule': crontab(day_of_week=2, hour=3, minute=0), + 'schedule': crontab(day_of_week=1, hour=22, minute=0), # 'schedule': crontab(minute='*/1'), }, } diff --git a/requirements.txt b/requirements.txt index 499918e26a46bf66835ed4667503036bfe5c2a35..eafb7efdd78dc9af8592c8554b277b10cfc08b92 100755 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ chardet==3.0.4 click==8.1.3 cryptography==39.0.1 decorator==4.4.2 -Django==3.2.17 +Django==3.2.18 django-cors-headers==3.4.0 django-redis==4.11.0 django-rq-dashboard==0.3.3