#!/usr/bin/env python3

# Author: Roujia Li
# email: Roujia.li@mail.utoronto.ca

from TileSeqMut.main import main
import argparse

parser = argparse.ArgumentParser(description='TileSeq mutation counts')
# user input arguments
parser.add_argument("-f", "--fastq", help="Path to all fastq files you want to analyze", type=str)
parser.add_argument("-o", "--output", help="Output folder", type=str, required=True)
parser.add_argument("-p", "--param", help="csv paramter file", type=str, required=True)
parser.add_argument("-n", "--name", help="Name for this run", type=str, required=True)
parser.add_argument("--skip_alignment", action="store_true", help="skip alignment for this analysis, "
                                                                  "ONLY submit jobs for counting mutations in existing output folder")
parser.add_argument("-r1", help="r1 SAM file", type=str)
parser.add_argument("-r2", help="r2 SAM file", type=str)

# user input arguments with default values set
parser.add_argument("-log", "--log_level", help="set log level: debug, \
    info, warning, error, critical. (default = info)", type=str, default="info")
parser.add_argument("-env", "--environment", help="The cluster used to \
    run this script (default = DC)", type=str, default="DC")
parser.add_argument("-at", type=int, help="Alignment time \
    (default = 8h)", default=8)
parser.add_argument("-mt", type=int, help="Mutation call time \
    (default = 36h)", default=36)
parser.add_argument("-mm", type=int, help="Mutation call request memory \
        (default = 15GB)", default=15)
parser.add_argument("-c", type=int, help="Number of cores", default=16)
parser.add_argument("-b", "--base", help="ASCII code base", default=33)
parser.add_argument("-test", action="store_true", help="Turn on testing mode")
parser.add_argument("-rc", action="store_true", help="Turn on rc mode, both direction of the reads will be "
                                                     "aligned to the reference. Variant calling will be "
                                                     "performed on all the reads that are aligned (BE CAREFUL!)")

parser.add_argument("-override", "--sr_Override", action="store_true",
                    help="Provide this argument when there is only one replicate")
parser.add_argument("--posteriorQC", action="store_true", help="Turn on posterior QC mode, this requires more "
                                                               "memory and runtime, please change the variable "
                                                               "accordingly")
parser.add_argument("--wt_override", action="store_true", help="When no wt conditions defined in the parameter sheet, turn on this option will treat EVERYTHING as wt. Phred scores will be adjusted based on the first replicate")

parser.add_argument("--calibratePhredWT", action="store_true", help="When this parameter is provided, use wt to calibrate phred scores")
parser.add_argument("--calibratePhredPhix", action="store_true", help="When this parameter is provided, use phix alignments to calibrate phred scores")

parser.add_argument("--resubmit", action="store_true", help="For a finished run, batch resubmit failed scripts (if any)")
args = parser.parse_args()
# print("TileSeqMut release 0.2.1: Supports multiprocess")
print("TileSeqMut release 0.6.4: updated merge runs")
main(args)
