+++ /dev/null
-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'<div class="errorlist">%s</div>' % (''.join([u'<div class="error">%s</div>' % 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) + '<br />')
-
- run_date = self['run_date']
- html.append(run_date.label_tag() + ': ' + str(run_date) + str(run_date.errors) + '<br />')
-
- arun = self['advanced_run']
- html.append(arun.label_tag() + ': ' + str(arun) + str(arun.errors) + '<br />')
-
- rl = self['read_length']
- html.append(rl.label_tag() + ': ' + str(rl) + str(rl.errors) + '<br /><br />')
-
- html.append('<table border="0">')
- html.append(' <tr><td>%s</td><td>%s</td><td>%s</td></tr>' \
- % ('Lane', 'Species', 'Description'))
-
- l1s = self['lane1_species']
- l1d = self['lane1_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('1', str(l1s), str(l1s.errors), str(l1d), str(l1d.errors)))
-
- l2s = self['lane2_species']
- l2d = self['lane2_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('2', str(l2s), str(l2s.errors), str(l2d), str(l2d.errors)))
-
- l3s = self['lane3_species']
- l3d = self['lane3_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('3', str(l3s), str(l3s.errors), str(l3d), str(l3d.errors)))
-
- l4s = self['lane4_species']
- l4d = self['lane4_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('4', str(l4s), str(l4s.errors), str(l4d), str(l4d.errors)))
-
- l5s = self['lane5_species']
- l5d = self['lane5_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('5', str(l5s), str(l5s.errors), str(l5d), str(l5d.errors)))
-
- l6s = self['lane6_species']
- l6d = self['lane6_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('6', str(l6s), str(l6s.errors), str(l6d), str(l6d.errors)))
-
- l7s = self['lane7_species']
- l7d = self['lane7_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('7', str(l7s), str(l7s.errors), str(l7d), str(l7d.errors)))
-
- l8s = self['lane8_species']
- l8d = self['lane8_description']
- html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
- % ('8', str(l8s), str(l8s.errors), str(l8d), str(l8d.errors)))
-
- html.append('</table><br />')
-
- notes = self['notes']
- html.append('<p>Notes:</p>')
- html.append(' %s<br />' % (str(notes)))
-
- return '\n'.join(html)
-
-
-
\ No newline at end of file
+++ /dev/null
-from django.db import models
-
-# Create your models here.
+++ /dev/null
-from django.conf.urls.defaults import *
-
-urlpatterns = patterns('',
- # Example:
-
- (r'^config/(?P<flowcell>FC\d+)/$', 'elandifier.eland_config.views.config'),
- (r'^config/$', 'elandifier.eland_config.views.config'),
- (r'^$', 'elandifier.eland_config.views.index')
-
-)
+++ /dev/null
-from django.http import HttpResponse
-from django.shortcuts import render_to_response
-from elandifier.eland_config import forms
-from elandifier import settings
-from elandifier.fctracker import models
-
-import os
-import glob
-# Create your views here.
-
-
-#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 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*')) ]
- #Convert FC* list to html links
- fc_html = [ '<a href="/elandifier/config/%s/">%s</a>' % (fc_name, fc_name) for fc_name in fc_list ]
- return HttpResponse('<br />'.join(fc_html))
-
- #FIXME: Should validate flowcell input before using.
- file_path = os.path.join(settings.UPLOADTO_CONFIG_FILE, flowcell)
-
- if not os.path.isfile(file_path):
- return HttpResponse("Hmm, config file for %s does not seem to exist. Maybe I don't exist either?" % (flowcell))
-
- f = open(file_path, 'r')
- cfg = f.read()
- f.close()
-
- 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 })
+++ /dev/null
-from django.db import models
-from elandifier import settings
-
-# Create your models here.
-
-class Species(models.Model):
-
- scientific_name = models.CharField(max_length=256, unique=True, db_index=True, core=True)
- common_name = models.CharField(max_length=256, blank=True)
-
- def __str__(self):
- return '%s (%s)' % (self.scientific_name, self.common_name)
-
- class Meta:
- verbose_name_plural = "species"
- ordering = ["scientific_name"]
-
- class Admin:
- fields = (
- (None, {
- 'fields': (('scientific_name', 'common_name'),)
- }),
- )
-
-class Library(models.Model):
-
- library_id = models.IntegerField(primary_key=True, db_index=True, core=True)
- library_name = models.CharField(max_length=100, unique=True, core=True)
- library_species = models.ForeignKey(Species, core=True)
- RNAseq = models.BooleanField()
-
- made_by = models.CharField(max_length=50, blank=True, default="Lorian")
- creation_date = models.DateField(blank=True, null=True)
- made_for = models.CharField(max_length=50, blank=True)
-
- PROTOCOL_END_POINTS = (
- ('?', 'Unknown'),
- ('Sample', 'Raw sample'),
- ('Gel', 'Ran gel'),
- ('1A', 'Gel purification'),
- ('2A', '2nd PCR'),
- ('Progress', 'In progress'),
- )
- stopping_point = models.CharField(max_length=50, choices=PROTOCOL_END_POINTS)
- amplified_from_sample = models.ForeignKey('self', blank=True, null=True)
-
- undiluted_concentration = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True)
- ten_nM_dilution = models.BooleanField()
- successful_pM = models.IntegerField(blank=True, null=True)
-
- notes = models.TextField(blank=True)
-
- def __str__(self):
- return '#%s: %s' % (self.library_id, self.library_name)
-
- class Meta:
- verbose_name_plural = "libraries"
- ordering = ["-library_id"]
-
- class Admin:
- date_hierarchy = "creation_date"
- save_as = True
- save_on_top = True
- search_fields = ['library_name']
- list_display = ('library_id', 'library_name', 'made_for', 'creation_date', 'ten_nM_dilution', 'stopping_point', 'successful_pM')
- list_display_links = ('library_id', 'library_name')
- list_filter = ('stopping_point', 'ten_nM_dilution', 'library_species', 'made_for', 'made_by')
- fields = (
- (None, {
- 'fields': (('library_id', 'library_name'), ('library_species', 'RNAseq'),)
- }),
- ('Creation Information:', {
- 'fields' : (('made_for', 'made_by', 'creation_date'), ('stopping_point', 'amplified_from_sample'), ('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)
-
- 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.IntegerField(default=4)
- lane_2_pM = models.IntegerField(default=4)
- lane_3_pM = models.IntegerField(default=4)
- lane_4_pM = models.IntegerField(default=4)
- lane_5_pM = models.IntegerField(default=4)
- lane_6_pM = models.IntegerField(default=4)
- lane_7_pM = models.IntegerField(default=4)
- lane_8_pM = models.IntegerField(default=4)
-
- 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)
-
- notes = models.TextField(blank=True)
-
- def __str__(self):
- return '%s (%s)' % (self.flowcell_id, self.run_date)
-
- class Meta:
- ordering = ["run_date"]
-
- class Admin:
- 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', 'run_date', 'lane_1_library', 'lane_2_library', 'lane_3_library', 'lane_4_library', 'lane_5_library', 'lane_6_library', 'lane_7_library', 'lane_8_library')
- fields = (
- (None, {
- 'fields': ('run_date', 'flowcell_id',)
- }),
- ('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)
+++ /dev/null
-# Create your views here.
+++ /dev/null
-#!/usr/bin/env python
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- execute_manager(settings)
+++ /dev/null
-import os
-
-# Django settings for elandifier project.
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
-DATABASE_NAME = '/home/lorian/Djangoproject/sequencer/elandifier/elandifier.db' # Or path to database file if using sqlite3.
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
-
-# Local time zone for this installation. Choices can be found here:
-# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
-# although not all variations may be possible on all operating systems.
-# If running in a Windows environment this must be set to the same as your
-# system time zone.
-TIME_ZONE = 'America/Los_Angeles'
-
-# Language code for this installation. All choices can be found here:
-# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
-# http://blogs.law.harvard.edu/tech/stories/storyReader$15
-LANGUAGE_CODE = 'en-us'
-
-SITE_ID = 1
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = True
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
-
-# URL that handles the media served from MEDIA_ROOT.
-# Example: "http://media.lawrence.com"
-MEDIA_URL = ''
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '(ekv^=gf(j9f(x25@a7r+8)hqlz%&_1!tw^75l%^041#vi=@4n'
-
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
-# 'django.template.loaders.eggs.load_template_source',
-)
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.middleware.doc.XViewMiddleware',
-)
-
-ROOT_URLCONF = 'elandifier.urls'
-
-TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
- "/home/king/proj/solexa/elandifier/templates"
-)
-
-INSTALLED_APPS = (
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'elandifier.eland_config',
- 'elandifier.fctracker',
- 'django.contrib.databrowse',
-)
-
-# Project specific settings
-UPLOADTO_HOME = '/home/king/proj/solexa/elandifier/uploads'
-UPLOADTO_CONFIG_FILE = os.path.join(UPLOADTO_HOME, 'eland_config')
-UPLOADTO_ELAND_RESULT_PACKS = os.path.join(UPLOADTO_HOME, 'eland_results')
-UPLOADTO_BED_PACKS = os.path.join(UPLOADTO_HOME, 'bed_packs')
-
+++ /dev/null
-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)
-
-urlpatterns = patterns('',
- # Base:
- (r'^elandifier/', include('elandifier.eland_config.urls')),
- # Admin:
- (r'^admin/', include('django.contrib.admin.urls')),
- # Databrowser:
- (r'^databrowse/(.*)', databrowse.site.root),
-)
--- /dev/null
+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'<div class="errorlist">%s</div>' % (''.join([u'<div class="error">%s</div>' % 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) + '<br />')
+
+ run_date = self['run_date']
+ html.append(run_date.label_tag() + ': ' + str(run_date) + str(run_date.errors) + '<br />')
+
+ arun = self['advanced_run']
+ html.append(arun.label_tag() + ': ' + str(arun) + str(arun.errors) + '<br />')
+
+ rl = self['read_length']
+ html.append(rl.label_tag() + ': ' + str(rl) + str(rl.errors) + '<br /><br />')
+
+ html.append('<table border="0">')
+ html.append(' <tr><td>%s</td><td>%s</td><td>%s</td></tr>' \
+ % ('Lane', 'Species', 'Description'))
+
+ l1s = self['lane1_species']
+ l1d = self['lane1_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('1', str(l1s), str(l1s.errors), str(l1d), str(l1d.errors)))
+
+ l2s = self['lane2_species']
+ l2d = self['lane2_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('2', str(l2s), str(l2s.errors), str(l2d), str(l2d.errors)))
+
+ l3s = self['lane3_species']
+ l3d = self['lane3_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('3', str(l3s), str(l3s.errors), str(l3d), str(l3d.errors)))
+
+ l4s = self['lane4_species']
+ l4d = self['lane4_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('4', str(l4s), str(l4s.errors), str(l4d), str(l4d.errors)))
+
+ l5s = self['lane5_species']
+ l5d = self['lane5_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('5', str(l5s), str(l5s.errors), str(l5d), str(l5d.errors)))
+
+ l6s = self['lane6_species']
+ l6d = self['lane6_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('6', str(l6s), str(l6s.errors), str(l6d), str(l6d.errors)))
+
+ l7s = self['lane7_species']
+ l7d = self['lane7_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('7', str(l7s), str(l7s.errors), str(l7d), str(l7d.errors)))
+
+ l8s = self['lane8_species']
+ l8d = self['lane8_description']
+ html.append(' <tr><td>%s</td><td>%s %s</td><td>%s %s</td></tr>' \
+ % ('8', str(l8s), str(l8s.errors), str(l8d), str(l8d.errors)))
+
+ html.append('</table><br />')
+
+ notes = self['notes']
+ html.append('<p>Notes:</p>')
+ html.append(' %s<br />' % (str(notes)))
+
+ return '\n'.join(html)
+
+
+
\ No newline at end of file
--- /dev/null
+from django.db import models
+
+# Create your models here.
--- /dev/null
+from django.conf.urls.defaults import *
+
+urlpatterns = patterns('',
+ # Example:
+
+ (r'^config/(?P<flowcell>FC\d+)/$', 'elandifier.eland_config.views.config'),
+ (r'^config/$', 'elandifier.eland_config.views.config'),
+ (r'^$', 'elandifier.eland_config.views.index')
+
+)
--- /dev/null
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from elandifier.eland_config import forms
+from elandifier import settings
+from elandifier.fctracker import models
+
+import os
+import glob
+# Create your views here.
+
+
+#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 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*')) ]
+ #Convert FC* list to html links
+ fc_html = [ '<a href="/elandifier/config/%s/">%s</a>' % (fc_name, fc_name) for fc_name in fc_list ]
+ return HttpResponse('<br />'.join(fc_html))
+
+ #FIXME: Should validate flowcell input before using.
+ file_path = os.path.join(settings.UPLOADTO_CONFIG_FILE, flowcell)
+
+ if not os.path.isfile(file_path):
+ return HttpResponse("Hmm, config file for %s does not seem to exist. Maybe I don't exist either?" % (flowcell))
+
+ f = open(file_path, 'r')
+ cfg = f.read()
+ f.close()
+
+ 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 })
--- /dev/null
+from django.db import models
+from elandifier import settings
+
+# Create your models here.
+
+class Species(models.Model):
+
+ scientific_name = models.CharField(max_length=256, unique=True, db_index=True, core=True)
+ common_name = models.CharField(max_length=256, blank=True)
+
+ def __str__(self):
+ return '%s (%s)' % (self.scientific_name, self.common_name)
+
+ class Meta:
+ verbose_name_plural = "species"
+ ordering = ["scientific_name"]
+
+ class Admin:
+ fields = (
+ (None, {
+ 'fields': (('scientific_name', 'common_name'),)
+ }),
+ )
+
+class Library(models.Model):
+
+ library_id = models.IntegerField(primary_key=True, db_index=True, core=True)
+ library_name = models.CharField(max_length=100, unique=True, core=True)
+ library_species = models.ForeignKey(Species, core=True)
+ RNAseq = models.BooleanField()
+
+ made_by = models.CharField(max_length=50, blank=True, default="Lorian")
+ creation_date = models.DateField(blank=True, null=True)
+ made_for = models.CharField(max_length=50, blank=True)
+
+ PROTOCOL_END_POINTS = (
+ ('?', 'Unknown'),
+ ('Sample', 'Raw sample'),
+ ('Gel', 'Ran gel'),
+ ('1A', 'Gel purification'),
+ ('2A', '2nd PCR'),
+ ('Progress', 'In progress'),
+ )
+ stopping_point = models.CharField(max_length=50, choices=PROTOCOL_END_POINTS)
+ amplified_from_sample = models.ForeignKey('self', blank=True, null=True)
+
+ undiluted_concentration = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True)
+ ten_nM_dilution = models.BooleanField()
+ successful_pM = models.IntegerField(blank=True, null=True)
+
+ notes = models.TextField(blank=True)
+
+ def __str__(self):
+ return '#%s: %s' % (self.library_id, self.library_name)
+
+ class Meta:
+ verbose_name_plural = "libraries"
+ ordering = ["-library_id"]
+
+ class Admin:
+ date_hierarchy = "creation_date"
+ save_as = True
+ save_on_top = True
+ search_fields = ['library_name']
+ list_display = ('library_id', 'library_name', 'made_for', 'creation_date', 'ten_nM_dilution', 'stopping_point', 'successful_pM')
+ list_display_links = ('library_id', 'library_name')
+ list_filter = ('stopping_point', 'ten_nM_dilution', 'library_species', 'made_for', 'made_by')
+ fields = (
+ (None, {
+ 'fields': (('library_id', 'library_name'), ('library_species', 'RNAseq'),)
+ }),
+ ('Creation Information:', {
+ 'fields' : (('made_for', 'made_by', 'creation_date'), ('stopping_point', 'amplified_from_sample'), ('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)
+
+ 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.IntegerField(default=4)
+ lane_2_pM = models.IntegerField(default=4)
+ lane_3_pM = models.IntegerField(default=4)
+ lane_4_pM = models.IntegerField(default=4)
+ lane_5_pM = models.IntegerField(default=4)
+ lane_6_pM = models.IntegerField(default=4)
+ lane_7_pM = models.IntegerField(default=4)
+ lane_8_pM = models.IntegerField(default=4)
+
+ 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)
+
+ notes = models.TextField(blank=True)
+
+ def __str__(self):
+ return '%s (%s)' % (self.flowcell_id, self.run_date)
+
+ class Meta:
+ ordering = ["run_date"]
+
+ class Admin:
+ 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', 'run_date', 'lane_1_library', 'lane_2_library', 'lane_3_library', 'lane_4_library', 'lane_5_library', 'lane_6_library', 'lane_7_library', 'lane_8_library')
+ fields = (
+ (None, {
+ 'fields': ('run_date', 'flowcell_id',)
+ }),
+ ('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)
--- /dev/null
+# Create your views here.
--- /dev/null
+#!/usr/bin/env python
+from django.core.management import execute_manager
+try:
+ import settings # Assumed to be in the same directory.
+except ImportError:
+ import sys
+ sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+ sys.exit(1)
+
+if __name__ == "__main__":
+ execute_manager(settings)
--- /dev/null
+import os
+
+# Django settings for elandifier project.
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+ # ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+DATABASE_NAME = '/home/king/proj/ga_frontend/elandifier.db' # Or path to database file if using sqlite3.
+DATABASE_USER = '' # Not used with sqlite3.
+DATABASE_PASSWORD = '' # Not used with sqlite3.
+DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+
+# Local time zone for this installation. Choices can be found here:
+# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
+# although not all variations may be possible on all operating systems.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'America/Los_Angeles'
+
+# Language code for this installation. All choices can be found here:
+# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+# http://blogs.law.harvard.edu/tech/stories/storyReader$15
+LANGUAGE_CODE = 'en-us'
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = ''
+
+# URL that handles the media served from MEDIA_ROOT.
+# Example: "http://media.lawrence.com"
+MEDIA_URL = ''
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/media/'
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '(ekv^=gf(j9f(x25@a7r+8)hqlz%&_1!tw^75l%^041#vi=@4n'
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.load_template_source',
+ 'django.template.loaders.app_directories.load_template_source',
+# 'django.template.loaders.eggs.load_template_source',
+)
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.middleware.doc.XViewMiddleware',
+)
+
+ROOT_URLCONF = 'elandifier.urls'
+
+TEMPLATE_DIRS = (
+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+ # Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
+ "/home/king/proj/ga_frontend/templates"
+)
+
+INSTALLED_APPS = (
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'ga_frontend.eland_config',
+ 'ga_frontend.fctracker',
+ 'django.contrib.databrowse',
+)
+
+# Project specific settings
+UPLOADTO_HOME = '/home/king/proj/ga_frontend/uploads'
+UPLOADTO_CONFIG_FILE = os.path.join(UPLOADTO_HOME, 'eland_config')
+UPLOADTO_ELAND_RESULT_PACKS = os.path.join(UPLOADTO_HOME, 'eland_results')
+UPLOADTO_BED_PACKS = os.path.join(UPLOADTO_HOME, 'bed_packs')
+
--- /dev/null
+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)
+
+urlpatterns = patterns('',
+ # Base:
+ (r'^elandifier/', include('elandifier.eland_config.urls')),
+ # Admin:
+ (r'^admin/', include('django.contrib.admin.urls')),
+ # Databrowser:
+ (r'^databrowse/(.*)', databrowse.site.root),
+)