From: martinahansen Date: Thu, 14 Apr 2011 12:21:49 +0000 (+0000) Subject: added length check to read_454 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b8842c41af5960b06537f5debc2b7c0f1b8acacd;p=biopieces.git added length check to read_454 git-svn-id: http://biopieces.googlecode.com/svn/trunk@1326 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/read_454 b/bp_bin/read_454 index ae2f4b0..5017cd8 100755 --- a/bp_bin/read_454 +++ b/bp_bin/read_454 @@ -67,6 +67,7 @@ if ( $options->{ 'data_in' } ) $qual = get_qual( $qual_in ); check_names( $fasta, $qual ); + check_lengths( $fasta, $qual ); $record = { SEQ_NAME => $fasta->[ 0 ], @@ -164,6 +165,28 @@ sub check_names } +sub check_lengths +{ + # Martin A. Hansen, April 2011. + + # Check if the lengths of the fasta and qual strings are the same + # and raise an error if not. + + my ( $fasta, # fasta entry + $qual, # qual entry + ) = @_; + + # Returns nothing. + + my ( $f_len, $q_len ); + + $f_len = length $fasta->[ 1 ]; + $q_len = length $qual->[ 1 ]; + + Maasha::Common::error( qq(lengths don't match "$f_len" != "$q_len") ) if $f_len != $q_len; +} + + # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<