From 093107d074d066843897bdfdf29bf62c2f08f05a Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Thu, 24 Jul 2014 13:56:08 -0700 Subject: [PATCH] Flatten project hierarchy, moving djano applications out of htsworkflow.frontend into project root. Unsuprisingly this also required updates to large chunks of code to change the import paths for things. I was motivated by the idea of trying to make my django applications more portable. I tried some hacks with the python path to make it so they could live in htsworkflow.appname, but django 1.7 seemed to want the app to have only one import path, and this was the easiest way I could see to solve that. --- .../frontend/bcmagic => bcmagic}/__init__.py | 0 .../frontend/bcmagic => bcmagic}/admin.py | 2 +- .../fixtures/initial_data.json | 0 .../bcmagic => bcmagic}/fixtures/woldlab.json | 0 .../frontend/bcmagic => bcmagic}/forms.py | 0 .../frontend/bcmagic => bcmagic}/models.py | 0 .../frontend/bcmagic => bcmagic}/plugin.py | 0 bcmagic/urls.py | 7 ++ .../frontend/bcmagic => bcmagic}/utils.py | 0 .../frontend/bcmagic => bcmagic}/views.py | 8 +- .../eland_config => eland_config}/__init__.py | 0 .../eland_config => eland_config}/admin.py | 0 .../eland_config => eland_config}/forms.py | 0 .../eland_config => eland_config}/models.py | 0 .../eland_config => eland_config}/urls.py | 4 +- .../eland_config => eland_config}/views.py | 2 +- .../experiments => experiments}/__init__.py | 0 .../experiments => experiments}/admin.py | 8 +- .../experiments.py | 12 +-- .../fixtures/initial_data.json | 0 .../fixtures/test_flowcells.json | 0 .../fixtures/woldlab.json | 0 .../experiments => experiments}/models.py | 14 +-- .../test_experiments.py | 100 +++++++++--------- experiments/urls.py | 12 +++ .../experiments => experiments}/views.py | 14 +-- htsworkflow/{frontend => }/auth.py | 0 htsworkflow/frontend/bcmagic/urls.py | 7 -- htsworkflow/frontend/experiments/urls.py | 13 --- htsworkflow/frontend/inventory/urls.py | 16 --- htsworkflow/frontend/samples/urls.py | 8 -- htsworkflow/frontend/urls.py | 58 ---------- htsworkflow/pipelines/retrieve_config.py | 2 +- .../pipelines/test/test_retrive_config.py | 2 +- htsworkflow/settings.py | 29 ++--- .../static/css/admin_flowcell.css | 0 htsworkflow/{frontend => }/static/css/app.css | 0 .../{frontend => }/static/css/base.css | 0 .../{frontend => }/static/css/changelists.css | 0 .../{frontend => }/static/css/click-table.css | 0 .../{frontend => }/static/css/dashboard.css | 0 .../static/css/data-browse-index.css | 0 .../{frontend => }/static/css/forms.css | 0 .../{frontend => }/static/css/global.css | 0 .../{frontend => }/static/css/htsw.css | 0 .../{frontend => }/static/css/layout.css | 0 .../{frontend => }/static/css/null.css | 0 .../{frontend => }/static/css/patch-iewin.css | 0 .../static/css/wide_account_number.css | 0 .../static/img/changelist-bg.gif | Bin .../{frontend => }/static/img/default-bg.gif | Bin .../{frontend => }/static/img/dna80.png | Bin .../{frontend => }/static/img/hdd_unmount.png | Bin .../static/img/icon_searchbox.png | Bin .../static/img/layout-browser-hd-bg.gif | Bin .../static/img/nav-bg-reverse.gif | Bin .../{frontend => }/static/img/nav-bg.gif | Bin .../{frontend => }/static/img/readme.txt | 0 htsworkflow/{frontend => }/static/img/s.gif | Bin .../{frontend => }/static/js/bcmagic-ext.js | 0 .../static/js/htsw-inventory.js | 0 htsworkflow/{frontend => }/static/js/htsw.js | 0 .../static/js/jquery.timers-1.0.0.js | 0 .../{frontend => }/static/js/magicbc.js | 0 htsworkflow/{frontend => }/templates/404.html | 0 .../templates/admin/auth/user/add_form.html | 0 .../templates/admin/base_site.html | 0 .../experiments/flowcell/change_form.html | 0 .../{frontend => }/templates/admin/index.html | 0 .../templates/admin/pagination.html | 0 .../{frontend => }/templates/base.html | 0 .../{frontend => }/templates/base_site.html | 0 .../templates/bcmagic/magic.html | 0 .../templates/experiments/detail.html | 0 .../templates/experiments/email_preview.html | 0 .../templates/experiments/flowcellSheet.html | 0 .../experiments/flowcell_detail.html | 0 .../experiments/flowcell_header.html | 0 .../experiments/flowcell_lane_detail.html | 0 .../templates/experiments/index.html | 0 .../templates/experiments/sequencer.html | 0 .../templates/experiments/started_email.html | 0 .../templates/experiments/started_email.txt | 0 .../templates/inventory/default.zpl | 0 .../templates/inventory/hard_drive_shell.zpl | 0 .../inventory/inventory_all_index.html | 0 .../templates/inventory/inventory_index.html | 0 .../inventory/inventory_itemtype_index.html | 0 .../inventory/inventory_summary.html | 2 +- .../templates/registration/login.html | 0 .../templates/registration/profile.html | 0 .../templates/reports/report.html | 0 .../templates/sample_header.html | 0 .../templates/samples/antibody_index.html | 0 .../templates/samples/lanes_for.html | 0 .../templates/samples/library_detail.html | 0 .../templates/samples/library_index.html | 0 .../templates/samples/species_detail.html | 0 .../{frontend => }/templates/search_form.html | 0 htsworkflow/urls.py | 31 ++++++ htsworkflow/util/makebed.py | 2 +- .../inventory => inventory}/__init__.py | 0 .../frontend/inventory => inventory}/admin.py | 4 +- .../inventory => inventory}/bcmagic.py | 4 +- .../fixtures/initial_data.json | 0 .../fixtures/test_harddisks.json | 0 .../fixtures/test_user.json | 0 .../fixtures/woldlab.json | 0 .../inventory => inventory}/models.py | 8 +- .../inventory => inventory}/test_inventory.py | 8 +- inventory/urls.py | 16 +++ .../frontend/inventory => inventory}/views.py | 18 ++-- .../frontend/labels => labels}/__init__.py | 0 .../frontend/labels => labels}/admin.py | 7 +- .../frontend/labels => labels}/models.py | 0 .../frontend/labels => labels}/test_labels.py | 0 .../frontend/labels => labels}/views.py | 0 .../frontend/samples => samples}/__init__.py | 0 .../frontend/samples => samples}/admin.py | 10 +- .../samples => samples}/auth_backend.py | 2 + .../samples => samples}/changelist.py | 2 + .../fixtures/initial_data.json | 0 .../fixtures/test_samples.json | 0 .../frontend/samples => samples}/models.py | 5 +- .../frontend/samples => samples}/results.py | 0 .../samples => samples}/test_samples.py | 14 +-- samples/urls.py | 14 +++ .../frontend/samples => samples}/views.py | 18 ++-- 128 files changed, 239 insertions(+), 244 deletions(-) rename {htsworkflow/frontend/bcmagic => bcmagic}/__init__.py (100%) rename {htsworkflow/frontend/bcmagic => bcmagic}/admin.py (74%) rename {htsworkflow/frontend/bcmagic => bcmagic}/fixtures/initial_data.json (100%) rename {htsworkflow/frontend/bcmagic => bcmagic}/fixtures/woldlab.json (100%) rename {htsworkflow/frontend/bcmagic => bcmagic}/forms.py (100%) rename {htsworkflow/frontend/bcmagic => bcmagic}/models.py (100%) rename {htsworkflow/frontend/bcmagic => bcmagic}/plugin.py (100%) create mode 100644 bcmagic/urls.py rename {htsworkflow/frontend/bcmagic => bcmagic}/utils.py (100%) rename {htsworkflow/frontend/bcmagic => bcmagic}/views.py (94%) rename {htsworkflow/frontend/eland_config => eland_config}/__init__.py (100%) rename {htsworkflow/frontend/eland_config => eland_config}/admin.py (100%) rename {htsworkflow/frontend/eland_config => eland_config}/forms.py (100%) rename {htsworkflow/frontend/eland_config => eland_config}/models.py (100%) rename {htsworkflow/frontend/eland_config => eland_config}/urls.py (50%) rename {htsworkflow/frontend/eland_config => eland_config}/views.py (98%) rename {htsworkflow/frontend/experiments => experiments}/__init__.py (100%) rename {htsworkflow/frontend/experiments => experiments}/admin.py (98%) rename {htsworkflow/frontend/experiments => experiments}/experiments.py (98%) rename {htsworkflow/frontend/experiments => experiments}/fixtures/initial_data.json (100%) rename {htsworkflow/frontend/experiments => experiments}/fixtures/test_flowcells.json (100%) rename {htsworkflow/frontend/experiments => experiments}/fixtures/woldlab.json (100%) rename {htsworkflow/frontend/experiments => experiments}/models.py (97%) rename {htsworkflow/frontend/experiments => experiments}/test_experiments.py (90%) create mode 100644 experiments/urls.py rename {htsworkflow/frontend/experiments => experiments}/views.py (95%) rename htsworkflow/{frontend => }/auth.py (100%) delete mode 100644 htsworkflow/frontend/bcmagic/urls.py delete mode 100644 htsworkflow/frontend/experiments/urls.py delete mode 100644 htsworkflow/frontend/inventory/urls.py delete mode 100644 htsworkflow/frontend/samples/urls.py delete mode 100644 htsworkflow/frontend/urls.py rename htsworkflow/{frontend => }/static/css/admin_flowcell.css (100%) rename htsworkflow/{frontend => }/static/css/app.css (100%) rename htsworkflow/{frontend => }/static/css/base.css (100%) rename htsworkflow/{frontend => }/static/css/changelists.css (100%) rename htsworkflow/{frontend => }/static/css/click-table.css (100%) rename htsworkflow/{frontend => }/static/css/dashboard.css (100%) rename htsworkflow/{frontend => }/static/css/data-browse-index.css (100%) rename htsworkflow/{frontend => }/static/css/forms.css (100%) rename htsworkflow/{frontend => }/static/css/global.css (100%) rename htsworkflow/{frontend => }/static/css/htsw.css (100%) rename htsworkflow/{frontend => }/static/css/layout.css (100%) rename htsworkflow/{frontend => }/static/css/null.css (100%) rename htsworkflow/{frontend => }/static/css/patch-iewin.css (100%) rename htsworkflow/{frontend => }/static/css/wide_account_number.css (100%) rename htsworkflow/{frontend => }/static/img/changelist-bg.gif (100%) rename htsworkflow/{frontend => }/static/img/default-bg.gif (100%) rename htsworkflow/{frontend => }/static/img/dna80.png (100%) rename htsworkflow/{frontend => }/static/img/hdd_unmount.png (100%) rename htsworkflow/{frontend => }/static/img/icon_searchbox.png (100%) rename htsworkflow/{frontend => }/static/img/layout-browser-hd-bg.gif (100%) rename htsworkflow/{frontend => }/static/img/nav-bg-reverse.gif (100%) rename htsworkflow/{frontend => }/static/img/nav-bg.gif (100%) rename htsworkflow/{frontend => }/static/img/readme.txt (100%) rename htsworkflow/{frontend => }/static/img/s.gif (100%) rename htsworkflow/{frontend => }/static/js/bcmagic-ext.js (100%) rename htsworkflow/{frontend => }/static/js/htsw-inventory.js (100%) rename htsworkflow/{frontend => }/static/js/htsw.js (100%) rename htsworkflow/{frontend => }/static/js/jquery.timers-1.0.0.js (100%) rename htsworkflow/{frontend => }/static/js/magicbc.js (100%) rename htsworkflow/{frontend => }/templates/404.html (100%) rename htsworkflow/{frontend => }/templates/admin/auth/user/add_form.html (100%) rename htsworkflow/{frontend => }/templates/admin/base_site.html (100%) rename htsworkflow/{frontend => }/templates/admin/experiments/flowcell/change_form.html (100%) rename htsworkflow/{frontend => }/templates/admin/index.html (100%) rename htsworkflow/{frontend => }/templates/admin/pagination.html (100%) rename htsworkflow/{frontend => }/templates/base.html (100%) rename htsworkflow/{frontend => }/templates/base_site.html (100%) rename htsworkflow/{frontend => }/templates/bcmagic/magic.html (100%) rename htsworkflow/{frontend => }/templates/experiments/detail.html (100%) rename htsworkflow/{frontend => }/templates/experiments/email_preview.html (100%) rename htsworkflow/{frontend => }/templates/experiments/flowcellSheet.html (100%) rename htsworkflow/{frontend => }/templates/experiments/flowcell_detail.html (100%) rename htsworkflow/{frontend => }/templates/experiments/flowcell_header.html (100%) rename htsworkflow/{frontend => }/templates/experiments/flowcell_lane_detail.html (100%) rename htsworkflow/{frontend => }/templates/experiments/index.html (100%) rename htsworkflow/{frontend => }/templates/experiments/sequencer.html (100%) rename htsworkflow/{frontend => }/templates/experiments/started_email.html (100%) rename htsworkflow/{frontend => }/templates/experiments/started_email.txt (100%) rename htsworkflow/{frontend => }/templates/inventory/default.zpl (100%) rename htsworkflow/{frontend => }/templates/inventory/hard_drive_shell.zpl (100%) rename htsworkflow/{frontend => }/templates/inventory/inventory_all_index.html (100%) rename htsworkflow/{frontend => }/templates/inventory/inventory_index.html (100%) rename htsworkflow/{frontend => }/templates/inventory/inventory_itemtype_index.html (100%) rename htsworkflow/{frontend => }/templates/inventory/inventory_summary.html (95%) rename htsworkflow/{frontend => }/templates/registration/login.html (100%) rename htsworkflow/{frontend => }/templates/registration/profile.html (100%) rename htsworkflow/{frontend => }/templates/reports/report.html (100%) rename htsworkflow/{frontend => }/templates/sample_header.html (100%) rename htsworkflow/{frontend => }/templates/samples/antibody_index.html (100%) rename htsworkflow/{frontend => }/templates/samples/lanes_for.html (100%) rename htsworkflow/{frontend => }/templates/samples/library_detail.html (100%) rename htsworkflow/{frontend => }/templates/samples/library_index.html (100%) rename htsworkflow/{frontend => }/templates/samples/species_detail.html (100%) rename htsworkflow/{frontend => }/templates/search_form.html (100%) create mode 100644 htsworkflow/urls.py rename {htsworkflow/frontend/inventory => inventory}/__init__.py (100%) rename {htsworkflow/frontend/inventory => inventory}/admin.py (88%) rename {htsworkflow/frontend/inventory => inventory}/bcmagic.py (86%) rename {htsworkflow/frontend/inventory => inventory}/fixtures/initial_data.json (100%) rename {htsworkflow/frontend/inventory => inventory}/fixtures/test_harddisks.json (100%) rename {htsworkflow/frontend/inventory => inventory}/fixtures/test_user.json (100%) rename {htsworkflow/frontend/inventory => inventory}/fixtures/woldlab.json (100%) rename {htsworkflow/frontend/inventory => inventory}/models.py (97%) rename {htsworkflow/frontend/inventory => inventory}/test_inventory.py (95%) create mode 100644 inventory/urls.py rename {htsworkflow/frontend/inventory => inventory}/views.py (95%) rename {htsworkflow/frontend/labels => labels}/__init__.py (100%) rename {htsworkflow/frontend/labels => labels}/admin.py (90%) rename {htsworkflow/frontend/labels => labels}/models.py (100%) rename {htsworkflow/frontend/labels => labels}/test_labels.py (100%) rename {htsworkflow/frontend/labels => labels}/views.py (100%) rename {htsworkflow/frontend/samples => samples}/__init__.py (100%) rename {htsworkflow/frontend/samples => samples}/admin.py (97%) rename {htsworkflow/frontend/samples => samples}/auth_backend.py (95%) rename {htsworkflow/frontend/samples => samples}/changelist.py (97%) rename {htsworkflow/frontend/samples => samples}/fixtures/initial_data.json (100%) rename {htsworkflow/frontend/samples => samples}/fixtures/test_samples.json (100%) rename {htsworkflow/frontend/samples => samples}/models.py (98%) rename {htsworkflow/frontend/samples => samples}/results.py (100%) rename {htsworkflow/frontend/samples => samples}/test_samples.py (98%) create mode 100644 samples/urls.py rename {htsworkflow/frontend/samples => samples}/views.py (97%) diff --git a/htsworkflow/frontend/bcmagic/__init__.py b/bcmagic/__init__.py similarity index 100% rename from htsworkflow/frontend/bcmagic/__init__.py rename to bcmagic/__init__.py diff --git a/htsworkflow/frontend/bcmagic/admin.py b/bcmagic/admin.py similarity index 74% rename from htsworkflow/frontend/bcmagic/admin.py rename to bcmagic/admin.py index 073c3e8..5241ab0 100644 --- a/htsworkflow/frontend/bcmagic/admin.py +++ b/bcmagic/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from htsworkflow.frontend.bcmagic.models import KeywordMap, Printer +from .models import KeywordMap, Printer class KeywordMapAdmin(admin.ModelAdmin): list_display = ('keyword','regex', 'url_template') diff --git a/htsworkflow/frontend/bcmagic/fixtures/initial_data.json b/bcmagic/fixtures/initial_data.json similarity index 100% rename from htsworkflow/frontend/bcmagic/fixtures/initial_data.json rename to bcmagic/fixtures/initial_data.json diff --git a/htsworkflow/frontend/bcmagic/fixtures/woldlab.json b/bcmagic/fixtures/woldlab.json similarity index 100% rename from htsworkflow/frontend/bcmagic/fixtures/woldlab.json rename to bcmagic/fixtures/woldlab.json diff --git a/htsworkflow/frontend/bcmagic/forms.py b/bcmagic/forms.py similarity index 100% rename from htsworkflow/frontend/bcmagic/forms.py rename to bcmagic/forms.py diff --git a/htsworkflow/frontend/bcmagic/models.py b/bcmagic/models.py similarity index 100% rename from htsworkflow/frontend/bcmagic/models.py rename to bcmagic/models.py diff --git a/htsworkflow/frontend/bcmagic/plugin.py b/bcmagic/plugin.py similarity index 100% rename from htsworkflow/frontend/bcmagic/plugin.py rename to bcmagic/plugin.py diff --git a/bcmagic/urls.py b/bcmagic/urls.py new file mode 100644 index 0000000..9133391 --- /dev/null +++ b/bcmagic/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import patterns + +urlpatterns = patterns('', + (r'^json_test/$', 'bcmagic.views.json_test'), + (r'^magic/$', 'bcmagic.views.magic'), + (r'^$', 'bcmagic.views.index'), +) diff --git a/htsworkflow/frontend/bcmagic/utils.py b/bcmagic/utils.py similarity index 100% rename from htsworkflow/frontend/bcmagic/utils.py rename to bcmagic/utils.py diff --git a/htsworkflow/frontend/bcmagic/views.py b/bcmagic/views.py similarity index 94% rename from htsworkflow/frontend/bcmagic/views.py rename to bcmagic/views.py index f9fb793..6825aed 100644 --- a/htsworkflow/frontend/bcmagic/views.py +++ b/bcmagic/views.py @@ -3,10 +3,10 @@ from django.template import RequestContext, Template, Context from django.shortcuts import render_to_response from django.core.exceptions import ObjectDoesNotExist -from htsworkflow.frontend.bcmagic import models -from htsworkflow.frontend.bcmagic.utils import report_error, redirect_to_url -from htsworkflow.frontend.bcmagic.plugin import bcm_plugin_processor -from htsworkflow.frontend.bcmagic import plugin +from . import models +from .utils import report_error, redirect_to_url +from .plugin import bcm_plugin_processor +from . import plugin #from htsworkflow.util.jsonutil import encode_json try: diff --git a/htsworkflow/frontend/eland_config/__init__.py b/eland_config/__init__.py similarity index 100% rename from htsworkflow/frontend/eland_config/__init__.py rename to eland_config/__init__.py diff --git a/htsworkflow/frontend/eland_config/admin.py b/eland_config/admin.py similarity index 100% rename from htsworkflow/frontend/eland_config/admin.py rename to eland_config/admin.py diff --git a/htsworkflow/frontend/eland_config/forms.py b/eland_config/forms.py similarity index 100% rename from htsworkflow/frontend/eland_config/forms.py rename to eland_config/forms.py diff --git a/htsworkflow/frontend/eland_config/models.py b/eland_config/models.py similarity index 100% rename from htsworkflow/frontend/eland_config/models.py rename to eland_config/models.py diff --git a/htsworkflow/frontend/eland_config/urls.py b/eland_config/urls.py similarity index 50% rename from htsworkflow/frontend/eland_config/urls.py rename to eland_config/urls.py index b4bc42b..eff1477 100644 --- a/htsworkflow/frontend/eland_config/urls.py +++ b/eland_config/urls.py @@ -3,8 +3,8 @@ from django.conf.urls import patterns, url urlpatterns = patterns('', ## Example: - url(r'^(?P\w+)/$', 'htsworkflow.frontend.eland_config.views.config'), - url(r'^$', 'htsworkflow.frontend.eland_config.views.config'), + url(r'^(?P\w+)/$', 'eland_config.views.config'), + url(r'^$', 'eland_config.views.config'), #url(r'^$', 'htsworkflow.frontend.eland_config.views.index') ) diff --git a/htsworkflow/frontend/eland_config/views.py b/eland_config/views.py similarity index 98% rename from htsworkflow/frontend/eland_config/views.py rename to eland_config/views.py index 7c3178b..f4d765e 100644 --- a/htsworkflow/frontend/eland_config/views.py +++ b/eland_config/views.py @@ -4,7 +4,7 @@ from django.conf import settings from django.http import HttpResponse from django.core.exceptions import ObjectDoesNotExist -from htsworkflow.frontend.experiments import models +from experiments import models import os diff --git a/htsworkflow/frontend/experiments/__init__.py b/experiments/__init__.py similarity index 100% rename from htsworkflow/frontend/experiments/__init__.py rename to experiments/__init__.py diff --git a/htsworkflow/frontend/experiments/admin.py b/experiments/admin.py similarity index 98% rename from htsworkflow/frontend/experiments/admin.py rename to experiments/admin.py index f7c6396..6290dbf 100644 --- a/htsworkflow/frontend/experiments/admin.py +++ b/experiments/admin.py @@ -1,6 +1,7 @@ +from __future__ import absolute_import, print_function + from itertools import chain -from htsworkflow.frontend.experiments.models import \ - FlowCell, DataRun, DataFile, FileType, ClusterStation, Sequencer, Lane + from django.contrib import admin from django.contrib.admin.widgets import FilteredSelectMultiple from django.forms import ModelForm @@ -10,6 +11,9 @@ from django.utils.encoding import force_unicode from django.utils.html import escape, conditional_escape from django.utils.translation import ugettext_lazy as _ +from .models import \ + FlowCell, DataRun, DataFile, FileType, ClusterStation, Sequencer, Lane + class DataFileForm(ModelForm): class Meta: model = DataFile diff --git a/htsworkflow/frontend/experiments/experiments.py b/experiments/experiments.py similarity index 98% rename from htsworkflow/frontend/experiments/experiments.py rename to experiments/experiments.py index 6dfd4b4..bdf7919 100644 --- a/htsworkflow/frontend/experiments/experiments.py +++ b/experiments/experiments.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + # some core functions of the exp tracker module from datetime import datetime, timedelta try: @@ -16,13 +18,9 @@ from django.http import HttpResponse, Http404 from django.conf import settings from django.utils import timezone -from htsworkflow.frontend.auth import require_api_key -from htsworkflow.frontend.experiments.models import \ - FlowCell, \ - DataRun, \ - Lane, \ - LANE_STATUS_MAP -from htsworkflow.frontend.samples.models import Library, MultiplexIndex, HTSUser +from htsworkflow.auth import require_api_key +from .models import FlowCell, DataRun, Lane, LANE_STATUS_MAP +from samples.models import Library, MultiplexIndex, HTSUser def flowcell_information(flowcell_id): """ diff --git a/htsworkflow/frontend/experiments/fixtures/initial_data.json b/experiments/fixtures/initial_data.json similarity index 100% rename from htsworkflow/frontend/experiments/fixtures/initial_data.json rename to experiments/fixtures/initial_data.json diff --git a/htsworkflow/frontend/experiments/fixtures/test_flowcells.json b/experiments/fixtures/test_flowcells.json similarity index 100% rename from htsworkflow/frontend/experiments/fixtures/test_flowcells.json rename to experiments/fixtures/test_flowcells.json diff --git a/htsworkflow/frontend/experiments/fixtures/woldlab.json b/experiments/fixtures/woldlab.json similarity index 100% rename from htsworkflow/frontend/experiments/fixtures/woldlab.json rename to experiments/fixtures/woldlab.json diff --git a/htsworkflow/frontend/experiments/models.py b/experiments/models.py similarity index 97% rename from htsworkflow/frontend/experiments/models.py rename to experiments/models.py index 6c952db..38411ef 100644 --- a/htsworkflow/frontend/experiments/models.py +++ b/experiments/models.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + import datetime import glob import logging @@ -13,7 +15,7 @@ from django.utils import timezone from django.db import models from django.db.models.signals import post_init, pre_save -from htsworkflow.frontend.samples.models import Library +from samples.models import Library from htsworkflow.util.conversion import parse_flowcell_id from htsworkflow.pipelines import runfolder @@ -24,7 +26,7 @@ default_pM = 5 try: default_pM = int(settings.DEFAULT_PM) except AttributeError, e: - LOGGER.error("invalid value for frontend.default_pm") + LOGGER.error("invalid value for default_pm") # how many days to wait before trying to re-import a runfolder RESCAN_DELAY = 1 @@ -103,7 +105,7 @@ class Sequencer(models.Model): @models.permalink def get_absolute_url(self): - return ('htsworkflow.frontend.experiments.views.sequencer', + return ('experiments.views.sequencer', [self.id]) @classmethod @@ -194,7 +196,7 @@ class FlowCell(models.Model): @models.permalink def get_absolute_url(self): flowcell_id, status = parse_flowcell_id(self.flowcell_id) - return ('htsworkflow.frontend.experiments.views.flowcell_detail', + return ('experiments.views.flowcell_detail', [str(flowcell_id)]) def get_raw_data_directory(self): @@ -306,7 +308,7 @@ class Lane(models.Model): @models.permalink def get_absolute_url(self): - return ('htsworkflow.frontend.experiments.views.flowcell_lane_detail', + return ('experiments.views.flowcell_lane_detail', [str(self.id)]) def __unicode__(self): @@ -453,7 +455,7 @@ class DataFile(models.Model): @models.permalink def get_absolute_url(self): - return ('htsworkflow.frontend.experiments.views.read_result_file', + return ('experiments.views.read_result_file', (), {'key': self.random_key}) diff --git a/htsworkflow/frontend/experiments/test_experiments.py b/experiments/test_experiments.py similarity index 90% rename from htsworkflow/frontend/experiments/test_experiments.py rename to experiments/test_experiments.py index 0a0c941..6dce585 100644 --- a/htsworkflow/frontend/experiments/test_experiments.py +++ b/experiments/test_experiments.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + import re from lxml.html import fromstring try: @@ -17,9 +19,11 @@ from django.test import TestCase from django.test.utils import setup_test_environment, teardown_test_environment from django.db import connection from django.conf import settings -from htsworkflow.frontend.experiments import models -from htsworkflow.frontend.experiments import experiments -from htsworkflow.frontend.auth import apidata + +from .models import ClusterStation, DataRun, Sequencer, FlowCell, FileType, \ + find_file_type_metadata_from_filename +from .experiments import flowcell_information, lanes_for +from htsworkflow.auth import apidata from htsworkflow.util.ethelp import validate_xhtml from htsworkflow.pipelines.test.simulate_runfolder import TESTDATA_DIR @@ -35,47 +39,47 @@ class ClusterStationTestCases(TestCase): 'test_flowcells.json'] def test_default(self): - c = models.ClusterStation.default() + c = ClusterStation.default() self.assertEqual(c.id, 2) c.isdefault = False c.save() - total = models.ClusterStation.objects.filter(isdefault=True).count() + total = ClusterStation.objects.filter(isdefault=True).count() self.assertEqual(total, 0) - other_default = models.ClusterStation.default() + other_default = ClusterStation.default() self.assertEqual(other_default.id, 3) def test_update_default(self): - old_default = models.ClusterStation.default() + old_default = ClusterStation.default() - c = models.ClusterStation.objects.get(pk=3) + c = ClusterStation.objects.get(pk=3) c.isdefault = True c.save() - new_default = models.ClusterStation.default() + new_default = ClusterStation.default() self.assertNotEqual(old_default, new_default) self.assertEqual(new_default, c) - total = models.ClusterStation.objects.filter(isdefault=True).count() + total = ClusterStation.objects.filter(isdefault=True).count() self.assertEqual(total, 1) def test_update_other(self): - old_default = models.ClusterStation.default() - total = models.ClusterStation.objects.filter(isdefault=True).count() + old_default = ClusterStation.default() + total = ClusterStation.objects.filter(isdefault=True).count() self.assertEqual(total, 1) - c = models.ClusterStation.objects.get(pk=1) + c = ClusterStation.objects.get(pk=1) c.name = "Primary Key 1" c.save() - total = models.ClusterStation.objects.filter(isdefault=True).count() + total = ClusterStation.objects.filter(isdefault=True).count() self.assertEqual(total, 1) - new_default = models.ClusterStation.default() + new_default = ClusterStation.default() self.assertEqual(old_default, new_default) @@ -86,50 +90,50 @@ class SequencerTestCases(TestCase): def test_default(self): # starting with no default - s = models.Sequencer.default() + s = Sequencer.default() self.assertEqual(s.id, 2) - total = models.Sequencer.objects.filter(isdefault=True).count() + total = Sequencer.objects.filter(isdefault=True).count() self.assertEqual(total, 1) s.isdefault = False s.save() - total = models.Sequencer.objects.filter(isdefault=True).count() + total = Sequencer.objects.filter(isdefault=True).count() self.assertEqual(total, 0) - other_default = models.Sequencer.default() + other_default = Sequencer.default() self.assertEqual(other_default.id, 7) def test_update_default(self): - old_default = models.Sequencer.default() + old_default = Sequencer.default() - s = models.Sequencer.objects.get(pk=1) + s = Sequencer.objects.get(pk=1) s.isdefault = True s.save() - new_default = models.Sequencer.default() + new_default = Sequencer.default() self.assertNotEqual(old_default, new_default) self.assertEqual(new_default, s) - total = models.Sequencer.objects.filter(isdefault=True).count() + total = Sequencer.objects.filter(isdefault=True).count() self.assertEqual(total, 1) def test_update_other(self): - old_default = models.Sequencer.default() - total = models.Sequencer.objects.filter(isdefault=True).count() + old_default = Sequencer.default() + total = Sequencer.objects.filter(isdefault=True).count() self.assertEqual(total, 1) - s = models.Sequencer.objects.get(pk=1) + s = Sequencer.objects.get(pk=1) s.name = "Primary Key 1" s.save() - total = models.Sequencer.objects.filter(isdefault=True).count() + total = Sequencer.objects.filter(isdefault=True).count() self.assertEqual(total, 1) - new_default = models.Sequencer.default() + new_default = Sequencer.default() self.assertEqual(old_default, new_default) @@ -172,8 +176,8 @@ class ExperimentsTestCases(TestCase): Check the code that packs the django objects into simple types. """ for fc_id in [u'FC12150', u"42JTNAAXX", "42JU1AAXX"]: - fc_dict = experiments.flowcell_information(fc_id) - fc_django = models.FlowCell.objects.get(flowcell_id=fc_id) + fc_dict = flowcell_information(fc_id) + fc_django = FlowCell.objects.get(flowcell_id=fc_id) self.assertEqual(fc_dict['flowcell_id'], fc_id) self.assertEqual(fc_django.flowcell_id, fc_id) self.assertEqual(fc_dict['sequencer'], fc_django.sequencer.name) @@ -310,7 +314,7 @@ class ExperimentsTestCases(TestCase): def test_pooled_multiplex_id(self): - fc_dict = experiments.flowcell_information('42JU1AAXX') + fc_dict = flowcell_information('42JU1AAXX') lane_contents = fc_dict['lane_set'][3] self.assertEqual(len(lane_contents), 2) lane_dict = multi_lane_to_dict(lane_contents) @@ -329,7 +333,7 @@ class ExperimentsTestCases(TestCase): Check the code that packs the django objects into simple types. """ user = 'test' - lanes = experiments.lanes_for(user) + lanes = lanes_for(user) self.assertEqual(len(lanes), 5) response = self.client.get('/experiments/lanes_for/%s/json' % (user,), apidata) @@ -346,7 +350,7 @@ class ExperimentsTestCases(TestCase): Do we get something meaningful back when the user isn't attached to anything? """ user = 'supertest' - lanes = experiments.lanes_for(user) + lanes = lanes_for(user) self.assertEqual(len(lanes), 0) response = self.client.get('/experiments/lanes_for/%s/json' % (user,), apidata) @@ -357,7 +361,7 @@ class ExperimentsTestCases(TestCase): Do we get something meaningful back when its the wrong user """ user = 'not a real user' - self.assertRaises(ObjectDoesNotExist, experiments.lanes_for, user) + self.assertRaises(ObjectDoesNotExist, lanes_for, user) response = self.client.get('/experiments/lanes_for/%s/json' % (user,), apidata) self.assertEqual(response.status_code, 404) @@ -368,7 +372,7 @@ class ExperimentsTestCases(TestCase): flowcell_id = self.fc1_id raw_dir = os.path.join(settings.RESULT_HOME_DIR, flowcell_id) - fc = models.FlowCell.objects.get(flowcell_id=flowcell_id) + fc = FlowCell.objects.get(flowcell_id=flowcell_id) self.assertEqual(fc.get_raw_data_directory(), raw_dir) fc.flowcell_id = flowcell_id + " (failed)" @@ -376,10 +380,10 @@ class ExperimentsTestCases(TestCase): def test_data_run_import(self): - srf_file_type = models.FileType.objects.get(name='SRF') - runxml_file_type = models.FileType.objects.get(name='run_xml') + srf_file_type = FileType.objects.get(name='SRF') + runxml_file_type = FileType.objects.get(name='run_xml') flowcell_id = self.fc1_id - flowcell = models.FlowCell.objects.get(flowcell_id=flowcell_id) + flowcell = FlowCell.objects.get(flowcell_id=flowcell_id) flowcell.update_data_runs() self.assertEqual(len(flowcell.datarun_set.all()), 1) @@ -405,19 +409,19 @@ class ExperimentsTestCases(TestCase): self.assertEqual(runxml.file_type, runxml_file_type) self.assertEqual(runxml.library_id, None) - import1 = len(models.DataRun.objects.filter(result_dir='FC12150/C1-37')) + import1 = len(DataRun.objects.filter(result_dir='FC12150/C1-37')) # what happens if we import twice? flowcell.import_data_run('FC12150/C1-37', 'run_FC12150_2007-09-27.xml') self.assertEqual( - len(models.DataRun.objects.filter(result_dir='FC12150/C1-37')), + len(DataRun.objects.filter(result_dir='FC12150/C1-37')), import1) def test_read_result_file(self): """make sure we can return a result file """ flowcell_id = self.fc1_id - flowcell = models.FlowCell.objects.get(flowcell_id=flowcell_id) + flowcell = FlowCell.objects.get(flowcell_id=flowcell_id) flowcell.update_data_runs() #self.client.login(username='supertest', password='BJOKL5kAj6aFZ6A5') @@ -489,14 +493,14 @@ class TestFileType(TestCase): ] def test_file_type_unicode(self): - file_type_objects = models.FileType.objects + file_type_objects = FileType.objects name = 'QSEQ tarfile' file_type_object = file_type_objects.get(name=name) self.assertEqual(u"QSEQ tarfile", unicode(file_type_object)) def test_find_file_type(self): - file_type_objects = models.FileType.objects + file_type_objects = FileType.objects cases = [('woldlab_090921_HWUSI-EAS627_0009_42FC3AAXX_l7_r1.tar.bz2', 'QSEQ tarfile', 7, 1), ('woldlab_091005_HWUSI-EAS627_0010_42JT2AAXX_1.srf', @@ -514,14 +518,14 @@ class TestFileType(TestCase): ('run_42JT2AAXX_2009-10-07.xml', 'run_xml', None, None), ] for filename, typename, lane, end in cases: - ft = models.find_file_type_metadata_from_filename(filename) + ft = find_file_type_metadata_from_filename(filename) self.assertEqual(ft['file_type'], file_type_objects.get(name=typename)) self.assertEqual(ft.get('lane', None), lane) self.assertEqual(ft.get('end', None), end) def test_assign_file_type_complex_path(self): - file_type_objects = models.FileType.objects + file_type_objects = FileType.objects cases = [('/a/b/c/woldlab_090921_HWUSI-EAS627_0009_42FC3AAXX_l7_r1.tar.bz2', 'QSEQ tarfile', 7, 1), ('foo/woldlab_091005_HWUSI-EAS627_0010_42JT2AAXX_1.srf', @@ -539,7 +543,7 @@ class TestFileType(TestCase): ('/notrandom/run_42JT2AAXX_2009-10-07.xml', 'run_xml', None, None), ] for filename, typename, lane, end in cases: - result = models.find_file_type_metadata_from_filename(filename) + result = find_file_type_metadata_from_filename(filename) self.assertEqual(result['file_type'], file_type_objects.get(name=typename)) self.assertEqual(result.get('lane',None), lane) @@ -602,7 +606,7 @@ class TestSequencer(TestCase): ] def test_name_generation(self): - seq = models.Sequencer() + seq = Sequencer() seq.name = "Seq1" seq.instrument_name = "HWI-SEQ1" seq.model = "Imaginary 5000" @@ -610,7 +614,7 @@ class TestSequencer(TestCase): self.assertEqual(unicode(seq), "Seq1 (HWI-SEQ1)") def test_lookup(self): - fc = models.FlowCell.objects.get(pk=153) + fc = FlowCell.objects.get(pk=153) self.assertEqual(fc.sequencer.model, "Illumina Genome Analyzer IIx") self.assertEqual(fc.sequencer.instrument_name, diff --git a/experiments/urls.py b/experiments/urls.py new file mode 100644 index 0000000..8330d91 --- /dev/null +++ b/experiments/urls.py @@ -0,0 +1,12 @@ +from django.conf.urls import patterns + +urlpatterns = patterns('', + (r'^$', 'experiments.views.index'), + #(r'^liblist$', 'htsworkflow.frontend.experiments.views.test_Libs'), + #(r'^(?P.+)/$', 'gaworkflow.frontend.experiments.views.detail'), + (r'^config/(?P.+)/json$', 'experiments.experiments.flowcell_json'), + (r'^lanes_for/(?P.+)/json$', 'experiments.experiments.lanes_for_json'), + (r'^file/(?P.+)/?$', 'experiments.views.read_result_file'), + (r'^started/(?P.+)/$', 'experiments.views.startedEmail'), + (r'^finished/(?P.+)/$', 'experiments.views.finishedEmail'), +) diff --git a/htsworkflow/frontend/experiments/views.py b/experiments/views.py similarity index 95% rename from htsworkflow/frontend/experiments/views.py rename to experiments/views.py index 38b0e98..294aff2 100644 --- a/htsworkflow/frontend/experiments/views.py +++ b/experiments/views.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + # Create your views here. from datetime import datetime import os @@ -13,16 +15,8 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.template.loader import get_template -from htsworkflow.frontend.experiments.models import \ - DataRun, \ - DataFile, \ - FlowCell, \ - Lane, \ - Sequencer -from htsworkflow.frontend.experiments.experiments import \ - estimateFlowcellDuration, \ - estimateFlowcellTimeRemaining, \ - roundToDays, \ +from .models import DataRun, DataFile, FlowCell, Lane, Sequencer +from .experiments import estimateFlowcellDuration, estimateFlowcellTimeRemaining, roundToDays, \ getUsersForFlowcell, \ makeEmailLaneMap diff --git a/htsworkflow/frontend/auth.py b/htsworkflow/auth.py similarity index 100% rename from htsworkflow/frontend/auth.py rename to htsworkflow/auth.py diff --git a/htsworkflow/frontend/bcmagic/urls.py b/htsworkflow/frontend/bcmagic/urls.py deleted file mode 100644 index d5c9627..0000000 --- a/htsworkflow/frontend/bcmagic/urls.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.conf.urls import patterns - -urlpatterns = patterns('', - (r'^json_test/$', 'htsworkflow.frontend.bcmagic.views.json_test'), - (r'^magic/$', 'htsworkflow.frontend.bcmagic.views.magic'), - (r'^$', 'htsworkflow.frontend.bcmagic.views.index'), -) diff --git a/htsworkflow/frontend/experiments/urls.py b/htsworkflow/frontend/experiments/urls.py deleted file mode 100644 index 6a53cdb..0000000 --- a/htsworkflow/frontend/experiments/urls.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.conf.urls import patterns - -urlpatterns = patterns('', - (r'^$', 'htsworkflow.frontend.experiments.views.index'), - #(r'^liblist$', 'htsworkflow.frontend.experiments.views.test_Libs'), - #(r'^(?P.+)/$', 'gaworkflow.frontend.experiments.views.detail'), - (r'^config/(?P.+)/json$', 'htsworkflow.frontend.experiments.experiments.flowcell_json'), - (r'^lanes_for/(?P.+)/json$', 'htsworkflow.frontend.experiments.experiments.lanes_for_json'), - (r'^file/(?P.+)/?$', 'htsworkflow.frontend.experiments.views.read_result_file'), - (r'^started/(?P.+)/$', 'htsworkflow.frontend.experiments.views.startedEmail'), - (r'^finished/(?P.+)/$', 'htsworkflow.frontend.experiments.views.finishedEmail'), - -) diff --git a/htsworkflow/frontend/inventory/urls.py b/htsworkflow/frontend/inventory/urls.py deleted file mode 100644 index fc25768..0000000 --- a/htsworkflow/frontend/inventory/urls.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.conf.urls import patterns - -urlpatterns = patterns('', - # DATA - (r'^data/items/$', 'htsworkflow.frontend.inventory.views.data_items'), - # REMOTE LINKING - (r'^lts/link/(?P.+)/(?P.+)/$', 'htsworkflow.frontend.inventory.views.link_flowcell_and_device'), - - # INDEX - (r'^it/(?P.+)/$', 'htsworkflow.frontend.inventory.views.itemtype_index'), - (r'^(?P[a-fA-F0-9]{32})/$', 'htsworkflow.frontend.inventory.views.item_summary_by_uuid'), - (r'^(?P[a-fA-F0-9]{32})/print/$', 'htsworkflow.frontend.inventory.views.item_print'), - (r'^(?P.+)/$', 'htsworkflow.frontend.inventory.views.item_summary_by_barcode'), - (r'^all_index/$', 'htsworkflow.frontend.inventory.views.all_index'), - (r'^$', 'htsworkflow.frontend.inventory.views.index') - ) diff --git a/htsworkflow/frontend/samples/urls.py b/htsworkflow/frontend/samples/urls.py deleted file mode 100644 index 570b1db..0000000 --- a/htsworkflow/frontend/samples/urls.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.conf.urls import patterns, url - -urlpatterns = patterns('', - url(r"^library/(?P\w+)/json", 'htsworkflow.frontend.samples.views.library_json'), - url(r"^species/(?P\w+)/json", 'htsworkflow.frontend.samples.views.species_json'), - url(r"^species/(?P\w+)", 'htsworkflow.frontend.samples.views.species'), - url(r"^antibody/$", 'htsworkflow.frontend.samples.views.antibodies'), -) diff --git a/htsworkflow/frontend/urls.py b/htsworkflow/frontend/urls.py deleted file mode 100644 index 681edaa..0000000 --- a/htsworkflow/frontend/urls.py +++ /dev/null @@ -1,58 +0,0 @@ -from django.conf.urls import include, patterns, url -from django.contrib import admin -import django -admin.autodiscover() - -from django.conf import settings - -urlpatterns = patterns('', - url('^accounts/login/$', 'django.contrib.auth.views.login'), - url('^accounts/logout/$', 'django.contrib.auth.views.logout'), - url('^accounts/logout_then_login/$', 'django.contrib.auth.views.logout_then_login'), - url('^accounts/password_change/$', 'django.contrib.auth.views.password_change'), - url('^accounts/password_change_done/$', 'django.contrib.auth.views.password_change_done'), - #url('^accounts/profile/$', 'htsworkflow.frontend.samples.views.user_profile'), - # Base: - url(r'^eland_config/', include('htsworkflow.frontend.eland_config.urls')), - ### MOVED Admin from here ### - # Experiments: - url(r'^experiments/', include('htsworkflow.frontend.experiments.urls')), - ### Flowcell: - url(r'^lane/(?P\w+)', - 'htsworkflow.frontend.experiments.views.flowcell_lane_detail'), - url(r'^flowcell/(?P\w+)/((?P\w+)/)?$', - 'htsworkflow.frontend.experiments.views.flowcell_detail'), - ## AnalysTrack: - ##(r'^analysis/', include('htsworkflow.frontend.analysis.urls')), - ## Inventory urls - url(r'^inventory/', include('htsworkflow.frontend.inventory.urls')), - ## Report Views: - ##url(r'^reports/', include('htsworkflow.frontend.reports.urls')), - ## Library browser - url(r'^library/$', 'htsworkflow.frontend.samples.views.library'), - url(r'^library/not_run/$', - 'htsworkflow.frontend.samples.views.library_not_run'), - url(r'^library/(?P\w+)/$', - 'htsworkflow.frontend.samples.views.library_to_flowcells'), - url(r'^lanes_for/$', 'htsworkflow.frontend.samples.views.lanes_for'), - url(r'^lanes_for/(?P\w+)', 'htsworkflow.frontend.samples.views.lanes_for'), - ### library id to admin url - url(r'^library_id_to_admin_url/(?P\w+)/$', - 'htsworkflow.frontend.samples.views.library_id_to_admin_url'), - ### sample / library information - url(r'^samples/', include('htsworkflow.frontend.samples.urls')), - url(r'^sequencer/(?P\w+)', - 'htsworkflow.frontend.experiments.views.sequencer'), - ## Raw result files - #url(r'^results/(?P\w+)/(?PC[0-9]+-[0-9]+)/summary/', - #'htsworkflow.frontend.samples.views.summaryhtm_fc_cnm'), - #url(r'^results/(?P\w+)/(?PC[0-9]+-[0-9]+)/eland_result/(?P[1-8])', - #'htsworkflow.frontend.samples.views.result_fc_cnm_eland_lane'), - #url(r'^results/(?P\w+)/(?PC[1-9]-[0-9]+)/bedfile/(?P[1-8])/ucsc', - #'htsworkflow.frontend.samples.views.bedfile_fc_cnm_eland_lane_ucsc'), - #url(r'^results/(?P\w+)/(?PC[1-9]-[0-9]+)/bedfile/(?P[1-8])', - #'htsworkflow.frontend.samples.views.bedfile_fc_cnm_eland_lane'), - url(r'^bcmagic/', include('htsworkflow.frontend.bcmagic.urls')), - - url(r'^admin/', include(admin.site.urls)), -) diff --git a/htsworkflow/pipelines/retrieve_config.py b/htsworkflow/pipelines/retrieve_config.py index fe2b942..7951752 100644 --- a/htsworkflow/pipelines/retrieve_config.py +++ b/htsworkflow/pipelines/retrieve_config.py @@ -15,7 +15,7 @@ try: except ImportError, e: import simplejson as json -from htsworkflow.frontend.auth import apidata +from htsworkflow.auth import apidata from htsworkflow.util import api from htsworkflow.util import alphanum from htsworkflow.util.url import normalize_url diff --git a/htsworkflow/pipelines/test/test_retrive_config.py b/htsworkflow/pipelines/test/test_retrive_config.py index cf30dd7..fd1c112 100644 --- a/htsworkflow/pipelines/test/test_retrive_config.py +++ b/htsworkflow/pipelines/test/test_retrive_config.py @@ -10,7 +10,7 @@ except ImportError, e: from django.test import TestCase -from htsworkflow.frontend.auth import apidata +from htsworkflow.auth import apidata from htsworkflow.pipelines.retrieve_config import \ format_gerald_config, \ getCombinedOptions, \ diff --git a/htsworkflow/settings.py b/htsworkflow/settings.py index dce3d90..f030a95 100644 --- a/htsworkflow/settings.py +++ b/htsworkflow/settings.py @@ -10,8 +10,10 @@ https://docs.djangoproject.com/en/1.6/ref/settings/ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os -BASE_DIR = os.path.dirname(os.path.dirname(__file__)) +import sys +DJANGO_ROOT = os.path.dirname(__file__) +PROJECT_ROOT = os.path.dirname(DJANGO_ROOT) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ @@ -31,7 +33,7 @@ ALLOWED_HOSTS = ['jumpgate.caltech.edu'] # Application definition AUTHENTICATION_BACKENDS = ( - 'htsworkflow.frontend.samples.auth_backend.HTSUserModelBackend', ) + 'samples.auth_backend.HTSUserModelBackend', ) CUSTOM_USER_MODEL = 'samples.HTSUser' INSTALLED_APPS = ( @@ -43,12 +45,12 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django.contrib.humanize', - 'htsworkflow.frontend.eland_config', - 'htsworkflow.frontend.samples', - 'htsworkflow.frontend.experiments', - 'htsworkflow.frontend.bcmagic', - 'htsworkflow.frontend.inventory', - 'htsworkflow.frontend.labels', + 'eland_config', + 'samples', + 'experiments', + 'bcmagic', + 'inventory', + 'labels', ) MIDDLEWARE_CLASSES = ( @@ -61,11 +63,10 @@ MIDDLEWARE_CLASSES = ( ) TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, 'htsworkflow', 'frontend', 'templates'), - os.path.join(BASE_DIR, 'htsworkflow', 'templates'), + os.path.join(DJANGO_ROOT, 'templates'), ) -ROOT_URLCONF = 'htsworkflow.frontend.urls' +ROOT_URLCONF = 'htsworkflow.urls' WSGI_APPLICATION = 'wsgi.application' @@ -75,7 +76,7 @@ WSGI_APPLICATION = 'wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'fctracker.db'), + 'NAME': os.path.join(PROJECT_ROOT, 'fctracker.db'), } } @@ -99,7 +100,7 @@ TIME_ZONE='America/Los_Angeles' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ STATICFILES_DIRS = ( - os.path.join(BASE_DIR, 'htsworkflow', 'frontend', 'static'), + os.path.join(DJANGO_ROOT, 'static'), ) STATIC_URL = '/static/' @@ -111,7 +112,7 @@ DEFAULT_PM = 5 # How often to recheck the result archive RESCAN_DELAY=1 # Update this in settings_local to point to your flowcell result directory -RESULT_HOME_DIR = os.path.join(BASE_DIR, 'test', 'result', 'flowcells') +RESULT_HOME_DIR = os.path.join(PROJECT_ROOT, 'test', 'result', 'flowcells') # configure who is sending email and who should get BCCs of announcments NOTIFICATION_SENDER = "noreply@example.com" diff --git a/htsworkflow/frontend/static/css/admin_flowcell.css b/htsworkflow/static/css/admin_flowcell.css similarity index 100% rename from htsworkflow/frontend/static/css/admin_flowcell.css rename to htsworkflow/static/css/admin_flowcell.css diff --git a/htsworkflow/frontend/static/css/app.css b/htsworkflow/static/css/app.css similarity index 100% rename from htsworkflow/frontend/static/css/app.css rename to htsworkflow/static/css/app.css diff --git a/htsworkflow/frontend/static/css/base.css b/htsworkflow/static/css/base.css similarity index 100% rename from htsworkflow/frontend/static/css/base.css rename to htsworkflow/static/css/base.css diff --git a/htsworkflow/frontend/static/css/changelists.css b/htsworkflow/static/css/changelists.css similarity index 100% rename from htsworkflow/frontend/static/css/changelists.css rename to htsworkflow/static/css/changelists.css diff --git a/htsworkflow/frontend/static/css/click-table.css b/htsworkflow/static/css/click-table.css similarity index 100% rename from htsworkflow/frontend/static/css/click-table.css rename to htsworkflow/static/css/click-table.css diff --git a/htsworkflow/frontend/static/css/dashboard.css b/htsworkflow/static/css/dashboard.css similarity index 100% rename from htsworkflow/frontend/static/css/dashboard.css rename to htsworkflow/static/css/dashboard.css diff --git a/htsworkflow/frontend/static/css/data-browse-index.css b/htsworkflow/static/css/data-browse-index.css similarity index 100% rename from htsworkflow/frontend/static/css/data-browse-index.css rename to htsworkflow/static/css/data-browse-index.css diff --git a/htsworkflow/frontend/static/css/forms.css b/htsworkflow/static/css/forms.css similarity index 100% rename from htsworkflow/frontend/static/css/forms.css rename to htsworkflow/static/css/forms.css diff --git a/htsworkflow/frontend/static/css/global.css b/htsworkflow/static/css/global.css similarity index 100% rename from htsworkflow/frontend/static/css/global.css rename to htsworkflow/static/css/global.css diff --git a/htsworkflow/frontend/static/css/htsw.css b/htsworkflow/static/css/htsw.css similarity index 100% rename from htsworkflow/frontend/static/css/htsw.css rename to htsworkflow/static/css/htsw.css diff --git a/htsworkflow/frontend/static/css/layout.css b/htsworkflow/static/css/layout.css similarity index 100% rename from htsworkflow/frontend/static/css/layout.css rename to htsworkflow/static/css/layout.css diff --git a/htsworkflow/frontend/static/css/null.css b/htsworkflow/static/css/null.css similarity index 100% rename from htsworkflow/frontend/static/css/null.css rename to htsworkflow/static/css/null.css diff --git a/htsworkflow/frontend/static/css/patch-iewin.css b/htsworkflow/static/css/patch-iewin.css similarity index 100% rename from htsworkflow/frontend/static/css/patch-iewin.css rename to htsworkflow/static/css/patch-iewin.css diff --git a/htsworkflow/frontend/static/css/wide_account_number.css b/htsworkflow/static/css/wide_account_number.css similarity index 100% rename from htsworkflow/frontend/static/css/wide_account_number.css rename to htsworkflow/static/css/wide_account_number.css diff --git a/htsworkflow/frontend/static/img/changelist-bg.gif b/htsworkflow/static/img/changelist-bg.gif similarity index 100% rename from htsworkflow/frontend/static/img/changelist-bg.gif rename to htsworkflow/static/img/changelist-bg.gif diff --git a/htsworkflow/frontend/static/img/default-bg.gif b/htsworkflow/static/img/default-bg.gif similarity index 100% rename from htsworkflow/frontend/static/img/default-bg.gif rename to htsworkflow/static/img/default-bg.gif diff --git a/htsworkflow/frontend/static/img/dna80.png b/htsworkflow/static/img/dna80.png similarity index 100% rename from htsworkflow/frontend/static/img/dna80.png rename to htsworkflow/static/img/dna80.png diff --git a/htsworkflow/frontend/static/img/hdd_unmount.png b/htsworkflow/static/img/hdd_unmount.png similarity index 100% rename from htsworkflow/frontend/static/img/hdd_unmount.png rename to htsworkflow/static/img/hdd_unmount.png diff --git a/htsworkflow/frontend/static/img/icon_searchbox.png b/htsworkflow/static/img/icon_searchbox.png similarity index 100% rename from htsworkflow/frontend/static/img/icon_searchbox.png rename to htsworkflow/static/img/icon_searchbox.png diff --git a/htsworkflow/frontend/static/img/layout-browser-hd-bg.gif b/htsworkflow/static/img/layout-browser-hd-bg.gif similarity index 100% rename from htsworkflow/frontend/static/img/layout-browser-hd-bg.gif rename to htsworkflow/static/img/layout-browser-hd-bg.gif diff --git a/htsworkflow/frontend/static/img/nav-bg-reverse.gif b/htsworkflow/static/img/nav-bg-reverse.gif similarity index 100% rename from htsworkflow/frontend/static/img/nav-bg-reverse.gif rename to htsworkflow/static/img/nav-bg-reverse.gif diff --git a/htsworkflow/frontend/static/img/nav-bg.gif b/htsworkflow/static/img/nav-bg.gif similarity index 100% rename from htsworkflow/frontend/static/img/nav-bg.gif rename to htsworkflow/static/img/nav-bg.gif diff --git a/htsworkflow/frontend/static/img/readme.txt b/htsworkflow/static/img/readme.txt similarity index 100% rename from htsworkflow/frontend/static/img/readme.txt rename to htsworkflow/static/img/readme.txt diff --git a/htsworkflow/frontend/static/img/s.gif b/htsworkflow/static/img/s.gif similarity index 100% rename from htsworkflow/frontend/static/img/s.gif rename to htsworkflow/static/img/s.gif diff --git a/htsworkflow/frontend/static/js/bcmagic-ext.js b/htsworkflow/static/js/bcmagic-ext.js similarity index 100% rename from htsworkflow/frontend/static/js/bcmagic-ext.js rename to htsworkflow/static/js/bcmagic-ext.js diff --git a/htsworkflow/frontend/static/js/htsw-inventory.js b/htsworkflow/static/js/htsw-inventory.js similarity index 100% rename from htsworkflow/frontend/static/js/htsw-inventory.js rename to htsworkflow/static/js/htsw-inventory.js diff --git a/htsworkflow/frontend/static/js/htsw.js b/htsworkflow/static/js/htsw.js similarity index 100% rename from htsworkflow/frontend/static/js/htsw.js rename to htsworkflow/static/js/htsw.js diff --git a/htsworkflow/frontend/static/js/jquery.timers-1.0.0.js b/htsworkflow/static/js/jquery.timers-1.0.0.js similarity index 100% rename from htsworkflow/frontend/static/js/jquery.timers-1.0.0.js rename to htsworkflow/static/js/jquery.timers-1.0.0.js diff --git a/htsworkflow/frontend/static/js/magicbc.js b/htsworkflow/static/js/magicbc.js similarity index 100% rename from htsworkflow/frontend/static/js/magicbc.js rename to htsworkflow/static/js/magicbc.js diff --git a/htsworkflow/frontend/templates/404.html b/htsworkflow/templates/404.html similarity index 100% rename from htsworkflow/frontend/templates/404.html rename to htsworkflow/templates/404.html diff --git a/htsworkflow/frontend/templates/admin/auth/user/add_form.html b/htsworkflow/templates/admin/auth/user/add_form.html similarity index 100% rename from htsworkflow/frontend/templates/admin/auth/user/add_form.html rename to htsworkflow/templates/admin/auth/user/add_form.html diff --git a/htsworkflow/frontend/templates/admin/base_site.html b/htsworkflow/templates/admin/base_site.html similarity index 100% rename from htsworkflow/frontend/templates/admin/base_site.html rename to htsworkflow/templates/admin/base_site.html diff --git a/htsworkflow/frontend/templates/admin/experiments/flowcell/change_form.html b/htsworkflow/templates/admin/experiments/flowcell/change_form.html similarity index 100% rename from htsworkflow/frontend/templates/admin/experiments/flowcell/change_form.html rename to htsworkflow/templates/admin/experiments/flowcell/change_form.html diff --git a/htsworkflow/frontend/templates/admin/index.html b/htsworkflow/templates/admin/index.html similarity index 100% rename from htsworkflow/frontend/templates/admin/index.html rename to htsworkflow/templates/admin/index.html diff --git a/htsworkflow/frontend/templates/admin/pagination.html b/htsworkflow/templates/admin/pagination.html similarity index 100% rename from htsworkflow/frontend/templates/admin/pagination.html rename to htsworkflow/templates/admin/pagination.html diff --git a/htsworkflow/frontend/templates/base.html b/htsworkflow/templates/base.html similarity index 100% rename from htsworkflow/frontend/templates/base.html rename to htsworkflow/templates/base.html diff --git a/htsworkflow/frontend/templates/base_site.html b/htsworkflow/templates/base_site.html similarity index 100% rename from htsworkflow/frontend/templates/base_site.html rename to htsworkflow/templates/base_site.html diff --git a/htsworkflow/frontend/templates/bcmagic/magic.html b/htsworkflow/templates/bcmagic/magic.html similarity index 100% rename from htsworkflow/frontend/templates/bcmagic/magic.html rename to htsworkflow/templates/bcmagic/magic.html diff --git a/htsworkflow/frontend/templates/experiments/detail.html b/htsworkflow/templates/experiments/detail.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/detail.html rename to htsworkflow/templates/experiments/detail.html diff --git a/htsworkflow/frontend/templates/experiments/email_preview.html b/htsworkflow/templates/experiments/email_preview.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/email_preview.html rename to htsworkflow/templates/experiments/email_preview.html diff --git a/htsworkflow/frontend/templates/experiments/flowcellSheet.html b/htsworkflow/templates/experiments/flowcellSheet.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/flowcellSheet.html rename to htsworkflow/templates/experiments/flowcellSheet.html diff --git a/htsworkflow/frontend/templates/experiments/flowcell_detail.html b/htsworkflow/templates/experiments/flowcell_detail.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/flowcell_detail.html rename to htsworkflow/templates/experiments/flowcell_detail.html diff --git a/htsworkflow/frontend/templates/experiments/flowcell_header.html b/htsworkflow/templates/experiments/flowcell_header.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/flowcell_header.html rename to htsworkflow/templates/experiments/flowcell_header.html diff --git a/htsworkflow/frontend/templates/experiments/flowcell_lane_detail.html b/htsworkflow/templates/experiments/flowcell_lane_detail.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/flowcell_lane_detail.html rename to htsworkflow/templates/experiments/flowcell_lane_detail.html diff --git a/htsworkflow/frontend/templates/experiments/index.html b/htsworkflow/templates/experiments/index.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/index.html rename to htsworkflow/templates/experiments/index.html diff --git a/htsworkflow/frontend/templates/experiments/sequencer.html b/htsworkflow/templates/experiments/sequencer.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/sequencer.html rename to htsworkflow/templates/experiments/sequencer.html diff --git a/htsworkflow/frontend/templates/experiments/started_email.html b/htsworkflow/templates/experiments/started_email.html similarity index 100% rename from htsworkflow/frontend/templates/experiments/started_email.html rename to htsworkflow/templates/experiments/started_email.html diff --git a/htsworkflow/frontend/templates/experiments/started_email.txt b/htsworkflow/templates/experiments/started_email.txt similarity index 100% rename from htsworkflow/frontend/templates/experiments/started_email.txt rename to htsworkflow/templates/experiments/started_email.txt diff --git a/htsworkflow/frontend/templates/inventory/default.zpl b/htsworkflow/templates/inventory/default.zpl similarity index 100% rename from htsworkflow/frontend/templates/inventory/default.zpl rename to htsworkflow/templates/inventory/default.zpl diff --git a/htsworkflow/frontend/templates/inventory/hard_drive_shell.zpl b/htsworkflow/templates/inventory/hard_drive_shell.zpl similarity index 100% rename from htsworkflow/frontend/templates/inventory/hard_drive_shell.zpl rename to htsworkflow/templates/inventory/hard_drive_shell.zpl diff --git a/htsworkflow/frontend/templates/inventory/inventory_all_index.html b/htsworkflow/templates/inventory/inventory_all_index.html similarity index 100% rename from htsworkflow/frontend/templates/inventory/inventory_all_index.html rename to htsworkflow/templates/inventory/inventory_all_index.html diff --git a/htsworkflow/frontend/templates/inventory/inventory_index.html b/htsworkflow/templates/inventory/inventory_index.html similarity index 100% rename from htsworkflow/frontend/templates/inventory/inventory_index.html rename to htsworkflow/templates/inventory/inventory_index.html diff --git a/htsworkflow/frontend/templates/inventory/inventory_itemtype_index.html b/htsworkflow/templates/inventory/inventory_itemtype_index.html similarity index 100% rename from htsworkflow/frontend/templates/inventory/inventory_itemtype_index.html rename to htsworkflow/templates/inventory/inventory_itemtype_index.html diff --git a/htsworkflow/frontend/templates/inventory/inventory_summary.html b/htsworkflow/templates/inventory/inventory_summary.html similarity index 95% rename from htsworkflow/frontend/templates/inventory/inventory_summary.html rename to htsworkflow/templates/inventory/inventory_summary.html index 1a4797c..b520405 100644 --- a/htsworkflow/frontend/templates/inventory/inventory_summary.html +++ b/htsworkflow/templates/inventory/inventory_summary.html @@ -3,7 +3,7 @@ {% block content %} {% if item %}

