]> git.donarmstrong.com Git - biopieces.git/commitdiff
3 more
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 2 Jun 2009 14:42:44 +0000 (14:42 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 2 Jun 2009 14:42:44 +0000 (14:42 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@464 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/read_fixedstep
bp_bin/read_gff
bp_bin/read_ucsc_config
code_perl/Maasha/BioRun.pm

index fdf5bd287f78613d2aea83bb9b15f855cad57e77..93b462966a26ba84bc664c52dc74bdd5734c855a 100755 (executable)
@@ -1,6 +1,99 @@
-#!/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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Read fixedStep format from one or more files.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use warnings;
 use strict;
+use Maasha::Biopieces;
+use Maasha::Filesys;
+use Maasha::UCSC::Wiggle;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $data_in, $num, $entry );
+
+$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' },
+    ]   
+);
+
+$in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+while ( $record = Maasha::Biopieces::get_record( $in ) ) {
+    Maasha::Biopieces::put_record( $record, $out );
+}
+
+if ( $options->{ 'data_in' } )
+{
+    $data_in = Maasha::Filesys::files_read_open( $options->{ 'data_in' } );
+
+    $num = 1;
+
+    while ( $entry = Maasha::UCSC::Wiggle::fixedstep_entry_get( $data_in ) )
+    {
+        $record = Maasha::UCSC::Wiggle::fixedstep2biopiece( $entry );
+
+        Maasha::Biopieces::put_record( $record, $out );
+
+        last if $options->{ "num" } and $num == $options->{ "num" };
+
+        $num++;
+    }
+
+    close $data_in;
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+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 fdf5bd287f78613d2aea83bb9b15f855cad57e77..411c2a6d1b6b556876f1dd5efe3289f20693ff01 100755 (executable)
@@ -1,6 +1,97 @@
-#!/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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Read GFF data from one or more files.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use warnings;
 use strict;
+use Maasha::Biopieces;
+use Maasha::Filesys;
+use Maasha::GFF;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $data_in, $num, $entry );
+
+$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' },
+    ]   
+);
+
+$in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+while ( $record = Maasha::Biopieces::get_record( $in ) ) {
+    Maasha::Biopieces::put_record( $record, $out );
+}
+
+if ( $options->{ 'data_in' } )
+{
+    $data_in = Maasha::Filesys::files_read_open( $options->{ 'data_in' } );
+
+    $num = 1;
+
+    while ( $entry = Maasha::GFF::get_entry( $data_in ) )
+    {
+        Maasha::Biopieces::put_record( $entry, $out );
+
+        last if $options->{ "num" } and $num == $options->{ "num" };
+
+        $num++;
+    }
+
+    close $data_in;
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+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 fdf5bd287f78613d2aea83bb9b15f855cad57e77..35e6d2de5dc702ccdd4617f18c9fc514468119ea 100755 (executable)
@@ -1,6 +1,99 @@
-#!/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 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+# Read FASTA entries from one or more files.
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
 
-use warnings;
 use strict;
+use Maasha::Biopieces;
+use Maasha::Filesys;
+use Maasha::UCSC;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $data_in, $num, $entry );
+
+$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' },
+    ]   
+);
+
+$in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+while ( $record = Maasha::Biopieces::get_record( $in ) ) {
+    Maasha::Biopieces::put_record( $record, $out );
+}
+
+if ( $options->{ 'data_in' } )
+{
+    $data_in = Maasha::Filesys::files_read_open( $options->{ 'data_in' } );
+
+    $num = 1;
+
+    while ( $record = Maasha::UCSC::ucsc_config_entry_get( $data_in ) ) 
+    {
+        $record->{ 'REC_TYPE' } = "UCSC Config";
+
+        Maasha::Biopieces::put_record( $record, $out );
+
+        last if $options->{ "num" } and $num == $options->{ "num" };
+
+        $num++;
+    }
+
+    close $data_in;
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+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 5383aa3d8bac76256e89838d65046fba88c90e0b..7dbd69463243368d3efc5e26bb08c516b8d8ef11 100644 (file)
@@ -112,15 +112,12 @@ sub run_script
 
     if    ( $script eq "print_usage" )              { script_print_usage(               $in, $out, $options ) }
     elsif ( $script eq "read_psl" )                 { script_read_psl(                  $in, $out, $options ) }
-    elsif ( $script eq "read_fixedstep" )           { script_read_fixedstep(            $in, $out, $options ) }
     elsif ( $script eq "read_stockholm" )           { script_read_stockholm(            $in, $out, $options ) }
     elsif ( $script eq "read_phastcons" )           { script_read_phastcons(            $in, $out, $options ) }
     elsif ( $script eq "read_soft" )                { script_read_soft(                 $in, $out, $options ) }
-    elsif ( $script eq "read_gff" )                 { script_read_gff(                  $in, $out, $options ) }
     elsif ( $script eq "read_solexa" )              { script_read_solexa(               $in, $out, $options ) }
     elsif ( $script eq "read_solid" )               { script_read_solid(                $in, $out, $options ) }
     elsif ( $script eq "read_mysql" )               { script_read_mysql(                $in, $out, $options ) }
-    elsif ( $script eq "read_ucsc_config" )         { script_read_ucsc_config(          $in, $out, $options ) }
     elsif ( $script eq "uppercase_seq" )            { script_uppercase_seq(             $in, $out, $options ) }
     elsif ( $script eq "complexity_seq" )           { script_complexity_seq(            $in, $out, $options ) }
     elsif ( $script eq "get_genome_align" )         { script_get_genome_align(          $in, $out, $options ) }
@@ -165,13 +162,6 @@ sub get_options
             num|n=s
         );
     }
