#!/usr/bin/env perl
=head1 LICENSE

Copyright (c) 2007-2009 Illumina, Inc.

This software is covered by the "Illumina Genome Analyzer Software
License Agreement" and the "Illumina Source Code License Agreement",
and certain third party copyright/licenses, and any user of this
source file is bound by the terms therein (see accompanying files
Illumina_Genome_Analyzer_Software_License_Agreement.pdf and
Illumina_Source_Code_License_Agreement.pdf and third party
copyright/license notices).

This file is part of the Consensus Assessment of Sequence And VAriation
(CASAVA) software package.

=cut

use strict;
use warnings;
use Getopt::Long;

use lib '@CASAVA_FULL_PERL_LIBDIR@';

use Casava::Io::SeqGeneMd::SeqGeneFile;


my $USAGE = <<END;

    Usage: seq_gene_to_refFlat.pl -i input_file -g group_label

    Given a seq_gene.md file, output entries that match the given group_label
    to refFlat format. Output to STDOUT.

END

my $input_file;
my $group_label;

my $getopt = GetOptions(
    "input-file=s"              => \$input_file,
    "group-label=s"             => \$group_label,
);

die $USAGE if (!$getopt);

$input_file = shift if (!defined $input_file);
die $USAGE if (! defined $input_file);

$group_label = shift if (!defined $group_label);
die $USAGE if (! defined $group_label);



# open input file
open my $FH_IN, "$input_file"
    or die "Can't open file $input_file: $!\n";

my $seq_gene = Casava::Io::SeqGeneMd::SeqGeneFile->new(
    {   fh          => $FH_IN,
        group_label => $group_label,    });

$seq_gene->print_refFlat_refGene('refFlat');



