add picard-casm statistics to factory job summary
authorTom Clegg <tom@clinicalfuture.com>
Mon, 4 Mar 2013 22:31:08 +0000 (14:31 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Mon, 4 Mar 2013 22:31:22 +0000 (14:31 -0800)
app/helpers/vcf_pipeline_helper.rb

index 59152e0aff91b96b363ea5cd11a8e5ba879c9231..a32efa9d064939c6d8fadb1d8062ed6d0c13b86d 100644 (file)
@@ -68,6 +68,35 @@ module VcfPipelineHelper
               stats[:runtime][:finished_at] ].compact.max
         end
       end
+      if step[:name] == 'picard-casm' and
+          step[:complete] and
+          step[:output_data_locator]
+        tsv = IO.
+          popen("whget -r #{step[:output_data_locator]}/ -").
+          readlines.
+          collect { |x| x.strip.split "\t" }
+        casm = {}
+        head = []
+        tsv.each do |data|
+          if data.size < 4 or data[0].match /^\#/
+            next
+          elsif data[0] == 'CATEGORY' or data[1].match /[^\d\.]/
+            head = data
+          elsif data[0] == 'PAIR'
+            head.each_with_index do |name, index|
+              x = data[index]
+              if x and x.match /^\d+$/
+                x = x.to_i
+              elsif x and x.match /^\d+\.\d+$/
+                x = x.to_f
+              end
+              casm[name] ||= []
+              casm[name] << x
+            end
+          end
+        end
+        stats[:picard_alignment_summary] = casm
+      end
       if step[:name] == 'gatk-stats' and
           step[:complete] and
           step[:output_data_locator]