]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/split_seq
refactoring of assemble_pairs
[biopieces.git] / bp_bin / split_seq
index f6dbb16b96e11e16afca55a48386bc0aa1e49646..790aa7cc3c7e32fb1fa86f2339bc534b8c062f2a 100755 (executable)
@@ -34,7 +34,7 @@ use Maasha::Biopieces;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my ( $options, $in, $out, $record, $new_record, $i, $step, $subseq );
+my ( $options, $in, $out, $record, $new_record, $i, $step, $subseq, $subqual );
 
 $options = Maasha::Biopieces::parse_options(
     [
@@ -58,10 +58,12 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
     {
         for ( $i = 0; $i < length( $record->{ "SEQ" } ) - $options->{ "word_size" } + 1; $i += $step )
         {
-            $subseq = substr $record->{ "SEQ" }, $i, $options->{ "word_size" };
+            $subseq  = substr $record->{ "SEQ" }, $i, $options->{ "word_size" };
+            $subqual = substr $record->{ "SCORES" }, $i, $options->{ "word_size" } if $record->{ "SCORES" };
 
             $new_record->{ "SEQ_NAME" } = $record->{ "SEQ_NAME" } . "[" . ( $i + 1 ) . "-" . ( $i + $options->{ "word_size" } ) . "]";
             $new_record->{ "SEQ" }      = $subseq;
+            $new_record->{ "SCORES" }   = $subqual if $record->{ "SCORES" };
             $new_record->{ "SEQ_LEN" }  = $options->{ "word_size" };
 
             Maasha::Biopieces::put_record( $new_record, $out );