From: Diane Trout Date: Thu, 10 Sep 2009 23:54:33 +0000 (+0000) Subject: Don't crash if there are no lane result summary entries when rendering X-Git-Tag: 0.3.2~29 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=5c5f0f184573006932bbdb9467eb7ed9c7f6f625 Don't crash if there are no lane result summary entries when rendering output by not looking inside the empty dictionary. --- diff --git a/htsworkflow/frontend/samples/views.py b/htsworkflow/frontend/samples/views.py index 9ddc577..d79d0b8 100644 --- a/htsworkflow/frontend/samples/views.py +++ b/htsworkflow/frontend/samples/views.py @@ -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( diff --git a/htsworkflow/pipelines/runfolder.py b/htsworkflow/pipelines/runfolder.py index 14b7e07..c17ebeb 100644 --- a/htsworkflow/pipelines/runfolder.py +++ b/htsworkflow/pipelines/runfolder.py @@ -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'):