#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Sebastian Kelm
# Created: 10/09/2009
#
# Revisions:
#



import sys, os.path
#import re
from array import array

if __name__ == "__main__":
  # Make sure we can import stuff from this file's directory
  sys.path.append(os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "..", "lib-python"))
  sys.path.append(os.path.abspath(os.path.dirname(sys.argv[0])))

from prosci.common import *
from prosci.util.ali import Ali
from prosci.util.gaps import *


if __name__ == "__main__":
    # We are running on the command line
    #
   
    import prosci.shell
    
    ################################
    # Command line option handling #
    ################################
    
    params = prosci.shell.Params(allowed=("help", "onlymain"), helpoption="help", usage="""
  Adds any number of entries to an existing tem file and prints everything to STDOUT.

  Entries must have the same sequence length as those in the tem file (not counting gaps).

  USAGE:
    $0 [OPTIONS] <fasta_file> [...]""", help="""
  OPTIONS:
      --help
          print this message and exit
        \n""")
    
    if (not params.args):
      params.writeHelp()
      sys.exit(1)
    
    for fasta_file in params.args:
      if fasta_file == "-":
        data = Ali(sys.stdin, ignore_duplicates=True, fasta_mode=True)
      else:
        data = Ali(file(fasta_file), ignore_duplicates=True, fasta_mode=True)
      
      print data

