From 8a8b88ff113bb82ff862edd55ed71aba82ffaa5f Mon Sep 17 00:00:00 2001 From: Rami Rauch Date: Thu, 14 Aug 2008 16:48:42 +0000 Subject: [PATCH] removed eland_config --- gaworkflow/frontend/eland_config/__init__.py | 0 gaworkflow/frontend/eland_config/forms.py | 163 -------- gaworkflow/frontend/eland_config/models.py | 3 - gaworkflow/frontend/eland_config/urls.py | 10 - gaworkflow/frontend/eland_config/views.py | 413 ------------------- gaworkflow/frontend/fctracker/models.py | 137 ++---- gaworkflow/frontend/settings.py | 2 +- gaworkflow/frontend/urls.py | 16 +- 8 files changed, 39 insertions(+), 705 deletions(-) delete mode 100644 gaworkflow/frontend/eland_config/__init__.py delete mode 100644 gaworkflow/frontend/eland_config/forms.py delete mode 100644 gaworkflow/frontend/eland_config/models.py delete mode 100644 gaworkflow/frontend/eland_config/urls.py delete mode 100644 gaworkflow/frontend/eland_config/views.py diff --git a/gaworkflow/frontend/eland_config/__init__.py b/gaworkflow/frontend/eland_config/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gaworkflow/frontend/eland_config/forms.py b/gaworkflow/frontend/eland_config/forms.py deleted file mode 100644 index 2488359..0000000 --- a/gaworkflow/frontend/eland_config/forms.py +++ /dev/null @@ -1,163 +0,0 @@ -from django import newforms as forms -from django.newforms.util import ErrorList - - -SPECIES_LIST = [#('--choose--', '--Choose--'), - ('hg18', 'Homo sapiens (Hg18)'), - ('Mm8', 'Mus musculus (Mm8)'), - ('arabv6', 'Arabadopsis Thaliana v6'), - ('other', 'Other species (Include in description)')] - - -class DivErrorList(ErrorList): - def __unicode__(self): - return self.as_divs() - - def as_divs(self): - if not self: return u'' - return u'
%s
' % (''.join([u'
%s
' % e for e in self])) - - - -class ConfigForm(forms.Form): - - flow_cell_number = forms.CharField(min_length=2) - run_date = forms.DateTimeField() - advanced_run = forms.BooleanField(required=False) - read_length = forms.IntegerField(min_value=1, initial=32) - #eland_repeat = forms.BooleanField() - - #needs a for loop or something to allow for n configurations - #analysis_type = forms.ChoiceField(choices=[('eland','eland')]) - lane1_species = forms.ChoiceField(choices=SPECIES_LIST) - lane1_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane2_species = forms.ChoiceField(choices=SPECIES_LIST) - lane2_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane3_species = forms.ChoiceField(choices=SPECIES_LIST) - lane3_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane4_species = forms.ChoiceField(choices=SPECIES_LIST) - lane4_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane5_species = forms.ChoiceField(choices=SPECIES_LIST) - lane5_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane6_species = forms.ChoiceField(choices=SPECIES_LIST) - lane6_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane7_species = forms.ChoiceField(choices=SPECIES_LIST) - lane7_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - lane8_species = forms.ChoiceField(choices=SPECIES_LIST) - lane8_description = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) - - notes = forms.CharField(widget=forms.Textarea(attrs={'cols':'70'}), required=False) - - #lane_specific_read_length = forms.IntegerField(min_value=1) - - #eland_genome_lanes = forms.MultipleChoiceField(choices=[('lane1','1'), - # ('lane2','2'), - # ('lane3','3'), - # ('lane4','4'), - # ('lane5','5'), - # ('lane6','6'), - # ('lane7','7'), - # ('lane8','8') ]) - - #eland_genome = forms.ChoiceField(choices=) - - #use_bases_lanes = forms.MultipleChoiceField(choices=[('lane1','1'), - # ('lane2','2'), - # ('lane3','3'), - # ('lane4','4'), - # ('lane5','5'), - # ('lane6','6'), - # ('lane7','7'), - # ('lane8','8') ]) - - #use_bases_mask = forms.CharField() - - #sequence_format = forms.ChoiceField(choices=[('scarf', 'scarf')]) - - - - #subject = forms.CharField(max_length=100) - #message = forms.CharField() - #sender = forms.EmailField() - #cc_myself = forms.BooleanField() - - def as_custom(self): - """ - Displays customized html output - """ - html = [] - - fcn = self['flow_cell_number'] - - html.append(fcn.label_tag() + ': ' + str(fcn) + str(fcn.errors) + '
') - - run_date = self['run_date'] - html.append(run_date.label_tag() + ': ' + str(run_date) + str(run_date.errors) + '
') - - arun = self['advanced_run'] - html.append(arun.label_tag() + ': ' + str(arun) + str(arun.errors) + '
') - - rl = self['read_length'] - html.append(rl.label_tag() + ': ' + str(rl) + str(rl.errors) + '

') - - html.append('') - html.append(' ' \ - % ('Lane', 'Species', 'Description')) - - l1s = self['lane1_species'] - l1d = self['lane1_description'] - html.append(' ' \ - % ('1', str(l1s), str(l1s.errors), str(l1d), str(l1d.errors))) - - l2s = self['lane2_species'] - l2d = self['lane2_description'] - html.append(' ' \ - % ('2', str(l2s), str(l2s.errors), str(l2d), str(l2d.errors))) - - l3s = self['lane3_species'] - l3d = self['lane3_description'] - html.append(' ' \ - % ('3', str(l3s), str(l3s.errors), str(l3d), str(l3d.errors))) - - l4s = self['lane4_species'] - l4d = self['lane4_description'] - html.append(' ' \ - % ('4', str(l4s), str(l4s.errors), str(l4d), str(l4d.errors))) - - l5s = self['lane5_species'] - l5d = self['lane5_description'] - html.append(' ' \ - % ('5', str(l5s), str(l5s.errors), str(l5d), str(l5d.errors))) - - l6s = self['lane6_species'] - l6d = self['lane6_description'] - html.append(' ' \ - % ('6', str(l6s), str(l6s.errors), str(l6d), str(l6d.errors))) - - l7s = self['lane7_species'] - l7d = self['lane7_description'] - html.append(' ' \ - % ('7', str(l7s), str(l7s.errors), str(l7d), str(l7d.errors))) - - l8s = self['lane8_species'] - l8d = self['lane8_description'] - html.append(' ' \ - % ('8', str(l8s), str(l8s.errors), str(l8d), str(l8d.errors))) - - html.append('
%s%s%s
%s%s %s%s %s
%s%s %s%s %s
%s%s %s%s %s
%s%s %s%s %s
%s%s %s%s %s
%s%s %s%s %s
%s%s %s%s %s
%s%s %s%s %s

') - - notes = self['notes'] - html.append('

Notes:

') - html.append(' %s
' % (str(notes))) - - return '\n'.join(html) - - - \ No newline at end of file diff --git a/gaworkflow/frontend/eland_config/models.py b/gaworkflow/frontend/eland_config/models.py deleted file mode 100644 index 71a8362..0000000 --- a/gaworkflow/frontend/eland_config/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/gaworkflow/frontend/eland_config/urls.py b/gaworkflow/frontend/eland_config/urls.py deleted file mode 100644 index 2eeee70..0000000 --- a/gaworkflow/frontend/eland_config/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.conf.urls.defaults import * - -urlpatterns = patterns('', - # Example: - - (r'^(?P\w+)/$', 'gaworkflow.frontend.eland_config.views.config'), - (r'^$', 'gaworkflow.frontend.eland_config.views.config'), - #(r'^$', 'gaworkflow.frontend.eland_config.views.index') - -) diff --git a/gaworkflow/frontend/eland_config/views.py b/gaworkflow/frontend/eland_config/views.py deleted file mode 100644 index f23f7ae..0000000 --- a/gaworkflow/frontend/eland_config/views.py +++ /dev/null @@ -1,413 +0,0 @@ -from django.http import HttpResponse -from django.shortcuts import render_to_response -from django.core.exceptions import ObjectDoesNotExist - -from gaworkflow.frontend.eland_config import forms -from gaworkflow.frontend import settings -from gaworkflow.frontend.fctracker import models - -import os -import glob -# Create your views here. - - -def _validate_input(data): - #if data.find('..') == -1 or data.find('/') == -1 or data.find('\\') == -1: - return data.replace('..', '').replace('/', '_').replace('\\', '_') - -#def contact(request): -# if request.method == 'POST': -# form = ContactForm(request.POST) -# if form.is_valid(): -# # Do form processing here... -# return HttpResponseRedirect('/url/on_success/') -# else: -# form = ContactForm() -# return - - - -#def _saveConfigFile(form): -# """ -# Given a valid form, save eland config to file based on flowcell number. -# """ -# assert form.is_valid() -# -# clean_data = form.cleaned_data -# flowcell = clean_data['flow_cell_number'].replace('/','_').replace('..', '__') -# -# file_path = os.path.join(settings.UPLOADTO_CONFIG_FILE, flowcell) -# -# f = open(file_path, 'w') -# cfg = generateElandConfig(form) -# f.write(cfg) -# f.close() -# -# -#def _saveToDb(form): -# """ -# Save info to the database. -# """ -# clean_data = form.cleaned_data -# -# fc_id = clean_data['flow_cell_number'] -# -# try: -# fc = models.FlowCell.objects.get(flowcell_id=fc_id) -# except models.FlowCell.DoesNotExist: -# fc = models.FlowCell() -# -# fc.flowcell_id = fc_id -# fc.run_date = clean_data['run_date'] -# -# #LANE 1 -# fc.lane1_sample = clean_data['lane1_description'] -# species_name = clean_data['lane1_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane1_species = specie -# -# #LANE 2 -# fc.lane2_sample = clean_data['lane2_description'] -# species_name = clean_data['lane2_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane2_species = specie -# -# #LANE 3 -# fc.lane3_sample = clean_data['lane3_description'] -# species_name = clean_data['lane3_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane3_species = specie -# -# #LANE 4 -# fc.lane4_sample = clean_data['lane4_description'] -# species_name = clean_data['lane4_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane4_species = specie -# -# #LANE 5 -# fc.lane5_sample = clean_data['lane5_description'] -# species_name = clean_data['lane5_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane5_species = specie -# -# #LANE 6 -# fc.lane6_sample = clean_data['lane6_description'] -# species_name = clean_data['lane6_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane6_species = specie -# -# #LANE 7 -# fc.lane7_sample = clean_data['lane7_description'] -# species_name = clean_data['lane7_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane7_species = specie -# -# #LANE 8 -# fc.lane8_sample = clean_data['lane8_description'] -# species_name = clean_data['lane8_species'] -# try: -# specie = models.Specie.objects.get(scientific_name=species_name) -# except models.Specie.DoesNotExist: -# specie = models.Specie(scientific_name=species_name) -# specie.save() -# fc.lane8_species = specie -# -# fc.notes = clean_data['notes'] -# -# fc.save() -# -# return fc -# -# -#def generateElandConfig(form): -# data = [] -# -# form = form.cleaned_data -# -# BASE_DIR = '/data-store01/compbio/genomes' -# -# data.append("# FLOWCELL: %s" % (form['flow_cell_number'])) -# data.append("#") -# -# notes = form['notes'].replace('\r\n', '\n').replace('\r', '\n') -# notes = notes.replace('\n', '\n# ') -# data.append("# NOTES:") -# data.append("# %s\n#" % (notes)) -# -# #Convert all newline conventions to unix style -# l1d = form['lane1_description'].replace('\r\n', '\n').replace('\r', '\n') -# l2d = form['lane2_description'].replace('\r\n', '\n').replace('\r', '\n') -# l3d = form['lane3_description'].replace('\r\n', '\n').replace('\r', '\n') -# l4d = form['lane4_description'].replace('\r\n', '\n').replace('\r', '\n') -# l5d = form['lane5_description'].replace('\r\n', '\n').replace('\r', '\n') -# l6d = form['lane6_description'].replace('\r\n', '\n').replace('\r', '\n') -# l7d = form['lane7_description'].replace('\r\n', '\n').replace('\r', '\n') -# l8d = form['lane8_description'].replace('\r\n', '\n').replace('\r', '\n') -# -# # Turn new lines into indented commented newlines -# l1d = l1d.replace('\n', '\n# ') -# l2d = l2d.replace('\n', '\n# ') -# l3d = l3d.replace('\n', '\n# ') -# l4d = l4d.replace('\n', '\n# ') -# l5d = l5d.replace('\n', '\n# ') -# l6d = l6d.replace('\n', '\n# ') -# l7d = l7d.replace('\n', '\n# ') -# l8d = l8d.replace('\n', '\n# ') -# -# data.append("# Lane1: %s" % (l1d)) -# data.append("# Lane2: %s" % (l2d)) -# data.append("# Lane3: %s" % (l3d)) -# data.append("# Lane4: %s" % (l4d)) -# data.append("# Lane5: %s" % (l5d)) -# data.append("# Lane6: %s" % (l6d)) -# data.append("# Lane7: %s" % (l7d)) -# data.append("# Lane8: %s" % (l8d)) -# -# #data.append("GENOME_DIR %s" % (BASE_DIR)) -# #data.append("CONTAM_DIR %s" % (BASE_DIR)) -# read_length = form['read_length'] -# data.append("READ_LENGTH %d" % (read_length)) -# #data.append("ELAND_REPEAT") -# data.append("ELAND_MULTIPLE_INSTANCES 8") -# -# #Construct genome dictionary to figure out what lanes to put -# # in the config file. -# genome_dict = {} -# l1s = form['lane1_species'] -# genome_dict.setdefault(l1s, []).append('1') -# l2s = form['lane2_species'] -# genome_dict.setdefault(l2s, []).append('2') -# l3s = form['lane3_species'] -# genome_dict.setdefault(l3s, []).append('3') -# l4s = form['lane4_species'] -# genome_dict.setdefault(l4s, []).append('4') -# l5s = form['lane5_species'] -# genome_dict.setdefault(l5s, []).append('5') -# l6s = form['lane6_species'] -# genome_dict.setdefault(l6s, []).append('6') -# l7s = form['lane7_species'] -# genome_dict.setdefault(l7s, []).append('7') -# l8s = form['lane8_species'] -# genome_dict.setdefault(l8s, []).append('8') -# -# genome_list = genome_dict.keys() -# genome_list.sort() -# -# #Loop through and create entries for each species. -# for genome in genome_list: -# lanes = ''.join(genome_dict[genome]) -# data.append('%s:ANALYSIS eland' % (lanes)) -# data.append('%s:READ_LENGTH %s' % (lanes, read_length)) -# data.append('%s:ELAND_GENOME %s' % (lanes, os.path.join(BASE_DIR, genome))) -# data.append('%s:USE_BASES %s' % (lanes, 'Y'*int(read_length))) -# -# data.append('SEQUENCE_FORMAT --scarf') -# -# return '\n'.join(data) - - -def getElandConfig(flowcell, regenerate=False): - - file_path = os.path.join(settings.UPLOADTO_CONFIG_FILE, flowcell) - - #If we are regenerating the config file, skip - # reading of existing file. If the file doesn't - # exist, try to generate it form the DB. - if not regenerate and os.path.isfile(file_path): - f = open(file_path, 'r') - data = f.read() - f.close() - return data - - try: - fcObj = models.FlowCell.objects.get(flowcell_id__iexact=flowcell) - except ObjectDoesNotExist: - return None - - data = [] - - #form = form.cleaned_data - - BASE_DIR = '/data-store01/compbio/genomes' - - data.append("# FLOWCELL: %s" % (fcObj.flowcell_id)) - data.append("#") - - notes = fcObj.notes.replace('\r\n', '\n').replace('\r', '\n') - notes = notes.replace('\n', '\n# ') - data.append("# NOTES:") - data.append("# %s\n#" % (notes)) - - #Convert all newline conventions to unix style - l1d = str(fcObj.lane_1_library.library_id) + '|' \ - + fcObj.lane_1_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - l2d = str(fcObj.lane_2_library.library_id) + '|' \ - + fcObj.lane_2_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - l3d = str(fcObj.lane_3_library.library_id) + '|' \ - + fcObj.lane_3_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - l4d = str(fcObj.lane_4_library.library_id) + '|' \ - + fcObj.lane_4_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - - l5d = str(fcObj.lane_5_library.library_id) + '|' \ - + fcObj.lane_5_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - l6d = str(fcObj.lane_6_library.library_id) + '|' \ - + fcObj.lane_6_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - l7d = str(fcObj.lane_7_library.library_id) + '|' \ - + fcObj.lane_7_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - l8d = str(fcObj.lane_8_library.library_id) + '|' \ - + fcObj.lane_8_library.library_name.replace('\r\n', '\n').replace('\r', '\n') - - # Turn new lines into indented commented newlines - l1d = l1d.replace('\n', '\n# ') - l2d = l2d.replace('\n', '\n# ') - l3d = l3d.replace('\n', '\n# ') - l4d = l4d.replace('\n', '\n# ') - l5d = l5d.replace('\n', '\n# ') - l6d = l6d.replace('\n', '\n# ') - l7d = l7d.replace('\n', '\n# ') - l8d = l8d.replace('\n', '\n# ') - - data.append("# Lane1: %s" % (l1d)) - data.append("# Lane2: %s" % (l2d)) - data.append("# Lane3: %s" % (l3d)) - data.append("# Lane4: %s" % (l4d)) - data.append("# Lane5: %s" % (l5d)) - data.append("# Lane6: %s" % (l6d)) - data.append("# Lane7: %s" % (l7d)) - data.append("# Lane8: %s" % (l8d)) - - #data.append("GENOME_DIR %s" % (BASE_DIR)) - #data.append("CONTAM_DIR %s" % (BASE_DIR)) - read_length = fcObj.read_length - data.append("READ_LENGTH %d" % (read_length)) - #data.append("ELAND_REPEAT") - data.append("ELAND_MULTIPLE_INSTANCES 8") - - #Construct genome dictionary to figure out what lanes to put - # in the config file. - genome_dict = {} - - #l1s = form['lane1_species'] - l1s = fcObj.lane_1_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_1_library.library_species.use_genome_build - genome_dict.setdefault(l1s, []).append('1') - l2s = fcObj.lane_2_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_2_library.library_species.use_genome_build - genome_dict.setdefault(l2s, []).append('2') - l3s = fcObj.lane_3_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_3_library.library_species.use_genome_build - genome_dict.setdefault(l3s, []).append('3') - l4s = fcObj.lane_4_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_4_library.library_species.use_genome_build - genome_dict.setdefault(l4s, []).append('4') - l5s = fcObj.lane_5_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_5_library.library_species.use_genome_build - genome_dict.setdefault(l5s, []).append('5') - l6s = fcObj.lane_6_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_6_library.library_species.use_genome_build - genome_dict.setdefault(l6s, []).append('6') - l7s = fcObj.lane_7_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_7_library.library_species.use_genome_build - genome_dict.setdefault(l7s, []).append('7') - l8s = fcObj.lane_8_library.library_species.scientific_name #+ '|' + \ - #fcObj.lane_8_library.library_species.use_genome_build - genome_dict.setdefault(l8s, []).append('8') - - genome_list = genome_dict.keys() - genome_list.sort() - - #Loop through and create entries for each species. - for genome in genome_list: - lanes = ''.join(genome_dict[genome]) - data.append('%s:ANALYSIS eland' % (lanes)) - data.append('%s:READ_LENGTH %s' % (lanes, read_length)) - data.append('%s:ELAND_GENOME %s' % (lanes, '%%(%s)s' % (genome))) - data.append('%s:USE_BASES %s' % (lanes, 'Y'*int(read_length))) - - data.append('SEQUENCE_FORMAT --scarf') - - data = '\n'.join(data) - - f = open(file_path, 'w') - f.write(data) - f.close() - - return data - - - -def config(request, flowcell=None): - """ - Returns eland config file for a given flowcell number, - or returns a list of available flowcell numbers. - """ - - # Provide INDEX of available Flowcell config files. - if flowcell is None: - #Find all FC* config files and report an index html file - #fc_list = [ os.path.split(file_path)[1] for file_path in glob.glob(os.path.join(settings.UPLOADTO_CONFIG_FILE, 'FC*')) ] - fc_list = [ fc.flowcell_id for fc in models.FlowCell.objects.all() ] - - #Convert FC* list to html links - fc_html = [ '%s' % (fc_name, fc_name) for fc_name in fc_list ] - - return HttpResponse('
'.join(fc_html)) - - #FIXME: Should validate flowcell input before using. - flowcell = _validate_input(flowcell) - cfg = getElandConfig(flowcell, regenerate=True) - - if not cfg: - return HttpResponse("Hmm, config file for %s does not seem to exist." % (flowcell)) - - - return HttpResponse(cfg, mimetype="text/plain") - - - - -#def index(request): -# """ -# Return a form for filling out information about the flowcell -# """ -# if request.method == 'POST': -# form = forms.ConfigForm(request.POST, error_class=forms.DivErrorList) -# if form.is_valid(): -# #cfg = generateElandConfig(form) -# _saveConfigFile(form) -# _saveToDb(form) -# return HttpResponse("Eland Config Saved!", mimetype="text/plain") -# else: -# return render_to_response('config_form.html', {'form': form }) -# -# else: -# fm = forms.ConfigForm(error_class=forms.DivErrorList) -# return render_to_response('config_form.html', {'form': fm }) diff --git a/gaworkflow/frontend/fctracker/models.py b/gaworkflow/frontend/fctracker/models.py index 86046e4..d6921ea 100644 --- a/gaworkflow/frontend/fctracker/models.py +++ b/gaworkflow/frontend/fctracker/models.py @@ -1,6 +1,22 @@ from django.db import models from gaworkflow.frontend import settings +class Primer(models.Model): + primer_name = models.CharField(max_length=100, db_index=True) + primer_seq = models.CharField(max_length=50, blank=True, null=True) + notes = models.TextField(blank=True) + def __str__(self): + return '%s' % (self.primer_name) + class Meta: + ordering = ["primer_name"] + class Admin: + list_display = ('primer_name','primer_seq','notes') + fields = ( + (None, { + 'fields': (('primer_name'),('primer_seq'),('notes')) + }), + ) + class Antibody(models.Model): antigene = models.CharField(max_length=500, db_index=True) catalog = models.CharField(max_length=50, unique=True, db_index=True) @@ -32,6 +48,7 @@ class Cellline(models.Model): ordering = ["cellline_name"] class Admin: + list_display = ('cellline_name','notes') fields = ( (None, { 'fields': (('cellline_name'),('notes'),) @@ -48,6 +65,7 @@ class Condition(models.Model): ordering = ["condition_name"] class Admin: + list_display = ('condition_name','notes') fields = ( (None, { 'fields': (('condition_name'),('notes'),) @@ -57,7 +75,7 @@ class Condition(models.Model): class Species(models.Model): scientific_name = models.CharField(max_length=256, unique=False, db_index=True, core=True) common_name = models.CharField(max_length=256, blank=True) - use_genome_build = models.CharField(max_length=100, blank=True) #blank=False, null=False) + use_genome_build = models.CharField(max_length=100, blank=False, null=False) def __str__(self): return '%s (%s)|%s' % (self.scientific_name, self.common_name, self.use_genome_build) @@ -91,19 +109,20 @@ class Library(models.Model): ) experiment_type = models.CharField(max_length=50, choices=EXPERIMENT_TYPES, default='ChIP-seq') - made_by = models.CharField(max_length=50, blank=True) creation_date = models.DateField(blank=True, null=True) - made_for = models.CharField(max_length=50, blank=True) - made_by = models.CharField(max_length=50, blank=True) + made_for = models.CharField(max_length=50, blank=True,verbose_name = 'ChIP/DNA/RNA Made By') + made_by = models.CharField(max_length=50, blank=True,verbose_name = 'Library Made By') PROTOCOL_END_POINTS = ( ('Completed','Completed'), ('?', 'Unknown'), ('Sample', 'Raw sample'), - ('Gel', 'Ran gel'), - ('1A', 'Gel purification'), - ('2A', '2nd PCR'), ('Progress', 'In progress'), + ('1A', 'Ligation, then gel'), + ('PCR', 'Ligation, then PCR'), + ('1Ab', 'Ligation, PCR, then gel'), + ('1Aa', 'Ligation, gel, then PCR'), + ('2A', 'Ligation, PCR, gel, PCR'), ) stopping_point = models.CharField(max_length=50, choices=PROTOCOL_END_POINTS, default='Completed') amplified_from_sample = models.ForeignKey('self', blank=True, null=True) @@ -111,7 +130,7 @@ class Library(models.Model): undiluted_concentration = models.DecimalField("Template concentr. (ng/ul)",max_digits=5, decimal_places=2, blank=True, null=True) ten_nM_dilution = models.BooleanField() successful_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=True, null=True) - avg_lib_size = models.IntegerField() + avg_lib_size = models.IntegerField(default=225, blank=True, null=True) notes = models.TextField(blank=True) def __str__(self): @@ -125,10 +144,10 @@ class Library(models.Model): date_hierarchy = "creation_date" save_as = True save_on_top = True - search_fields = ['library_name'] - list_display = ('library_id', 'library_name', 'made_by', 'creation_date', 'ten_nM_dilution', 'stopping_point', 'successful_pM') + search_fields = ['library_name', 'library_id','made_by','made_for','antibody__antigene','antibody__catalog','antibody__antibodies','antibody__source','cell_line__cellline_name','library_species__scientific_name','library_species__common_name','library_species__use_genome_build'] + list_display = ('library_id', 'library_name','experiment_type','cell_line','made_by','creation_date') list_display_links = ('library_id', 'library_name') - list_filter = ('stopping_point', 'ten_nM_dilution', 'library_species', 'made_for', 'made_by') + list_filter = ('experiment_type','library_species','made_for', 'made_by') fields = ( (None, { 'fields': (('library_id', 'library_name'),('library_species'),('experiment_type'),('cell_line','condition','antibody'),) @@ -137,99 +156,3 @@ class Library(models.Model): 'fields' : (('made_for', 'made_by', 'creation_date'), ('stopping_point', 'amplified_from_sample'), ('avg_lib_size','undiluted_concentration', 'ten_nM_dilution', 'successful_pM'), 'notes',) }), ) - -class FlowCell(models.Model): - - flowcell_id = models.CharField(max_length=20, unique=True, db_index=True, core=True) - run_date = models.DateTimeField(core=True) - advanced_run = models.BooleanField(default=False) - read_length = models.IntegerField(default=32) #Stanford is currenlty 25 - - lane_1_library = models.ForeignKey(Library, related_name="lane_1_library") - lane_2_library = models.ForeignKey(Library, related_name="lane_2_library") - lane_3_library = models.ForeignKey(Library, related_name="lane_3_library") - lane_4_library = models.ForeignKey(Library, related_name="lane_4_library") - lane_5_library = models.ForeignKey(Library, related_name="lane_5_library") - lane_6_library = models.ForeignKey(Library, related_name="lane_6_library") - lane_7_library = models.ForeignKey(Library, related_name="lane_7_library") - lane_8_library = models.ForeignKey(Library, related_name="lane_8_library") - - lane_1_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_2_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_3_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_4_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_5_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_6_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_7_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - lane_8_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=2.5) - - lane_1_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_2_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_3_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_4_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_5_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_6_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_7_cluster_estimate = models.IntegerField(blank=True, null=True) - lane_8_cluster_estimate = models.IntegerField(blank=True, null=True) - - #Machine Names - CLUSTER_MAC = ( - ('M304','M304'), - ('R349','R349'), - ('Tinkerbell','Tinkerbell'), - ('BitBit','BitBit'), - ) - - SEQ_MAC = ( - ('EAS149','EAS149'), - ('EAS46','EAS46'), - ('EAS45','Paris'), - ('Britney','Britney'), - ) - - cluster_mac_id = models.CharField(max_length=50, choices=CLUSTER_MAC, default='M304') - seq_mac_id = models.CharField(max_length=50, choices=SEQ_MAC, verbose_name = 'Sequencer', default='EAS149') - - notes = models.TextField(blank=True) - - def __str__(self): - #return '%s (%s)' % (self.flowcell_id, self.run_date) - return '%s' % (self.flowcell_id) - - - def Lanes(self): - return '
1)%s2)%s3)%s4)%s5)%s6)%s7)%s8)%s
' % (self.lane_1_library,self.lane_2_library,self.lane_3_library,self.lane_4_library,self.lane_5_library,self.lane_6_library,self.lane_7_library,self.lane_8_library) - Lanes.allow_tags = True - - class Meta: - ordering = ["-run_date"] - - class Admin: - save_on_top = True - date_hierarchy = "run_date" - save_on_top = True - search_fields = ['lane_1_library', 'lane_2_library', 'lane_3_library', 'lane_4_library', 'lane_5_library', 'lane_6_library', 'lane_7_library', 'lane_8_library'] - list_display = ('flowcell_id','seq_mac_id','run_date', 'Lanes') - list_filter = ('seq_mac_id',) - fields = ( - (None, { - 'fields': ('run_date', ('flowcell_id','cluster_mac_id','seq_mac_id'), ('read_length'),) - }), - ('Lanes:', { - 'fields' : (('lane_1_library', 'lane_1_pM', 'lane_1_cluster_estimate'), ('lane_2_library', 'lane_2_pM', 'lane_2_cluster_estimate'), ('lane_3_library', 'lane_3_pM', 'lane_3_cluster_estimate'), ('lane_4_library', 'lane_4_pM', 'lane_4_cluster_estimate'), ('lane_5_library', 'lane_5_pM', 'lane_5_cluster_estimate'), ('lane_6_library', 'lane_6_pM', 'lane_6_cluster_estimate'), ('lane_7_library', 'lane_7_pM', 'lane_7_cluster_estimate'), ('lane_8_library', 'lane_8_pM', 'lane_8_cluster_estimate'),) - }), - (None, { - 'fields' : ('notes',) - }), - ) - -#class ElandResult(models.Model): -# -# class Admin: pass -# -# flow_cell = models.ForeignKey(FlowCell) -# config_file = models.FileField(upload_to=settings.UPLOADTO_CONFIG_FILE) -# eland_result_pack = models.FileField(upload_to=settings.UPLOADTO_ELAND_RESULT_PACKS) -# bed_file_pack = models.FileField(upload_to=settings.UPLOADTO_BED_PACKS) -# -# notes = models.TextField(blank=True) diff --git a/gaworkflow/frontend/settings.py b/gaworkflow/frontend/settings.py index a327ce8..938ed4e 100644 --- a/gaworkflow/frontend/settings.py +++ b/gaworkflow/frontend/settings.py @@ -93,7 +93,7 @@ INSTALLED_APPS = ( # Project specific settings ALLOWED_IPS = {"74.51.115.100":"HudsonAlpha","64.89.97.100":"HudsonAlpha","127.0.0.1":"Localhost"} -ALLOWED_ANALYS_IPS = {"171.65.76.194":"Stanford Analysis 1"} +ALLOWED_ANALYS_IPS = {"171.65.76.194":"Stanford Analysis 1","127.0.0.1":"Localhost"} #UPLOADTO_HOME = os.path.abspath('../../uploads') #UPLOADTO_CONFIG_FILE = os.path.join(UPLOADTO_HOME, 'eland_config') #UPLOADTO_ELAND_RESULT_PACKS = os.path.join(UPLOADTO_HOME, 'eland_results') diff --git a/gaworkflow/frontend/urls.py b/gaworkflow/frontend/urls.py index 118cac5..4347532 100644 --- a/gaworkflow/frontend/urls.py +++ b/gaworkflow/frontend/urls.py @@ -1,18 +1,18 @@ from django.conf.urls.defaults import * # Databrowser: -from django.contrib import databrowse -from fctracker.models import Library, FlowCell -databrowse.site.register(Library) -databrowse.site.register(FlowCell) +#from django.contrib import databrowse +#from fctracker.models import Library +#databrowse.site.register(Library) +#databrowse.site.register(FlowCell) urlpatterns = patterns('', - # Base: - #(r'^eland_config/', include('gaworkflow.frontend.eland_config.urls')), # Admin: (r'^admin/', include('django.contrib.admin.urls')), # ExpTrack: (r'^exp_track/', include('gaworkflow.frontend.exp_track.et_urls')), - # Databrowser: - (r'^databrowse/(.*)', databrowse.site.root), + # AnalysTrack: + (r'^analys_track/', include('gaworkflow.frontend.analys_track.an_urls')), + # Report Views: + # (r'^reports/', include('gaworkflow.frontend....urls')), ) -- 2.30.2