From: Diane Trout Date: Wed, 4 Mar 2009 01:17:20 +0000 (+0000) Subject: Change cluster_mac_id and seq_mac_id from text fields holding X-Git-Tag: 0.2.0.1~8 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=ed5e0fc9653c4ba9a332407d3134c51b2274ebc3 Change cluster_mac_id and seq_mac_id from text fields holding the contents of a drop down box to be seperate tables whose table names are a bit closer to the official illumina names. clust_mac_id -> cluster_station seq_mac_id -> sequencer --- diff --git a/docs/conv_caltech_v0.1_to_htsw.py b/docs/conv_caltech_v0.1_to_htsw.py index 10f4e35..15e6d84 100644 --- a/docs/conv_caltech_v0.1_to_htsw.py +++ b/docs/conv_caltech_v0.1_to_htsw.py @@ -11,6 +11,15 @@ def main(cmdline=None): conn = sqlite3.connect(dest) c = conn.cursor() c.execute('drop table fctracker_elandresult'); + c.execute('''CREATE TABLE "experiments_clusterstation" ( + "id" integer NOT NULL PRIMARY KEY, + "name" varchar(50) NOT NULL UNIQUE);''') + c.execute('''INSERT INTO experiments_clusterstation (name) values ("station");''') + c.execute('''CREATE TABLE "experiments_sequencer" ( + "id" integer NOT NULL PRIMARY KEY, + "name" varchar(50) NOT NULL UNIQUE);''') + c.execute('''INSERT INTO experiments_sequencer (name) values ("HWI-EAS229");''') + c.execute('''CREATE TABLE "experiments_flowcell" ( "id" integer NOT NULL PRIMARY KEY, "flowcell_id" varchar(20) NOT NULL UNIQUE, @@ -42,8 +51,8 @@ def main(cmdline=None): "lane_6_cluster_estimate" integer NULL, "lane_7_cluster_estimate" integer NULL, "lane_8_cluster_estimate" integer NULL, - "cluster_mac_id" varchar(50) NOT NULL, - "seq_mac_id" varchar(50) NOT NULL, + "cluster_station_id" integer NOT NULL REFERENCES "experiments_clusterstation" ("id"), + "sequencer_id" integer NOT NULL REFERENCES "experiments_sequencer" ("id"), "notes" text NOT NULL );''') c.execute('''insert into experiments_flowcell @@ -56,7 +65,7 @@ def main(cmdline=None): lane_2_cluster_estimate, lane_3_cluster_estimate, lane_4_cluster_estimate, lane_5_cluster_estimate, lane_6_cluster_estimate, lane_7_cluster_estimate, - lane_8_cluster_estimate, cluster_mac_id, seq_mac_id, + lane_8_cluster_estimate, cluster_station_id, sequencer_id, notes) select id, flowcell_id, run_date, advanced_run, paired_end, read_length, @@ -68,7 +77,7 @@ def main(cmdline=None): lane_2_cluster_estimate, lane_3_cluster_estimate, lane_4_cluster_estimate, lane_5_cluster_estimate, lane_6_cluster_estimate, lane_7_cluster_estimate, - lane_8_cluster_estimate, "", "", + lane_8_cluster_estimate, 1, 1, notes from fctracker_flowcell;''') c.execute('''drop table fctracker_flowcell;''') diff --git a/htsworkflow/frontend/experiments/admin.py b/htsworkflow/frontend/experiments/admin.py index 50b8e3f..7432727 100644 --- a/htsworkflow/frontend/experiments/admin.py +++ b/htsworkflow/frontend/experiments/admin.py @@ -1,4 +1,4 @@ -from htsworkflow.frontend.experiments.models import FlowCell, DataRun +from htsworkflow.frontend.experiments.models import FlowCell, DataRun, ClusterStation, Sequencer from django.contrib import admin from django.utils.translation import ugettext_lazy as _ @@ -29,8 +29,8 @@ class FlowCellOptions(admin.ModelAdmin): date_hierarchy = "run_date" save_on_top = True search_fields = ('flowcell_id', - 'seq_mac_id', - 'cluster_mac_id', + 'sequencer', + 'cluster_station', '=lane_1_library__library_id', '=lane_2_library__library_id', '=lane_3_library__library_id', @@ -40,16 +40,25 @@ class FlowCellOptions(admin.ModelAdmin): '=lane_7_library__library_id', '=lane_8_library__library_id') list_display = ('flowcell_id','run_date','Lanes') - list_filter = ('seq_mac_id','cluster_mac_id') + list_filter = ('sequencer','cluster_station') fieldsets = ( (None, { - 'fields': ('run_date', ('flowcell_id','cluster_mac_id','seq_mac_id'), ('read_length', 'paired_end'),) + 'fields': ('run_date', ('flowcell_id','cluster_station','sequencer'), ('read_length', 'paired_end'),) }), ('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'),) }), ) +class ClusterStationOptions(admin.ModelAdmin): + list_display = ('name', ) + fieldsets = ( ( None, { 'fields': ( 'name', ) } ), ) + +class SequencerOptions(admin.ModelAdmin): + list_display = ('name', ) + fieldsets = ( ( None, { 'fields': ( 'name', ) } ), ) + admin.site.register(DataRun, DataRunOptions) admin.site.register(FlowCell, FlowCellOptions) - +admin.site.register(ClusterStation, ClusterStationOptions) +admin.site.register(Sequencer, SequencerOptions) diff --git a/htsworkflow/frontend/experiments/models.py b/htsworkflow/frontend/experiments/models.py index 5fdd7b2..0ac386e 100755 --- a/htsworkflow/frontend/experiments/models.py +++ b/htsworkflow/frontend/experiments/models.py @@ -2,6 +2,18 @@ from django.db import models from htsworkflow.frontend.samples.models import * from django.core.exceptions import ObjectDoesNotExist +class ClusterStation(models.Model): + name = models.CharField(max_length=50, unique=True) + + def __unicode__(self): + return unicode(self.name) + +class Sequencer(models.Model): + name = models.CharField(max_length=50, unique=True) + + def __unicode__(self): + return unicode(self.name) + class FlowCell(models.Model): flowcell_id = models.CharField(max_length=20, unique=True, db_index=True) @@ -46,23 +58,10 @@ class FlowCell(models.Model): # lane_7_primer = models.ForeignKey(Primer,blank=True,null=True,related_name="lane_7_primer") # lane_8_primer = models.ForeignKey(Primer,blank=True,null=True,related_name="lane_8_primer") - #Machine Names - CLUSTER_MAC = ( - ('M304','Cardinal'), - ('R349','R349'), - ('Tinkerbell','Tinkerbell'), - ('BitBit','BitBit'), - ) - - SEQ_MAC = ( - ('EAS149','Stanford'), - ('EAS46','EAS46'), - ('EAS45','Paris'), - ('Britney','Britney'), - ) - - cluster_mac_id = models.CharField(max_length=50, choices=CLUSTER_MAC, default='BitBit') - seq_mac_id = models.CharField(max_length=50, choices=SEQ_MAC, verbose_name = 'Sequencer', default='Britney') + #cluster_mac_id = models.CharField(max_length=50, choices=CLUSTER_MAC, default='BitBit') + #seq_mac_id = models.CharField(max_length=50, choices=SEQ_MAC, verbose_name = 'Sequencer', default='Britney') + cluster_station = models.ForeignKey(ClusterStation) + sequencer = models.ForeignKey(Sequencer) notes = models.TextField(blank=True) @@ -95,7 +94,6 @@ class FlowCell(models.Model): class Meta: ordering = ["-run_date"] - ### ----------------------- class DataRun(models.Model): ConfTemplate = "CONFIG PARAMS WILL BE GENERATED BY THE PIPELINE SCRIPT.\nYOU'LL BE ABLE TO EDIT AFTER IF NEEDED."