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

bp_bin/align_seq
code_perl/Maasha/BioRun.pm

index fdf5bd287f78613d2aea83bb9b15f855cad57e77..33930cb5a6f3fa2c468cb9587ab4b039b5ecc3bb 100755 (executable)
@@ -1,6 +1,100 @@
-#!/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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Align sequences in the stream.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use warnings;
 use strict;
+use Maasha::Biopieces;
+use Maasha::Align;
+
+use constant {
+    SEQ_NAME => 0,
+    SEQ      => 1,
+};
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, @entries, $entry );
+
+$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_NAME" } and $record->{ "SEQ" } ) {
+        push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
+    } elsif ( $record->{ "Q_ID" } and $record->{ "SEQ" } ) {
+        push @entries, [ $record->{ "Q_ID" }, $record->{ "SEQ" } ];
+    } else {
+        Maasha::Biopieces::put_record( $record, $out );
+    }
+}
+
+@entries = Maasha::Align::align( \@entries );
+
+foreach $entry ( @entries )
+{
+    if ( $entry->[ SEQ_NAME ] and $entry->[ SEQ ] )
+    {
+        $record = {
+            SEQ_NAME => $entry->[ SEQ_NAME ],
+            SEQ      => $entry->[ 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 ebbd3c53578deafe5451648d72596112021a580f..c54c9ef8c664ce134c6354b5d3a459c3805e0353 100644 (file)
@@ -149,7 +149,6 @@ sub run_script
     elsif ( $script eq "fold_seq" )                 { script_fold_seq(                  $in, $out, $options ) }
     elsif ( $script eq "split_seq" )                { script_split_seq(                 $in, $out, $options ) }
     elsif ( $script eq "split_bed" )                { script_split_bed(                 $in, $out, $options ) }
-    elsif ( $script eq "align_seq" )                { script_align_seq(                 $in, $out, $options ) }
     elsif ( $script eq "tile_seq" )                 { script_tile_seq(                  $in, $out, $options ) }
     elsif ( $script eq "invert_align" )             { script_invert_align(              $in, $out, $options ) }
     elsif ( $script eq "patscan_seq" )              { script_patscan_seq(               $in, $out, $options ) }
@@ -2584,48 +2583,6 @@ sub script_split_bed
 }
 
 
-sub script_align_seq
-{
-    # Martin A. Hansen, August 2007.
-
-    # Align sequences in stream.
-
-    my ( $in,    # handle to in stream
-         $out,   # handle to out stream
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $record, @entries, $entry );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) 
-    {
-        if ( $record->{ "SEQ_NAME" } and $record->{ "SEQ" } ) {
-            push @entries, [ $record->{ "SEQ_NAME" }, $record->{ "SEQ" } ];
-        } elsif ( $record->{ "Q_ID" } and $record->{ "SEQ" } ) {
-            push @entries, [ $record->{ "Q_ID" }, $record->{ "SEQ" } ];
-        } else {
-            Maasha::Biopieces::put_record( $record, $out );
-        }
-    }
-
-    @entries = Maasha::Align::align( \@entries );
-
-    foreach $entry ( @entries )
-    {
-        if ( $entry->[ SEQ_NAME ] and $entry->[ SEQ ] )
-        {
-            $record = {
-                SEQ_NAME => $entry->[ SEQ_NAME ],
-                SEQ      => $entry->[ SEQ ],
-            };
-
-            Maasha::Biopieces::put_record( $record, $out );
-        }
-    }
-}
-
-
 sub script_tile_seq
 {
     # Martin A. Hansen, February 2008.