-    elsif ( $script eq "read_fixedstep" )
-    {
-        @options = qw(
-            data_in|i=s
-            num|n=s
-        );
-    }
     elsif ( $script eq "read_stockholm" )
     {
         @options = qw(
@@ -198,13 +188,6 @@ sub get_options
             num|n=s
         );
     }
-    elsif ( $script eq "read_gff" )
-    {
-        @options = qw(
-            data_in|i=s
-            num|n=s
-        );
-    }
     elsif ( $script eq "read_solexa" )
     {
         @options = qw(
@@ -231,13 +214,6 @@ sub get_options
             password|p=s
         );
     }
-    elsif ( $script eq "read_ucsc_config" )
-    {
-        @options = qw(
-            data_in|i=s
-            num|n=s
-        );
-    }
     elsif ( $script eq "get_genome_align" )
     {
         @options = qw(
@@ -505,51 +481,6 @@ sub script_read_psl
 }
 
 
-sub script_read_fixedstep
-{
-    # Martin A. Hansen, Juli 2008.
-
-    # Read fixedstep wiggle format from stream or file.
-
-    my ( $in,        # handle to in stream
-         $out,       # handle to out stream
-         $options,   # options hash
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $file, $record, $entry, $data_in, $num );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) {
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-
-    $num = 1;
-
-    foreach $file ( @{ $options->{ "files" } } )
-    {
-        $data_in = Maasha::Common::read_open( $file );
-
-        while ( $entry = Maasha::UCSC::Wiggle::fixedstep_entry_get( $data_in ) )
-        {
-            $record = Maasha::UCSC::Wiggle::fixedstep2biopiece( $entry );
-
-            Maasha::Biopieces::put_record( $record, $out );
-
-            goto NUM if $options->{ "num" } and $num == $options->{ "num" };
-
-            $num++;
-        }
-
-        close $data_in;
-    }
-
-    NUM:
-
-    close $data_in if $data_in;
-}
-
-
 sub script_read_stockholm
 {
     # Martin A. Hansen, August 2007.
@@ -742,50 +673,6 @@ sub script_read_soft
 }
 
 
-sub script_read_gff
-{
-    # Martin A. Hansen, February 2008.
-
-    # Read soft format.
-    # http://www.ncbi.nlm.nih.gov/geo/info/soft2.html
-
-    my ( $in,        # handle to in stream
-         $out,       # handle to out stream
-         $options,   # options hash
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $data_in, $file, $fh, $num, $record, $entry );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) {
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-
-    $num = 1;
-
-    foreach $file ( @{ $options->{ "files" } } )
-    {
-        $fh = Maasha::Common::read_open( $file );
-
-        while ( $entry = Maasha::GFF::get_entry( $fh ) )
-        {
-            Maasha::Biopieces::put_record( $entry, $out );
-
-            goto NUM if $options->{ "num" } and $num == $options->{ "num" };
-
-            $num++;
-        }
-
-        close $fh;
-    }
-
-    NUM:
-
-    close $data_in if $data_in;
-}
-
-
 sub script_read_solexa
 {
     # Martin A. Hansen, March 2008.
@@ -948,51 +835,6 @@ sub script_read_mysql
 }
 
 
-sub script_read_ucsc_config
-{
-    # Martin A. Hansen, November 2008.
-
-    # Read track entries from UCSC Genome Browser '.ra' files.
-
-    my ( $in,        # handle to in stream
-         $out,       # handle to out stream
-         $options,   # options hash
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $record, $file, $data_in, $entry, $num );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) {
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-
-    $num = 1;
-
-    foreach $file ( @{ $options->{ "files" } } )
-    {
-        $data_in = Maasha::Common::read_open( $file );
-
-        while ( $record = Maasha::UCSC::ucsc_config_entry_get( $data_in ) ) 
-        {
-            $record->{ 'REC_TYPE' } = "UCSC Config";
-
-            Maasha::Biopieces::put_record( $record, $out );
-
-            goto NUM if $options->{ "num" } and $num == $options->{ "num" };
-
-            $num++;
-        }
-
-        close $data_in;
-    }
-
-    NUM:
-
-    close $data_in if $data_in;
-}
-
-
 sub script_complexity_seq
 {
     # Martin A. Hansen, May 2008.