/*
 * Copyright (c) 1999 Johnny C. Lam.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  The author makes no representations
 * about the suitability of this software for any purpose.  It is
 * provided "as is" without express or implied warranty.
 */

#include <cstdlib>
#include <fstream>
#include <iostream>
#include <memory>

#include "dictionary.h"
#include "longest_segment.h"

using namespace std;

///////////////////////////////////////////////////////////////////////////
//
// argv[1] == name of normal haplotype file
// argv[2] == number of normals
//
///////////////////////////////////////////////////////////////////////////

int
main(int argc, char* argv[])
{
    auto_ptr<SegmentProbability> segment(new LongestRunsProbability());
    auto_ptr<HDictionary> dictionary(new HDictionary(segment, true));

    cout << "argc: " << argc << endl;

    ifstream istr(argv[1]);
    if (argc <= 2) {
	dictionary->ReadDelimited(istr);
    } else {
	dictionary->ReadFrequencies(istr, atoi(argv[2]));
    }
    
    std::cout << *dictionary;
    
    return 0;
}
