#!/usr/bin/perl

use strict;

use warnings;

use Data::Dumper;
use Getopt::Euclid;

# solutions to homework 1.

use ExpressionOO;

my ($expression_files, $expression_print_file, $expression_merge, @expression_datasets);

#print(Dumper(\%ARGV));
$expression_files = $ARGV{'-expression-file'};
foreach my $ef (@$expression_files)
  {
    my $expression = Expression::new();
    print("Expression is $expression.\n");
    print("Reading gene expression data from $ef.\n");
    $expression->read($ef);
    print("Read data for ", $expression->num_genes(), " genes and ", 
		$expression->num_samples(), " samples.\n");
    push(@expression_datasets, $expression);
  }


if (exists($ARGV{'-merge'}))
  { 
    $expression_merge = Expression::new();
    print("expression_merge is $expression_merge.\n");
    $expression_merge->merge(\@expression_datasets);
    print("Merged dataset has ", $expression_merge->num_genes(), " genes and ",
		$expression_merge->num_samples(), " samples.\n");
    print("expression_merge is $expression_merge.\n");
  }

if (exists($ARGV{'-print'}))
  {
    $expression_merge->print($ARGV{'-print'});
  }

__END__

=head1 NAME

lecture-13 - Solutions to homework 1, homework 2, and midterm 1.

=head1 SYNOPSIS



=head1 DESCRIPTION

=head1 REQUIRED ARGUMENTS

=over

=item -e[xpression-file] <expression-file>

=for Euclid:
expression-file.type: readable
repeatable

The name of a file to read expression data to.

=back

=head1 OPTIONS

=over

=item -p[rint] <output-file>

=for Euclid:

output-file.type: writable

The name of a file to print the gene expression data to.

=item -m[erge] 

Merge all the gene expression data sets into one dataset.

=back

=cut

