]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_perl/Maasha/BioRun.pm
migrated extract_seq
[biopieces.git] / code_perl / Maasha / BioRun.pm
index 60b771781b574c3eab46fb0ae7c0284cf9a5f537..a44bdb0e48b897ee8d510c93e2ddfdf15cfa5415 100644 (file)
@@ -147,7 +147,6 @@ sub run_script
     elsif ( $script eq "transliterate_seq" )        { script_transliterate_seq(         $in, $out, $options ) }
     elsif ( $script eq "transliterate_vals" )       { script_transliterate_vals(        $in, $out, $options ) }
     elsif ( $script eq "translate_seq" )            { script_translate_seq(             $in, $out, $options ) }
-    elsif ( $script eq "extract_seq" )              { script_extract_seq(               $in, $out, $options ) }
     elsif ( $script eq "get_genome_align" )         { script_get_genome_align(          $in, $out, $options ) }
     elsif ( $script eq "get_genome_phastcons" )     { script_get_genome_phastcons(      $in, $out, $options ) }
     elsif ( $script eq "fold_seq" )                 { script_fold_seq(                  $in, $out, $options ) }
@@ -398,14 +397,6 @@ sub get_options
             frames|f=s
         );
     }
-    elsif ( $script eq "extract_seq" )
-    {
-        @options = qw(
-            beg|b=s
-            end|e=s
-            len|l=s
-        );
-    }
     elsif ( $script eq "get_genome_align" )
     {
         @options = qw(
@@ -2400,70 +2391,6 @@ sub script_translate_seq
 }
 
 
-sub script_extract_seq
-{
-    # Martin A. Hansen, August 2007.
-
-    # Extract subsequences from sequences in record.
-
-    my ( $in,        # handle to in stream
-         $out,       # handle to out stream
-         $options,   # options hash
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $beg, $end, $len, $record );
-
-    if ( not defined $options->{ "beg" } or $options->{ "beg" } < 0 ) {
-        $beg = 0;
-    } else {
-        $beg = $options->{ "beg" } - 1;   # correcting for start offset
-    }
-
-    if ( defined $options->{ "end" } and $options->{ "end" } - 1 < $beg ) {
-        $end = $beg - 1;
-    } elsif ( defined $options->{ "end" } ) {
-        $end = $options->{ "end" } - 1;   # correcting for start offset
-    }
-
-    $len = $options->{ "len" };
-
-#    print "beg->$beg,  end->$end,  len->$len\n";
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) 
-    {
-        if ( $record->{ "SEQ" } )
-        {
-            if ( defined $beg and defined $end )
-            {
-                if ( $end - $beg + 1 > length $record->{ "SEQ" } ) {
-                    $record->{ "SEQ" } = substr $record->{ "SEQ" }, $beg;
-                } else {
-                    $record->{ "SEQ" } = substr $record->{ "SEQ" }, $beg, $end - $beg + 1;
-                }
-            }
-            elsif ( defined $beg and defined $len )
-            {
-                if ( $len > length $record->{ "SEQ" } ) {
-                    $record->{ "SEQ" } = substr $record->{ "SEQ" }, $beg;
-                } else {
-                    $record->{ "SEQ" } = substr $record->{ "SEQ" }, $beg, $len;
-                }
-            }
-            elsif ( defined $beg )
-            {
-                $record->{ "SEQ" } = substr $record->{ "SEQ" }, $beg;
-            }
-        }
-
-        $record->{ "SEQ_LEN" } = length $record->{ "SEQ" };
-
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-}
-
-
 sub script_get_genome_align
 {
     # Martin A. Hansen, April 2008.