From 6b4c2afa4b4b581a9c36083a1d059e846ee4b560 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Mon, 4 Feb 2013 13:50:07 +0000 Subject: [PATCH] added quality score check to read_fastq git-svn-id: http://biopieces.googlecode.com/svn/trunk@2089 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/read_fastq | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bp_bin/read_fastq b/bp_bin/read_fastq index c2f74cd..494797c 100755 --- a/bp_bin/read_fastq +++ b/bp_bin/read_fastq @@ -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 == '-' @@ -64,6 +65,9 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| else raise SeqError, "Could not auto-detect quality score encoding" end + elsif first + raise SeqError, "Quality score outside valid range" unless entry.qual_valid?(encoding) + first = false end entry.convert_scores!(encoding, 'illumina13') -- 2.39.2