#!/usr/bin/env python3

import phylip
import sys

#Version  1/29/2007
# Run seqboot as a command
#Synopsis: seqboot.csh infile datatype rseed method replicates\
#              percent blocksize outweights outformat outfile

# Notes:
#   1. outformat must agree with the format of infile. If you want
#   seqboot to produce an interleaved file (outformat=i) infile
#   must be interleaved. If you want a sequential format file,
#   (outformat = s), then infile must be in sequential format.
#   2. Discrete state data (eg. rest sites) MUST be in 
#   sequential format.
#   3. If outweights = yes, weights are written to $OUTFILE
#      otherwise, sequences are written.

""" ensure that there are enough command line arguments to parse """
import phylip

if len(sys.argv) < 11:
    print("Usage: discdist.test.py  INFILE  DATATYPE  RSEED  METHOD  REPLICATES  PERCENT  BLOCKSIZE")
    print("         OUTWEIGHTS  OUTFORMAT  OUTFILE")
    exit();

#Convert arguments to variables
INFILE      = sys.argv[1]
DATATYPE    = sys.argv[2]
RSEED       = sys.argv[3]
METHOD      = sys.argv[4]
REPLICATES  = sys.argv[5]
PERCENT     = sys.argv[6]
BLOCKSIZE   = sys.argv[7]
OUTWEIGHTS  = sys.argv[8]
OUTFORMAT   = sys.argv[9]
OUTFILE     = sys.argv[10]


phylip.seqboot (INFILE, DATATYPE, RSEED, METHOD, REPLICATES, PERCENT, BLOCKSIZE, OUTWEIGHTS, OUTFORMAT, OUTFILE)
