]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/read_fastq
added provisional write sam support
[biopieces.git] / bp_bin / read_fastq
index c2f74cd7bb7a07219ac43ecfd574ad726f5b8f00..96be2c3a06f8b2762fdfa3e918fe68f091c74fce 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# Copyright (C) 2007-2011 Martin A. Hansen.
+# Copyright (C) 2007-2013 Martin A. Hansen.
 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -40,8 +40,9 @@ casts << {:long=>'encoding', :short=>'e', :type=>'string', :mandatory=>false, :d
 
 options = Biopieces.options_parse(ARGV, casts)
 
-num  = 0
-last = false
+num   = 0
+first = true
+last  = false
 
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   unless options[:data_in] and options[:data_in].first == '-'
@@ -67,6 +68,12 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
           end
 
           entry.convert_scores!(encoding, 'illumina13')
+
+          if first
+            raise SeqError, "Quality score outside valid range" unless entry.qual_valid?('illumina13')
+            first = false
+          end
+
           output.puts entry.to_bp
           num += 1