]> git.donarmstrong.com Git - biopieces.git/commitdiff
added split of quality scores to split_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 24 Apr 2012 12:28:24 +0000 (12:28 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 24 Apr 2012 12:28:24 +0000 (12:28 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1810 74ccb610-7750-0410-82ae-013aeee3265d

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 );