added checking on parser Status check: if !='OK' print err message and skip the count...
authorRami Rauch <rrauch@stanford.edu>
Tue, 2 Dec 2008 21:29:25 +0000 (21:29 +0000)
committerRami Rauch <rrauch@stanford.edu>
Tue, 2 Dec 2008 21:29:25 +0000 (21:29 +0000)
htswfrontend/htswfrontend/htsw_reports/reports.py

index b6496f00f810c766a5960f9235e7d2132fb5b174..012175909ea08e4d8193d84bc8279b3c58260090 100755 (executable)
@@ -104,11 +104,16 @@ def report1(request):
       else:
         cnt = 0
         for R1 in repReads:
-          cnt = R1.aligned_m_reads()[1]
-          if cnt > 0:
-            str += "<div style='background-color:"+getBgColor(cnt,EXP)+";font-size:140%'>"
-            str += "%1.2f" % (cnt/1000000.0)+" M"
-          else:  str += "<div style='background-color:#ff3300;width:100%;font-size:140%'>0 Reads"
+          rres = R1.aligned_m_reads()
+          # Check data sanlty                                                                                                                                           
+          if rres[2] != 'OK':
+            str += '<div style="border:solid red 2px">'+rres[2]
+          else:
+            cnt = rres[1]
+            if cnt > 0:
+              str += "<div style='background-color:"+getBgColor(cnt,EXP)+";font-size:140%'>"
+              str += "%1.2f" % (cnt/1000000.0)+" M"
+            else:  str += "<div style='background-color:#ff3300;width:100%;font-size:140%'>0 Reads"
           str += "<div style='font-size:70%'>"+R1.library_id+", "+R1.condition.nickname+"</div>"
           str += "</div>"
       str += '</td>'
@@ -136,11 +141,16 @@ def report1(request):
         else:
           cnt = 0
           for R1 in repReads:
-            cnt = R1.aligned_m_reads()[1]
-            if cnt > 0:
-              str += "<div style='background-color:"+getBgColor(cnt,EXP)+";font-size:140%'>"
-              str += "%1.2f" % (cnt/1000000.0)+" M"
-            else:  str += "<div style='background-color:#ff3300;width:100%;font-size:140%'>0 Reads"
+            rres = R1.aligned_m_reads()
+            # Check data sanlty
+            if rres[2] != 'OK':
+              str += '<div style="border:solid red 2px">'+rres[2]
+            else:
+              cnt = rres[1]
+              if cnt > 0:
+                str += "<div style='background-color:"+getBgColor(cnt,EXP)+";font-size:140%'>"
+                str += "%1.2f" % (cnt/1000000.0)+" M"
+              else:  str += "<div style='background-color:#ff3300;width:100%;font-size:140%'>0 Reads"
             str += "<div style='font-size:70%'>"+R1.library_id+", "+R1.condition.nickname+"</div>"
             str += "</div>"
         str += '</td>'
@@ -239,11 +249,16 @@ def report_RM(request): #for RNA-Seq and Methyl-Seq
       else:
         cnt = 0
         for R1 in repReads:
-          cnt = R1.aligned_m_reads()[1]
-          if cnt > 0:
-            str += "<div style='background-color:"+getBgColor(cnt,EXP)+";border:solid #cccccc 1px;font-size:140%'>"
-            str += "%1.2f" % (cnt/1000000.0)+" M"
-          else:  str += "<div style='background-color:#ff3300;border:solid #cccccc 1px;width:100%;font-size:140%'>0 Reads"
+          rres = R1.aligned_m_reads()
+          # Check data sanlty   
+          if rres[2] != 'OK':
+            str += '<div style="border:solid red 2px">'+rres[2]
+          else:
+            cnt = rres[1]
+            if cnt > 0:
+              str += "<div style='background-color:"+getBgColor(cnt,EXP)+";border:solid #cccccc 1px;font-size:140%'>"
+              str += "%1.2f" % (cnt/1000000.0)+" M"
+            else:  str += "<div style='background-color:#ff3300;border:solid #cccccc 1px;width:100%;font-size:140%'>0 Reads"
           str += "<div style='font-size:80%'><a title='View Record' target=_self href=/admin/fctracker/library/?q="+R1.library_id+">"+R1.library_id+"</a>, "+R1.condition.nickname+", "+R1.library_species.common_name+"</div>"
           str += "<div style='font-size:70%'>\""+R1.library_name+"\"</div"
           str += "</div>"