From 08b23501225ae87fce7763eef242a39a88e47c5b Mon Sep 17 00:00:00 2001 From: martinahansen Date: Wed, 23 Jul 2008 02:11:07 +0000 Subject: [PATCH] begin of status update git-svn-id: http://biopieces.googlecode.com/svn/trunk@188 74ccb610-7750-0410-82ae-013aeee3265d --- code_perl/Maasha/Biopieces.pm | 117 +++++++++++++++++++++------------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index 554ac36..0015388 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -5937,10 +5937,10 @@ sub get_record # Reads one record at a time and converts that record # to a Perl data structure (a hash) which is returned. - my ( $fh, + my ( $fh, # handle to stream ) = @_; - # Returns data structure. + # Returns a hash. my ( $block, @lines, $line, $key, $value, %record ); @@ -5995,6 +5995,77 @@ sub put_record } +sub get_status +{ + # Martin A. Hansen, July 2008. + + # Gets the first record in the stream, the status record, + # which is returned. An error is raised if no status record + # was found. + + my ( $fh, # handle to stream + ) = @_; + + # Returns a hash. + + my ( $record ); + + $record = get_record( $fh ); + + Maasha::Common::error( "No status record found in stream." ) if not $record->{ "REC_TYPE" } eq "STATUS"; + + return wantarray ? %{ $record } : $record; +} + + +sub put_status +{ + # Martin A. Hansen, July 2008. + + # Output the status record to STDOUT. + + # Should it ever go to file? + + my ( $record, # status record. + $fh, # handle to file or stream - OPTIONAL + ) = @_; + + # Returns nothing. + + put_record( $record, $fh ); +} + + +sub check_status +{ + # Martin A. Hansen, July 2008. + +} + + +sub status_new +{ + # Martin A. Hansen, July 2008. + + # Create a new status record which + # is returned. + + my ( $fisk + + ); + + my ( $record ); + return wantarray ? %{ $record } : $record; +} + + +sub status_update +{ + # Martin A. Hansen, July 2008. + +} + + sub getopt_files { # Martin A. Hansen, November 2007. @@ -6080,45 +6151,3 @@ END 1; __END__ - - -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 ); - - while ( $record = get_record( $in ) ) { - put_record( $record, $out ); - } - - $num = 1; - - foreach $file ( @{ $options->{ "files" } } ) - { - $records = Maasha::NCBI::soft_parse( $file ); - - foreach $record ( @{ $records } ) - { - put_record( $record, $out ); - - goto NUM if $options->{ "num" } and $num == $options->{ "num" }; - - $num++; - } - } - - NUM: - - close $data_in if $data_in; -} -- 2.39.5