]> git.donarmstrong.com Git - biopieces.git/commitdiff
migrated complement_seq and reverse_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Sun, 24 May 2009 09:10:21 +0000 (09:10 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Sun, 24 May 2009 09:10:21 +0000 (09:10 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@385 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/complement_seq
bp_bin/reverse_seq
bp_bin/uppercase_seq
code_perl/Maasha/BioRun.pm

index fdf5bd287f78613d2aea83bb9b15f855cad57e77..9ff22c8dd5449452a2fcee1212457a9cc5569990 100755 (executable)
@@ -1,6 +1,89 @@
-#!/usr/bin/env perl
+#!/usr/bin/env perl -w
+
+# Copyright (C) 2007-2009 Martin A. Hansen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# http://www.gnu.org/copyleft/gpl.html
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Uppercases sequences in stream.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use warnings;
 use strict;
+use Maasha::Biopieces;
+use Maasha::Seq;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $type );
+
+$options = Maasha::Biopieces::parse_options();
+
+$in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+while ( $record = Maasha::Biopieces::get_record( $in ) ) 
+{
+    if ( $record->{ "SEQ" } )
+    {
+        if ( not $type ) {
+            $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } );
+        }
+        
+        if ( $type eq "rna" ) {
+            Maasha::Seq::rna_comp( \$record->{ "SEQ" } );
+        } elsif ( $type eq "dna" ) {
+            Maasha::Seq::dna_comp( \$record->{ "SEQ" } );
+        }
+    }
+
+    Maasha::Biopieces::put_record( $record, $out );
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+BEGIN
+{
+    $run_time_beg = Maasha::Biopieces::run_time();
+
+    Maasha::Biopieces::log_biopiece();
+}
+
+END
+{
+    Maasha::Biopieces::close_stream( $in );
+    Maasha::Biopieces::close_stream( $out );
+
+    $run_time_end = Maasha::Biopieces::run_time();
+
+    Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+__END__
+
 
-use Maasha::BioRun;
index fdf5bd287f78613d2aea83bb9b15f855cad57e77..95e122a53bdca370b2d63918b94b1a1c97c9d7a0 100755 (executable)
@@ -1,6 +1,74 @@
-#!/usr/bin/env perl
+#!/usr/bin/env perl -w
+
+# Copyright (C) 2007-2009 Martin A. Hansen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# http://www.gnu.org/copyleft/gpl.html
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Reverse sequences in the stream.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use warnings;
 use strict;
+use Maasha::Biopieces;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record );
+
+$options = Maasha::Biopieces::parse_options();
+
+$in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+while ( $record = Maasha::Biopieces::get_record( $in ) )
+{
+    $record->{ "SEQ" } = reverse $record->{ "SEQ" } if $record->{ "SEQ" };
+
+    Maasha::Biopieces::put_record( $record, $out );
+}
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+BEGIN
+{
+    $run_time_beg = Maasha::Biopieces::run_time();
+
+    Maasha::Biopieces::log_biopiece();
+}
+
+END
+{
+    Maasha::Biopieces::close_stream( $in );
+    Maasha::Biopieces::close_stream( $out );
+
+    $run_time_end = Maasha::Biopieces::run_time();
+
+    Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use Maasha::BioRun;
+__END__
index 774cfe7ede137e119f1d871d19e68a83caa1d7dd..703d383b724220e098a1a47dae4d1535bc2f9532 100755 (executable)
@@ -27,8 +27,6 @@
 
 
 use strict;
-use Maasha::Common;
-use Maasha::Fasta;
 use Maasha::Biopieces;
 
 
index a44bdb0e48b897ee8d510c93e2ddfdf15cfa5415..ecf32f239eeb714f125983b859fd20b63209073f 100644 (file)
@@ -141,8 +141,6 @@ sub run_script
     elsif ( $script eq "create_weight_matrix" )     { script_create_weight_matrix(      $in, $out, $options ) }
     elsif ( $script eq "calc_bit_scores" )          { script_calc_bit_scores(           $in, $out, $options ) }
     elsif ( $script eq "calc_fixedstep" )           { script_calc_fixedstep(            $in, $out, $options ) }
-    elsif ( $script eq "reverse_seq" )              { script_reverse_seq(               $in, $out, $options ) }
-    elsif ( $script eq "complement_seq" )           { script_complement_seq(            $in, $out, $options ) }
     elsif ( $script eq "remove_indels" )            { script_remove_indels(             $in, $out, $options ) }
     elsif ( $script eq "transliterate_seq" )        { script_transliterate_seq(         $in, $out, $options ) }
     elsif ( $script eq "transliterate_vals" )       { script_transliterate_vals(        $in, $out, $options ) }
@@ -2193,65 +2191,6 @@ sub script_calc_fixedstep
 }
 
 
-sub script_reverse_seq
-{
-    # Martin A. Hansen, August 2007.
-
-    # Reverse sequence in record.
-
-    my ( $in,    # handle to in stream
-         $out,   # handle to out stream
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $record );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) 
-    {
-        if ( $record->{ "SEQ" } ) {
-            $record->{ "SEQ" } = reverse $record->{ "SEQ" };
-        }
-
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-}
-
-
-sub script_complement_seq
-{
-    # Martin A. Hansen, August 2007.
-
-    # Complement sequence in record.
-
-    my ( $in,     # handle to in stream
-         $out,    # handle to out stream
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $record, $type );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) 
-    {
-        if ( $record->{ "SEQ" } )
-        {
-            if ( not $type ) {
-                $type = Maasha::Seq::seq_guess_type( $record->{ "SEQ" } );
-            }
-            
-            if ( $type eq "rna" ) {
-                Maasha::Seq::rna_comp( \$record->{ "SEQ" } );
-            } elsif ( $type eq "dna" ) {
-                Maasha::Seq::dna_comp( \$record->{ "SEQ" } );
-            }
-        }
-
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-}
-
-
 sub script_remove_indels
 {
     # Martin A. Hansen, August 2007.