]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_scripts/QA_Illumina_report.rb
removed debug message
[biopieces.git] / bp_scripts / QA_Illumina_report.rb
index d50238509b04e6e47900762cb9fa3d387a91cc8d..cc6269f1d79280aaf06ba76a20a40d6af204bffb 100755 (executable)
@@ -23,13 +23,28 @@ require 'tmpdir'
 require 'base64'
 require 'erb'
 
+class Numeric
+  def commify
+    self.to_s.gsub(/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/, '\1,')
+  end
+end
+
 def parse_analysis(file)
   data = {}
 
   File.open(file, 'r') do |ios|
     ios.each do |line|
-      key, val = line.chomp.split(' ')
-      data[key] = val.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
+      key, val = line.chomp.split(': ')
+        begin Integer(val)
+          val = val.to_i.commify
+        rescue
+          begin Float(val)
+            val = val.to_f.commify
+          rescue
+          end
+        end
+
+      data[key] = val
     end
   end
 
@@ -66,11 +81,11 @@ scores_bin_file                = File.join(tmpdir, 'scores_bin.png')
 STDERR.puts "Analyzing sequences ... "
 
 system(
-  "read_fastq -i #{seq_file} |
+  "read_fastq -e base_33 -i #{seq_file} |
    progress_meter |
    analyze_vals -k SEQ -o #{analyze_vals_file} |
    trim_seq -l 3 -m 25 |
-   grab -e 'SEQ_LEN > 0' |
+   grab -e 'SEQ_LEN > 20' |
    analyze_vals -k SEQ -o #{analyze_vals_trim_file} |
    find_adaptor -l 6 -L 6 -f ACACGACGCTCTTCCGATCT -r AGATCGGAAGAGCACACGTC |
    clip_adaptor |