#!/opt/anaconda1anaconda2anaconda3/bin/python
"""MAGeCK main program
Copyright (c) 2015 Wei Li, Han Xu, Xiaole Liu lab 
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).
@status:  experimental
@version: $Revision$
@author:  Wei Li 
@contact: li.david.wei AT gmail.com
"""


from __future__ import print_function
import sys
import argparse
import random
import bisect
import logging

if True:
  # for release version of mageck
  from mageck import *
  from mageck.crisprFunction import *
  from mageck.mageckCount import *
  from mageck.pathwayFunc import *
  from mageck.argsParser import *
  from mageck.testVisual import *
  from mageck.version import __version__
else:
  # for beta test only
  from mageck_db import *
  from mageck_db.crisprFunction import *
  from mageck_db.mageckCount import *
  from mageck_db.pathwayFunc import *
  from mageck_db.argsParser import *
  from mageck_db.testVisual import *



# main function
def main():
  args=crisprseq_parseargs();
  logging.info('Welcome to MAGeCK v'+__version__+'. Command: '+args.subcmd);
  # get read counts
  if args.subcmd == 'run' or args.subcmd == 'count':
    mageckcount_main(args);
  
  # stat test
  if args.subcmd == 'run' or args.subcmd == 'test':
    magecktest_main(args);
  
  # pathway test
  if args.subcmd == 'pathway':
    mageck_pathwaytest(args);
  
  # visualizaiton
  if args.subcmd == 'plot':
    plot_main(args);
      
      


if __name__ == '__main__':
  try:
    main();
  except KeyboardInterrupt:
    sys.stderr.write("User interrupt me! ;-) Bye!\n")
    sys.exit(0)

