from django.db import models
from htsworkflow.frontend.samples.models import *
+from htsworkflow.frontend.settings import options
from django.core.exceptions import ObjectDoesNotExist
+import logging
+
+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)
+
+default_pM = 5
+try:
+ default_pM = int(options.get('frontend', 'default_pm'))
+except ValueError,e:
+ logging.error("invalid value for frontend.default_pm")
+
+
+
class FlowCell(models.Model):
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_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_2_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_3_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_4_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_5_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_6_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_7_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ lane_8_pM = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
lane_1_cluster_estimate = models.IntegerField(blank=True, null=True)
lane_2_cluster_estimate = models.IntegerField(blank=True, null=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_station = models.ForeignKey(ClusterStation, default=3)
+ sequencer = models.ForeignKey(Sequencer, default=1)
notes = models.TextField(blank=True)
Create_LOG.allow_tags = True
def Lanes(self):
- return '<div><span style="margin-right:10px">1)%s</span><span style="margin-right:10px">2)%s</span><span style="margin-right:10px">3)%s</span><span style="margin-right:10px">4)%s</span><span style="margin-right:10px">5)%s</span><span style="margin-right:10px">6)%s</span><span style="margin-right:10px">7)%s</span><span style="margin-right:10px">8)%s</span></div>' % (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)
+ library_url = '/admin/samples/library/%s'
+ html = ['<table>']
+ for i in range(1,9):
+ cluster_estimate = getattr(self, 'lane_%d_cluster_estimate' % (i,))
+ if cluster_estimate is not None:
+ cluster_estimate = "%s k" % ((int(cluster_estimate)/1000), )
+ else:
+ cluster_estimate = 'None'
+ library_id = getattr(self, 'lane_%d_library_id' % (i,))
+ library = getattr(self, 'lane_%d_library' % i)
+ element = '<tr><td>%d</td><td><a href="%s">%s</a></td><td>%s</td></tr>'
+ expanded_library_url = library_url %(library_id,)
+ html.append(element % (i, expanded_library_url, library, cluster_estimate))
+ html.append('</table>')
+ return "\n".join(html)
Lanes.allow_tags = 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."
str += '</div>'
return str
Flowcell_Info.allow_tags = True
+
+
+class Lane(models.Model):
+ flowcell = models.ForeignKey(FlowCell)
+ lane_number = models.IntegerField(choices=[(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8)])
+ library = models.ForeignKey(Library)
+ pm = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ cluster_estimate = models.IntegerField(blank=True, null=True)
+ comment = models.TextField(null=True, blank=True)