]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/read_solexa
modified split_seq
[biopieces.git] / bp_bin / read_solexa
index fb3a988c6657aea219f9985dcb2cbaa425d64793..f594d8079427432e644f1e2674cbe39461a20ca8 100755 (executable)
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
+use Data::Dumper;
 use Maasha::Biopieces;
 use Maasha::Filesys;
 use Maasha::Solexa;
+use Maasha::Fastq;
 
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
@@ -39,10 +42,11 @@ my ( $options, $in, $out, $record, $data_in, $num, $entry, @seqs, @scores, $i );
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'data_in', short => 'i', type => 'files!', mandatory => 'no', default => undef,   allowed => undef,           disallowed => undef },
-        { long => 'num',     short => 'n', type => 'uint',   mandatory => 'no', default => undef,   allowed => undef,           disallowed => '0' },
-        { long => 'format',  short => 'f', type => 'string', mandatory => 'no', default => 'octal', allowed => 'octal,decimal', disallowed => undef },
-        { long => 'quality', short => 'q', type => 'uint',   mandatory => 'no', default => 20,      allowed => undef,           disallowed => undef },
+        { long => 'data_in',     short => 'i', type => 'files!', mandatory => 'no', default => undef,   allowed => undef, disallowed => undef },
+        { long => 'num',         short => 'n', type => 'uint',   mandatory => 'no', default => undef,   allowed => undef, disallowed => '0' },
+        { long => 'convert2dec', short => 'c', type => 'flag',   mandatory => 'no', default => undef,   allowed => undef, disallowed => undef },
+        { long => 'cutoff',      short => 'C', type => 'int',    mandatory => 'no', default => 20,      allowed => undef, disallowed => undef },
+        { long => 'soft_mask',   short => 's', type => 'flag',   mandatory => 'no', default => undef,   allowed => undef, disallowed => undef },
     ]   
 );
 
@@ -59,31 +63,19 @@ if ( $options->{ 'data_in' } )
 
     $num = 1;
 
-    if ( $options->{ "format" } eq "octal" )
+    while ( $entry = Maasha::Fastq::get_entry( $data_in ) )
     {
-        while ( $entry = Maasha::Solexa::solexa_get_entry_octal( $data_in ) )
+        if ( $record = Maasha::Fastq::fastq2biopiece( $entry ) )
         {
-            $record = Maasha::Solexa::solexa2biopiece( $entry, $options->{ "quality" } );
+            Maasha::Fastq::softmask_solexa_str( $record->{ 'SEQ' }, $record->{ 'SCORES' }, $options->{ 'cutoff' } ) if $options->{ 'soft_mask' };
+            $record->{ 'SCORES' } = Maasha::Fastq::solexa_str2dec_str( $record->{ 'SCORES' } ) if $options->{ 'convert2dec' };
 
             Maasha::Biopieces::put_record( $record, $out );
-
-            last if $options->{ "num" } and $num == $options->{ "num" };
-
-            $num++;
         }
-    }
-    else
-    {
-        while ( $entry = Maasha::Solexa::solexa_get_entry_decimal( $data_in ) )
-        {
-            $record = Maasha::Solexa::solexa2biopiece( $entry, $options->{ "quality" } );
+        
+        last if $options->{ "num" } and $num == $options->{ "num" };
 
-            Maasha::Biopieces::put_record( $record, $out );
-
-            last if $options->{ "num" } and $num == $options->{ "num" };
-
-            $num++;
-        }
+        $num++;
     }
 
     close $data_in;