]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_perl/Maasha/BioRun.pm
3 more again
[biopieces.git] / code_perl / Maasha / BioRun.pm
index 7dbd69463243368d3efc5e26bb08c516b8d8ef11..dbc5e8b58b24ad8b0e666eba513d79e311316b31 100644 (file)
@@ -111,11 +111,8 @@ sub run_script
     $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
 
     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_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_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 "uppercase_seq" )            { script_uppercase_seq(             $in, $out, $options ) }
@@ -155,13 +152,6 @@ sub get_options
             data_in|i=s
         );
     }
-    elsif ( $script eq "read_psl" )
-    {
-        @options = qw(
-            data_in|i=s
-            num|n=s
-        );
-    }
     elsif ( $script eq "read_stockholm" )
     {
         @options = qw(
@@ -180,23 +170,6 @@ sub get_options
             gap|g=s
         );
     }
-    elsif ( $script eq "read_soft" )
-    {
-        @options = qw(
-            data_in|i=s
-            samples|s=s
-            num|n=s
-        );
-    }
-    elsif ( $script eq "read_solexa" )
-    {
-        @options = qw(
-            data_in|i=s
-            num|n=s
-            format|f=s
-            quality|q=s
-        );
-    }
     elsif ( $script eq "read_solid" )
     {
         @options = qw(
@@ -380,10 +353,6 @@ sub get_options
         {
             Maasha::Common::error( qq(Argument to --$opt must be AandB, AorB, BorA, AnotB, or BnotA - not "$options{ $opt }") );
         }
-        elsif ( $opt eq "format" and $script eq "read_solexa" and $options{ $opt } !~ /octal|decimal/ )
-        {
-            Maasha::Common::error( qq(Argument to --$opt must be octal or decimal - not "$options{ $opt }") );
-        }
     }
 
     Maasha::Common::error( qq(no --database specified) )                if $script eq "remove_ucsc_tracks"  and not $options{ "database" };
@@ -442,45 +411,6 @@ sub script_print_usage
 }
 
 
-sub script_read_psl
-{
-    # Martin A. Hansen, August 2007.
-
-    # Read psl table from stream or file.
-
-    my ( $in,        # handle to in stream
-         $out,       # handle to out stream
-         $options,   # options hash
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $record, $file, $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 ( $record = Maasha::UCSC::psl_get_entry( $data_in ) ) 
-        {
-            Maasha::Biopieces::put_record( $record, $out );
-
-            goto NUM if $options->{ "num" } and $num == $options->{ "num" };
-
-            $num++;
-        }
-    }
-
-    NUM:
-}
-
-
 sub script_read_stockholm
 {
     # Martin A. Hansen, August 2007.
@@ -602,141 +532,6 @@ sub script_read_phastcons
 }
 
 
-sub script_read_soft
-{
-    # Martin A. Hansen, December 2007.
-
-    # 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, $num, $records, $record, $soft_index, $fh, @platforms, $plat_table, @samples, $sample, $old_end, $skip );
-
-    while ( $record = Maasha::Biopieces::get_record( $in ) ) {
-        Maasha::Biopieces::put_record( $record, $out );
-    }
-
-    $num = 1;
-
-    foreach $file ( @{ $options->{ "files" } } )
-    {
-        print STDERR "Creating index for file: $file\n" if $options->{ "verbose" };
-
-        $soft_index = Maasha::NCBI::soft_index_file( $file );
-
-        $fh         = Maasha::Common::read_open( $file );
-
-        @platforms  = grep { $_->{ "SECTION" } =~ /PLATFORM/ } @{ $soft_index };
-
-        print STDERR "Getting platform tables for file: $file\n" if $options->{ "verbose" };
-
-        $plat_table = Maasha::NCBI::soft_get_platform( $fh, $platforms[ 0 ]->{ "LINE_BEG" }, $platforms[ -1 ]->{ "LINE_END" } );
-
-        @samples    = grep { $_->{ "SECTION" } =~ /SAMPLE/ } @{ $soft_index };
-
-        $old_end    = $platforms[ -1 ]->{ "LINE_END" };
-
-        foreach $sample ( @samples )
-        {
-            $skip = 0;
-            $skip = 1 if ( $options->{ "samples" } and grep { $sample->{ "SECTION" } !~ /$_/ } @{ $options->{ "samples" } } );
-
-            print STDERR "Getting samples for dataset: $sample->{ 'SECTION' }\n" if $options->{ "verbose" } and not $skip;
-
-            $records = Maasha::NCBI::soft_get_sample( $fh, $plat_table, $sample->{ "LINE_BEG" } - $old_end - 1, $sample->{ "LINE_END" } - $old_end - 1, $skip );
-
-            foreach $record ( @{ $records } )
-            {
-                Maasha::Biopieces::put_record( $record, $out );
-
-                goto NUM if $options->{ "num" } and $num == $options->{ "num" };
-
-                $num++;
-            }
-
-            $old_end = $sample->{ "LINE_END" };
-        }
-
-        close $fh;
-    }
-
-    NUM:
-
-    close $data_in if $data_in;
-    close $fh if $fh;
-}
-
-
-sub script_read_solexa
-{
-    # Martin A. Hansen, March 2008.
-
-    # Read Solexa sequence reads from file.
-
-    my ( $in,        # handle to in stream
-         $out,       # handle to out stream
-         $options,   # options hash
-       ) = @_;
-
-    # Returns nothing.
-
-    my ( $record, $file, $data_in, $entry, $num, @seqs, @scores, $i );
-
-    $options->{ "format" }  ||= "octal";
-    $options->{ "quality" } ||= 20;
-
-    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 );
-
-        if ( $options->{ "format" } eq "octal" )
-        {
-            while ( $entry = Maasha::Solexa::solexa_get_entry_octal( $data_in ) )
-            {
-                $record = Maasha::Solexa::solexa2biopiece( $entry, $options->{ "quality" } );
-
-                Maasha::Biopieces::put_record( $record, $out );
-
-                goto NUM 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" } );
-
-                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_solid
 {
     # Martin A. Hansen, April 2008.