]> git.donarmstrong.com Git - biopieces.git/commitdiff
begin of status update
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 23 Jul 2008 02:11:07 +0000 (02:11 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 23 Jul 2008 02:11:07 +0000 (02:11 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@188 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm

index 554ac36b6e757afddc5d70333770d6d61331792c..001538882ab1c0459d5654d01fad2d45bc645523 100644 (file)
@@ -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;
-}