Don't crash if there are no lane result summary entries when rendering
authorDiane Trout <diane@caltech.edu>
Thu, 10 Sep 2009 23:54:33 +0000 (23:54 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 10 Sep 2009 23:54:33 +0000 (23:54 +0000)
output by not looking inside the empty dictionary.

htsworkflow/frontend/samples/views.py
htsworkflow/pipelines/runfolder.py

index 9ddc5775a395c2f5485f7872a46d81371723c698..d79d0b83976adc49dff287850e1a71a80796d4d0 100644 (file)
@@ -249,7 +249,10 @@ def _summary_stats(flowcell_id, lane_id):
                 eland_summary = ResultLane(lane_id=lane_id, end=end)
             # add information to lane_summary
             eland_summary.flowcell_id = flowcell_id
-            eland_summary.clusters = gerald_summary[end][lane_id].cluster
+            if len(gerald_summary) > end and gerald_summary[end].has_key(lane_id):
+                eland_summary.clusters = gerald_summary[end][lane_id].cluster
+            else:
+                eland_summary.clusters = 'n/a'
             eland_summary.cycle_width = cycle_width
             if hasattr(eland_summary, 'genome_map'):
                 eland_summary.summarized_reads = runfolder.summarize_mapped_reads( 
index 14b7e07284bedcdb0507235cad9e7f4d021a6da6..c17ebeb7917411c58ca5b1be1b837e085d64f5eb 100644 (file)
@@ -320,8 +320,9 @@ def summarize_lane(gerald, lane_id):
       eland_result = gerald.eland_results.results[end][lane_id]
       report.append("Sample name %s" % (eland_result.sample_name))
       report.append("Lane id %s end %s" % (eland_result.lane_id, end))
-      cluster = summary_results[end][eland_result.lane_id].cluster
-      report.append("Clusters %d +/- %d" % (cluster[0], cluster[1]))
+      if end < len(summary_results) and summary_results[end].has_key(eland_result.lane_id):
+          cluster = summary_results[end][eland_result.lane_id].cluster
+          report.append("Clusters %d +/- %d" % (cluster[0], cluster[1]))
       report.append("Total Reads: %d" % (eland_result.reads))
 
       if hasattr(eland_result, 'match_codes'):