Item Summary:

- Print
+ Print

UUID: {{item.uuid}}
Barcode ID: {{ item.barcode_id }}
diff --git a/htsworkflow/frontend/templates/registration/login.html b/htsworkflow/templates/registration/login.html similarity index 100% rename from htsworkflow/frontend/templates/registration/login.html rename to htsworkflow/templates/registration/login.html diff --git a/htsworkflow/frontend/templates/registration/profile.html b/htsworkflow/templates/registration/profile.html similarity index 100% rename from htsworkflow/frontend/templates/registration/profile.html rename to htsworkflow/templates/registration/profile.html diff --git a/htsworkflow/frontend/templates/reports/report.html b/htsworkflow/templates/reports/report.html similarity index 100% rename from htsworkflow/frontend/templates/reports/report.html rename to htsworkflow/templates/reports/report.html diff --git a/htsworkflow/frontend/templates/sample_header.html b/htsworkflow/templates/sample_header.html similarity index 100% rename from htsworkflow/frontend/templates/sample_header.html rename to htsworkflow/templates/sample_header.html diff --git a/htsworkflow/frontend/templates/samples/antibody_index.html b/htsworkflow/templates/samples/antibody_index.html similarity index 100% rename from htsworkflow/frontend/templates/samples/antibody_index.html rename to htsworkflow/templates/samples/antibody_index.html diff --git a/htsworkflow/frontend/templates/samples/lanes_for.html b/htsworkflow/templates/samples/lanes_for.html similarity index 100% rename from htsworkflow/frontend/templates/samples/lanes_for.html rename to htsworkflow/templates/samples/lanes_for.html diff --git a/htsworkflow/frontend/templates/samples/library_detail.html b/htsworkflow/templates/samples/library_detail.html similarity index 100% rename from htsworkflow/frontend/templates/samples/library_detail.html rename to htsworkflow/templates/samples/library_detail.html diff --git a/htsworkflow/frontend/templates/samples/library_index.html b/htsworkflow/templates/samples/library_index.html similarity index 100% rename from htsworkflow/frontend/templates/samples/library_index.html rename to htsworkflow/templates/samples/library_index.html diff --git a/htsworkflow/frontend/templates/samples/species_detail.html b/htsworkflow/templates/samples/species_detail.html similarity index 100% rename from htsworkflow/frontend/templates/samples/species_detail.html rename to htsworkflow/templates/samples/species_detail.html diff --git a/htsworkflow/frontend/templates/search_form.html b/htsworkflow/templates/search_form.html similarity index 100% rename from htsworkflow/frontend/templates/search_form.html rename to htsworkflow/templates/search_form.html diff --git a/htsworkflow/urls.py b/htsworkflow/urls.py new file mode 100644 index 0000000..1bfbf3d --- /dev/null +++ b/htsworkflow/urls.py @@ -0,0 +1,31 @@ +from django.conf.urls import include, patterns, url +from django.contrib import admin +import django +admin.autodiscover() + +from django.conf import settings + +urlpatterns = patterns('', + url('^accounts/', include('django.contrib.auth.urls')), + # Base: + url(r'^eland_config/', include('eland_config.urls')), + # Experiments: + url(r'^experiments/', include('experiments.urls')), + url(r'^lane/(?P\w+)', + 'experiments.views.flowcell_lane_detail'), + url(r'^flowcell/(?P\w+)/((?P\w+)/)?$', + 'experiments.views.flowcell_detail'), + url(r'^inventory/', include('inventory.urls')), + url(r'^library/', include('samples.urls')), + url(r'^lanes_for/$', 'samples.views.lanes_for'), + url(r'^lanes_for/(?P\w+)', 'samples.views.lanes_for'), + ### library id to admin url + url(r'^library_id_to_admin_url/(?P\w+)/$', + 'samples.views.library_id_to_admin_url'), + ### sample / library information + url(r'^samples/', include('samples.urls')), + url(r'^sequencer/(?P\w+)', + 'experiments.views.sequencer'), + + url(r'^admin/', include(admin.site.urls)), +) diff --git a/htsworkflow/util/makebed.py b/htsworkflow/util/makebed.py index c9383fe..895297b 100644 --- a/htsworkflow/util/makebed.py +++ b/htsworkflow/util/makebed.py @@ -154,7 +154,7 @@ def make_description(flowcell_id, lane): """ compute a bedfile name and description from the django database """ - from htsworkflow.frontend.experiments import models as experiments + from htsworkflow.experiments import models as experiments lane = int(lane) if lane < 1 or lane > 8: diff --git a/htsworkflow/frontend/inventory/__init__.py b/inventory/__init__.py similarity index 100% rename from htsworkflow/frontend/inventory/__init__.py rename to inventory/__init__.py diff --git a/htsworkflow/frontend/inventory/admin.py b/inventory/admin.py similarity index 88% rename from htsworkflow/frontend/inventory/admin.py rename to inventory/admin.py index 04b87e8..b418f99 100644 --- a/htsworkflow/frontend/inventory/admin.py +++ b/inventory/admin.py @@ -1,6 +1,8 @@ +from __future__ import absolute_import, print_function + from django.contrib import admin -from htsworkflow.frontend.inventory.models import Item, ItemInfo, ItemType, Vendor, Location, LongTermStorage, ItemStatus, ReagentFlowcell, ReagentLibrary, PrinterTemplate +from .models import Item, ItemInfo, ItemType, Vendor, Location, LongTermStorage, ItemStatus, ReagentFlowcell, ReagentLibrary, PrinterTemplate class ItemAdmin(admin.ModelAdmin): save_as = True diff --git a/htsworkflow/frontend/inventory/bcmagic.py b/inventory/bcmagic.py similarity index 86% rename from htsworkflow/frontend/inventory/bcmagic.py rename to inventory/bcmagic.py index 9d275c1..218bc0c 100644 --- a/htsworkflow/frontend/inventory/bcmagic.py +++ b/inventory/bcmagic.py @@ -1,4 +1,6 @@ -from htsworkflow.frontend.inventory.models import Item +from __future__ import absolute_import, print_function + +from .models import Item from django.core.exceptions import ObjectDoesNotExist diff --git a/htsworkflow/frontend/inventory/fixtures/initial_data.json b/inventory/fixtures/initial_data.json similarity index 100% rename from htsworkflow/frontend/inventory/fixtures/initial_data.json rename to inventory/fixtures/initial_data.json diff --git a/htsworkflow/frontend/inventory/fixtures/test_harddisks.json b/inventory/fixtures/test_harddisks.json similarity index 100% rename from htsworkflow/frontend/inventory/fixtures/test_harddisks.json rename to inventory/fixtures/test_harddisks.json diff --git a/htsworkflow/frontend/inventory/fixtures/test_user.json b/inventory/fixtures/test_user.json similarity index 100% rename from htsworkflow/frontend/inventory/fixtures/test_user.json rename to inventory/fixtures/test_user.json diff --git a/htsworkflow/frontend/inventory/fixtures/woldlab.json b/inventory/fixtures/woldlab.json similarity index 100% rename from htsworkflow/frontend/inventory/fixtures/woldlab.json rename to inventory/fixtures/woldlab.json diff --git a/htsworkflow/frontend/inventory/models.py b/inventory/models.py similarity index 97% rename from htsworkflow/frontend/inventory/models.py rename to inventory/models.py index e729fe4..7534c8a 100644 --- a/htsworkflow/frontend/inventory/models.py +++ b/inventory/models.py @@ -1,11 +1,13 @@ +from __future__ import absolute_import, print_function + import logging from django.db import models from django.db.models.signals import pre_save -from htsworkflow.frontend.samples.models import Library -from htsworkflow.frontend.experiments.models import FlowCell -from htsworkflow.frontend.bcmagic.models import Printer +from samples.models import Library +from experiments.models import FlowCell +from bcmagic.models import Printer LOGGER = logging.getLogger(__name__) diff --git a/htsworkflow/frontend/inventory/test_inventory.py b/inventory/test_inventory.py similarity index 95% rename from htsworkflow/frontend/inventory/test_inventory.py rename to inventory/test_inventory.py index e3937e1..59abcfd 100644 --- a/htsworkflow/frontend/inventory/test_inventory.py +++ b/inventory/test_inventory.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + import RDF from django.test import TestCase @@ -9,7 +11,7 @@ from django.conf import settings from django.contrib.auth.models import User from django.core import urlresolvers -from htsworkflow.frontend.inventory.models import Item, Vendor +from .models import Item, Vendor from htsworkflow.util.rdfhelp import get_model, load_string_into_model, get_serializer, inventoryOntology, libraryOntology, fromTypedNode def localhostNode(url): @@ -66,7 +68,7 @@ class InventoryTestCase(TestCase): flowcell = '22TWOAAXX' serial = 'WCAU49042470' link_url = urlresolvers.reverse( - 'htsworkflow.frontend.inventory.views.link_flowcell_and_device', + 'inventory.views.link_flowcell_and_device', args=(flowcell, serial)) link_response = self.client.get(link_url) self.failUnlessEqual(link_response.status_code, 200) @@ -91,7 +93,7 @@ class InventoryTestCase(TestCase): flowcell = '33THRAAXX' serial = 'WCAU49042470' link_url = urlresolvers.reverse( - 'htsworkflow.frontend.inventory.views.link_flowcell_and_device', + 'inventory.views.link_flowcell_and_device', args=(flowcell, serial)) link_response = self.client.get(link_url) self.failUnlessEqual(link_response.status_code, 200) diff --git a/inventory/urls.py b/inventory/urls.py new file mode 100644 index 0000000..ff71a6b --- /dev/null +++ b/inventory/urls.py @@ -0,0 +1,16 @@ +from django.conf.urls import patterns + +urlpatterns = patterns('', + # DATA + (r'^data/items/$', 'inventory.views.data_items'), + # REMOTE LINKING + (r'^lts/link/(?P.+)/(?P.+)/$', 'inventory.views.link_flowcell_and_device'), + + # INDEX + (r'^it/(?P.+)/$', 'inventory.views.itemtype_index'), + (r'^(?P[a-fA-F0-9]{32})/$', 'inventory.views.item_summary_by_uuid'), + (r'^(?P[a-fA-F0-9]{32})/print/$', 'inventory.views.item_print'), + (r'^(?P.+)/$', 'inventory.views.item_summary_by_barcode'), + (r'^all_index/$', 'inventory.views.all_index'), + (r'^$', 'inventory.views.index') + ) diff --git a/htsworkflow/frontend/inventory/views.py b/inventory/views.py similarity index 95% rename from htsworkflow/frontend/inventory/views.py rename to inventory/views.py index 265e1bc..05f300a 100644 --- a/htsworkflow/frontend/inventory/views.py +++ b/inventory/views.py @@ -1,11 +1,4 @@ -from htsworkflow.frontend.samples.changelist import HTSChangeList -from htsworkflow.frontend.inventory.models import Item, LongTermStorage, ItemType -from htsworkflow.frontend.inventory.admin import ItemAdmin, ItemTypeAdmin -from htsworkflow.frontend.inventory.bcmagic import item_search -from htsworkflow.frontend.bcmagic.plugin import register_search_plugin -from htsworkflow.frontend.experiments.models import FlowCell -from htsworkflow.frontend.bcmagic.forms import BarcodeMagicForm -from htsworkflow.frontend.bcmagic.utils import print_zpl_socket +from __future__ import absolute_import, print_function from django.conf import settings from django.contrib.auth.decorators import login_required @@ -15,6 +8,15 @@ from django.shortcuts import render_to_response from django.template import RequestContext, Template from django.template.loader import get_template +from samples.changelist import HTSChangeList +from .models import Item, LongTermStorage, ItemType +from .admin import ItemAdmin, ItemTypeAdmin +from .bcmagic import item_search +from experiments.models import FlowCell +from bcmagic.plugin import register_search_plugin +from bcmagic.forms import BarcodeMagicForm +from bcmagic.utils import print_zpl_socket + register_search_plugin('Inventory Item', item_search) try: diff --git a/htsworkflow/frontend/labels/__init__.py b/labels/__init__.py similarity index 100% rename from htsworkflow/frontend/labels/__init__.py rename to labels/__init__.py diff --git a/htsworkflow/frontend/labels/admin.py b/labels/admin.py similarity index 90% rename from htsworkflow/frontend/labels/admin.py rename to labels/admin.py index 24445e5..ba37739 100644 --- a/htsworkflow/frontend/labels/admin.py +++ b/labels/admin.py @@ -1,9 +1,10 @@ -from htsworkflow.frontend.labels.models import LabelContent, LabelTemplate, LabelPrinter -from htsworkflow.frontend.inventory.models import PrinterTemplate -from htsworkflow.frontend.bcmagic.utils import print_zpl_socket from django.template import Context, Template from django.contrib import admin +from .models import LabelContent, LabelTemplate, LabelPrinter +from inventory.models import PrinterTemplate +from bcmagic.utils import print_zpl_socket + class LabelContentOptions(admin.ModelAdmin): save_as = True save_on_top = True diff --git a/htsworkflow/frontend/labels/models.py b/labels/models.py similarity index 100% rename from htsworkflow/frontend/labels/models.py rename to labels/models.py diff --git a/htsworkflow/frontend/labels/test_labels.py b/labels/test_labels.py similarity index 100% rename from htsworkflow/frontend/labels/test_labels.py rename to labels/test_labels.py diff --git a/htsworkflow/frontend/labels/views.py b/labels/views.py similarity index 100% rename from htsworkflow/frontend/labels/views.py rename to labels/views.py diff --git a/htsworkflow/frontend/samples/__init__.py b/samples/__init__.py similarity index 100% rename from htsworkflow/frontend/samples/__init__.py rename to samples/__init__.py diff --git a/htsworkflow/frontend/samples/admin.py b/samples/admin.py similarity index 97% rename from htsworkflow/frontend/samples/admin.py rename to samples/admin.py index 619b383..5b9b858 100644 --- a/htsworkflow/frontend/samples/admin.py +++ b/samples/admin.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + from django.contrib import admin from django.contrib.admin import widgets from django.contrib.auth.models import User @@ -8,12 +10,12 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from django.forms import TextInput, Textarea -from htsworkflow.frontend.samples.models import \ +from .models import \ Antibody, Cellline, Condition, ExperimentType, HTSUser, \ LibraryType, MultiplexIndex, Species, Affiliation, Library, Tag -from htsworkflow.frontend.experiments.models import Lane -from htsworkflow.frontend.inventory.models import PrinterTemplate -from htsworkflow.frontend.bcmagic.utils import print_zpl_socket +from experiments.models import Lane +from inventory.models import PrinterTemplate +from bcmagic.utils import print_zpl_socket # Let's disable those pesky delete everything by accident features. admin.site.disable_action('delete_selected') diff --git a/htsworkflow/frontend/samples/auth_backend.py b/samples/auth_backend.py similarity index 95% rename from htsworkflow/frontend/samples/auth_backend.py rename to samples/auth_backend.py index e09d404..a4c67ee 100644 --- a/htsworkflow/frontend/samples/auth_backend.py +++ b/samples/auth_backend.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + from django.conf import settings from django.contrib.auth.backends import ModelBackend from django.core.exceptions import ImproperlyConfigured diff --git a/htsworkflow/frontend/samples/changelist.py b/samples/changelist.py similarity index 97% rename from htsworkflow/frontend/samples/changelist.py rename to samples/changelist.py index 960509e..83bbb78 100644 --- a/htsworkflow/frontend/samples/changelist.py +++ b/samples/changelist.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + import django from django.contrib.admin.views.main import ChangeList diff --git a/htsworkflow/frontend/samples/fixtures/initial_data.json b/samples/fixtures/initial_data.json similarity index 100% rename from htsworkflow/frontend/samples/fixtures/initial_data.json rename to samples/fixtures/initial_data.json diff --git a/htsworkflow/frontend/samples/fixtures/test_samples.json b/samples/fixtures/test_samples.json similarity index 100% rename from htsworkflow/frontend/samples/fixtures/test_samples.json rename to samples/fixtures/test_samples.json diff --git a/htsworkflow/frontend/samples/models.py b/samples/models.py similarity index 98% rename from htsworkflow/frontend/samples/models.py rename to samples/models.py index d7c70c2..5c5c27c 100644 --- a/htsworkflow/frontend/samples/models.py +++ b/samples/models.py @@ -6,7 +6,6 @@ from django.contrib.auth.models import User, UserManager from django.core import urlresolvers from django.db.models.signals import pre_save, post_save from django.db import connection -from htsworkflow.frontend.reports.libinfopar import * logger = logging.getLogger(__name__) @@ -104,7 +103,7 @@ class Species(models.Model): @models.permalink def get_absolute_url(self): - return ('htsworkflow.frontend.samples.views.species', [str(self.id)]) + return ('samples.views.species', [str(self.id)]) class Affiliation(models.Model): name = models.CharField(max_length=256, db_index=True, verbose_name='Name') @@ -368,7 +367,7 @@ class Library(models.Model): @models.permalink def get_absolute_url(self): - return ('htsworkflow.frontend.samples.views.library_to_flowcells', [str(self.id)]) + return ('samples.views.library_to_flowcells', [str(self.id)]) def get_admin_url(self): return urlresolvers.reverse('admin:samples_library_change', diff --git a/htsworkflow/frontend/samples/results.py b/samples/results.py similarity index 100% rename from htsworkflow/frontend/samples/results.py rename to samples/results.py diff --git a/htsworkflow/frontend/samples/test_samples.py b/samples/test_samples.py similarity index 98% rename from htsworkflow/frontend/samples/test_samples.py rename to samples/test_samples.py index 38e0dc2..b11fb94 100644 --- a/htsworkflow/frontend/samples/test_samples.py +++ b/samples/test_samples.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + import datetime try: @@ -11,17 +13,11 @@ from django.test.utils import setup_test_environment, \ from django.db import connection from django.conf import settings -from htsworkflow.frontend.samples.models import \ - Affiliation, \ - ExperimentType, \ - Species, \ - Library +from .models import Affiliation, ExperimentType, Species, Library -from htsworkflow.frontend.samples.views import \ - library_dict, \ - library_json +from .views import library_dict, library_json -from htsworkflow.frontend.auth import apidata +from htsworkflow.auth import apidata from htsworkflow.util.conversion import unicode_or_none from htsworkflow.util.ethelp import validate_xhtml diff --git a/samples/urls.py b/samples/urls.py new file mode 100644 index 0000000..3d09dd4 --- /dev/null +++ b/samples/urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import patterns, url + +urlpatterns = patterns('samples.views', + # View livrary list + url(r'^$', 'library'), + url(r'^not_run/$', 'library_not_run'), + url(r'^(?P\w+)/$', + 'library_to_flowcells'), + + url(r"^library/(?P\w+)/json$", 'library_json'), + url(r"^species/(?P\w+)/json$", 'species_json'), + url(r"^species/(?P\w+)$", 'species'), + url(r"^antibody/$", 'antibodies'), +) diff --git a/htsworkflow/frontend/samples/views.py b/samples/views.py similarity index 97% rename from htsworkflow/frontend/samples/views.py rename to samples/views.py index fcd5314..3e35898 100644 --- a/htsworkflow/frontend/samples/views.py +++ b/samples/views.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + # Create your views here. import StringIO import logging @@ -18,14 +20,14 @@ from django.template.loader import get_template from django.contrib.auth.decorators import login_required from django.conf import settings -from htsworkflow.frontend.auth import require_api_key -from htsworkflow.frontend.experiments.models import FlowCell, Lane, LANE_STATUS_MAP -from htsworkflow.frontend.experiments.admin import LaneOptions -from htsworkflow.frontend.samples.changelist import HTSChangeList -from htsworkflow.frontend.samples.models import Antibody, Library, Species, HTSUser -from htsworkflow.frontend.samples.admin import LibraryOptions -from htsworkflow.frontend.samples.results import get_flowcell_result_dict -from htsworkflow.frontend.bcmagic.forms import BarcodeMagicForm +from htsworkflow.auth import require_api_key +from experiments.models import FlowCell, Lane, LANE_STATUS_MAP +from experiments.admin import LaneOptions +from .changelist import HTSChangeList +from .models import Antibody, Library, Species, HTSUser +from .admin import LibraryOptions +from .results import get_flowcell_result_dict +from bcmagic.forms import BarcodeMagicForm from htsworkflow.pipelines import runfolder from htsworkflow.pipelines.eland import ResultLane from htsworkflow.pipelines.samplekey import SampleKey -- 2.30.2