added: assembles reads count per Lane, besides total per Flowcell, for the ByFlowcell...
authorRami Rauch <rrauch@stanford.edu>
Sat, 25 Apr 2009 00:03:34 +0000 (00:03 +0000)
committerRami Rauch <rrauch@stanford.edu>
Sat, 25 Apr 2009 00:03:34 +0000 (00:03 +0000)
htswfrontend/htswfrontend/htsw_reports/libinfopar.py

index 6d468806bf0f4852daf23345478ac42df5724c3b..8c5f0c5e60c82eb59030c15c7749193c7ea5d41d 100644 (file)
@@ -25,7 +25,7 @@ class LibInfoHandler(ContentHandler):
     self.Msg = 'OK'
        
   def startElement(self, name, attrs):
-    try:
+    try:  
       if name == 'Library':     
         self.currlibid = attrs.get('Name',"")      
       elif name == 'Track' and self.searchTerm == self.currlibid:
@@ -44,7 +44,7 @@ class LibInfoHandler(ContentHandler):
 class LibInfoHandlerByFlowCell(ContentHandler):
   def __init__ (self, searchTerm):
     self.searchTerm = searchTerm
-    self.LanesCount, self.ReadsCount = 0, 0
+    self.LanesCount, self.ReadsCount, self.LaneReadsCount = 0, 0, [0,0,0,0,0,0,0,0]
     self.Msg = 'OK'
 
   def startElement(self, name, attrs):
@@ -52,6 +52,8 @@ class LibInfoHandlerByFlowCell(ContentHandler):
       if name == 'Track' and attrs.get('Flowcell',"") == self.searchTerm:
         self.LanesCount += len(attrs.get('Lane',""))
         self.ReadsCount += int(attrs.get('Count',""))
+        self.LaneReadsCount[int(attrs.get('Lane',""))-1] += int(attrs.get('Count',""))
+
     except:
       self.Msg = 'failed parsing xml file'
     return
@@ -76,6 +78,9 @@ def getLibReads(search_term,search_by):
   arRes = []
   arRes.append(curHandler.LanesCount) 
   arRes.append(curHandler.ReadsCount)
+
+  if search_by == 'ByFC':  arRes.append(curHandler.LaneReadsCount)
+
   arRes.append(curHandler.Msg)
 
   return arRes