/*
 * Copyright (C) 2013 Jordan Fish <fishjord at msu.edu>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package edu.msu.cme.rdp.alignment;

import edu.msu.cme.rdp.alignment.errorcheck.CompareErrorType;
import edu.msu.cme.rdp.alignment.errorcheck.RmPartialSeqs;
import edu.msu.cme.rdp.alignment.pairwise.PairwiseKNN;
import java.util.Arrays;

/**
 *
 * @author Jordan Fish <fishjord at msu.edu>
 */
public class AlignmentToolsMain {

    private static void printUsageAndExit() {
        System.err.println("USAGE: AlignmentToolsMain <subcommand> <options>");
        System.err.println("\talignment-merger     - Merge alignments");
        System.err.println("\tpairwise-knn         - Compute k-nearest-neighbors by pairwise alignment");
        System.err.println("\tcompare-error-type   - Detect insertion, deletion and substitution errors in sequences comparing to reference sequences");
        System.err.println("\talign-nucl-to-prot   - Transfer a sequence alignment from protein sequences to nucleotide sequences");
        System.err.println("\trm-partialseq        - remove partial sequences based on pairwise alignment to reference sequences");
        System.exit(1);
    }

    public static void main(String[] args) throws Exception {
        if(args.length < 1) {
            printUsageAndExit();
        }

        String command = args[0];
        args = Arrays.copyOfRange(args, 1, args.length);

        if(command.equals("alignment-merger")) {
            AlignmentMerger.main(args);
        } else if (command.equals("pairwise-knn")) {
            PairwiseKNN.main(args);
        } else if (command.equals("compare-error-type")) {
            CompareErrorType.main(args);
        } else if (command.equals("paired-end-assembler")) {
            PairedReadAssembler.main(args);
        }  else if (command.equals("align-nucl-to-prot")) {
            AlignNucleotideToProtein.main(args);
        } else if (command.equals("rm-partialseq")) {
            RmPartialSeqs.main(args);
        }else {
            printUsageAndExit();
            System.err.println("Unknown command: " + command);
        }
    }
}
