added FlowcellId data status (by read count from libinfo). Now data status is reporte...
authorRami Rauch <rrauch@stanford.edu>
Thu, 23 Apr 2009 22:46:27 +0000 (22:46 +0000)
committerRami Rauch <rrauch@stanford.edu>
Thu, 23 Apr 2009 22:46:27 +0000 (22:46 +0000)
htswfrontend/htswfrontend/exp_track/models.py

index 1dcfee2b2c25e41a264b0e09c0afff9b9146a855..f650e2228d44890d9001ea0a6ccc39ddde82a1d7 100755 (executable)
@@ -58,11 +58,14 @@ class FlowCell(models.Model):
       ('EAS46','EAS46'),
       ('EAS45','Paris'),
       ('Britney','Britney'),
+      ('EAS614','LiLo'),
     )
-  
+
   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')
   
+  is_paired_end = models.BooleanField(default=False)
+
   notes = models.TextField(blank=True)
 
   def __str__(self):
@@ -77,6 +80,10 @@ class FlowCell(models.Model):
       str +='<br/><a target=_self href="/admin/exp_track/datarun/?q='+self.flowcell_id+'" title="Check Data Runs ..." ">DataRun ..</a>'
     except ObjectDoesNotExist:
       str += '<br/><span style="color:red">not sequenced</span>'
+
+    if self.is_paired_end:
+      str += '<div><b>Paired End</b></div>'
+
     return str
   Create_LOG.allow_tags = True 
 
@@ -92,11 +99,11 @@ class FlowCell(models.Model):
     date_hierarchy = "run_date"
     save_on_top = True
     search_fields = ['flowcell_id','seq_mac_id','cluster_mac_id','=lane_1_library__library_id','=lane_2_library__library_id','=lane_3_library__library_id','=lane_4_library__library_id','=lane_5_library__library_id','=lane_6_library__library_id','=lane_7_library__library_id','=lane_8_library__library_id']
-    list_display = ('flowcell_id','seq_mac_id','run_date', 'Create_LOG','Lanes')
+    list_display = ('flowcell_id','seq_mac_id','run_date', 'Create_LOG','Lanes','notes')
     list_filter = ('seq_mac_id','cluster_mac_id')
     fields = (
         (None, {
-            'fields': ('run_date', ('flowcell_id','cluster_mac_id','seq_mac_id'), ('read_length'),)
+            'fields': ('run_date', ('flowcell_id','cluster_mac_id','seq_mac_id','is_paired_end'), ('read_length'),)
         }),
         ('Lanes:', {
             ##'fields' : (('lane_1_library', 'lane_1_pM', 'lane_1_cluster_estimate', 'lane_1_primer'), ('lane_2_library', 'lane_2_pM', 'lane_2_cluster_estimate', 'lane_2_primer'), ('lane_3_library', 'lane_3_pM', 'lane_3_cluster_estimate', 'lane_3_primer'), ('lane_4_library', 'lane_4_pM', 'lane_4_cluster_estimate', 'lane_4_primer'), ('lane_5_library', 'lane_5_pM', 'lane_5_cluster_estimate', 'lane_5_primer'), ('lane_6_library', 'lane_6_pM', 'lane_6_cluster_estimate', 'lane_6_primer'), ('lane_7_library', 'lane_7_pM', 'lane_7_cluster_estimate', 'lane_7_primer'), ('lane_8_library', 'lane_8_pM', 'lane_8_cluster_estimate', 'lane_8_primer'),)
@@ -109,6 +116,12 @@ class FlowCell(models.Model):
 
 
 ### -----------------------
+
+#Global Util vars
+Dict_SEQ_MAC = dict((row[0], row[1]) for row in FlowCell.SEQ_MAC)
+Dict_CLUSTER_MAC = dict((row[0], row[1]) for row in FlowCell.CLUSTER_MAC)
+
+
 class DataRun(models.Model):
   ConfTemplate = "CONFIG PARAMS WILL BE GENERATED BY THE PIPELINE SCRIPT.\nYOU'LL BE ABLE TO EDIT AFTER IF NEEDED."
   run_folder = models.CharField(max_length=50,unique=True, db_index=True)
@@ -134,20 +147,38 @@ class DataRun(models.Model):
     if self.run_status >= 5:
       str += ' style="color:green">'
       str += '<b>'+self.RUN_STATUS_CHOICES[self.run_status][1]+'</b>'
-      str += '<br/><br/>' #<span style="color:red;font-size:80%;">New!</span>'
-      str +='<br/><a target=_balnk href="'+settings.TASKS_PROJS_SERVER+'/Flowcells/'+self.fcid.flowcell_id+'/'+self.fcid.flowcell_id+'_QC_Summary.html" title="View QC Summaries of this run ..." ">View QC Page</a>'
+      str +='<div style="margin-top:10px"><a target=_balnk href="'+settings.TASKS_PROJS_SERVER+'/Flowcells/'+self.fcid.flowcell_id+'/'+self.fcid.flowcell_id+'_QC_Summary.html" title="View QC Summaries of this run ..." ">View QC Page</a></div>'
     else:
       str += '>'+self.RUN_STATUS_CHOICES[self.run_status][1]
+    str += '</div>'
+
+    ## Check Analysis Server Report 
+    str += '<div style="margin-top:10px">Data analyzed:<br/>'
+    res = getLibReads(self.fcid.flowcell_id.__str__(),'ByFC')
+                                                                                                                                                                                                                                                                          
+    if res[2] != 'OK':
+      str += '<div style="margin-top:10px;border:solid red 2px">'+res[2]+'</div>'
+    else:
+      lc = res[0]
+      if(lc>0):
+        rc = "%1.2f" % (res[1]/1000000.0)
+        str += '<div style="color:green"><b>'+lc.__str__()+'</b> lanes<br/><b>'+rc.__str__()+'</b> M reads</div>'
+      else:
+        str += '<div style="color:red">no data yet</div>'
 
     str += '</div>'
+  
     return str
   main_status.allow_tags = True
 
-  main_status.allow_tags = True
+  ## Util
+  #Dict_SEQ_MAC = dict((row[0], row[1]) for row in FlowCell.SEQ_MAC)
   
   def Flowcell_Info(self):
     str = '<b>'+self.fcid.__str__()+'</b>'
-    str += '  (c: '+self.fcid.cluster_mac_id+',  s: '+self.fcid.seq_mac_id+')'
+    str += '  (c: '+Dict_CLUSTER_MAC[self.fcid.cluster_mac_id]+',  s: '+Dict_SEQ_MAC[self.fcid.seq_mac_id]+')'
+    if self.fcid.is_paired_end:
+      str += '<span style="margin-left:10px"><b>Paired End</b></span>'
     str += '<div style="margin-top:5px;">'    
     str +='<a title="View Lane List here ..."  onClick="el = document.getElementById(\'LanesOf'+self.fcid.__str__()+'\');if(el) (el.style.display==\'none\'?el.style.display=\'block\':el.style.display=\'none\')" style="cursor:pointer;color: #5b80b2;">View/hide lanes</a>'
     str += '<div id="LanesOf'+self.fcid.__str__()+'" style="display:block;border:solid #cccccc 1px;width:350px">'