# 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 );
}
+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.
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;
-}