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,
"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
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,
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;''')
-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 _
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',
'=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)
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)
# 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)
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."