#!python
# -*- coding: utf-8 -*-
import argparse
import os

def path_get():
    parser = argparse.ArgumentParser(description='Find potential inter-chromosome translocations.',
                                     prog='HiST',
                                     formatter_class=argparse.RawTextHelpFormatter,
                                     epilog='''
 HiST: Spectral Translocation detection of HiC matrices.
 Quick start: HiST -t the_hicfile_contains_translocations -c the_hicfile_control_sample -o the_path_of_output -j the_path_juicer_tools -d the_path_deDoc -s the_sizes_file_of_the_whole_choromosome  
 Control sample: could be normal cell lines or cancer neighbour tissue and so on, by yourself.                                     
 juicer_tools: recommand use the version which produces the .hic file in your experiment.                                     
 deDoc: please MUST use the version included in the HiST packages.
                                     ''')
    parser.add_argument("--test",'-t',required=True, 
                        help='Please input test hic file. For bulk HiC, .hic or .mcool format is recommanded, and for scHiC please input the directory path which include all cells you want to detect. For scHiC, .matrix is supported and the path format is cell_dir_path/cell_id/normalization/resolution/**.matrix, which is similar to the output tree of HiC-Pro.')
    parser.add_argument("--control",'-c',
                        default='./hic_default/GSE63525_IMR90_combined_30.hic', 
                        help='Please input control hic file (default: %(default)s).')
    parser.add_argument("--sizes",'-s',required=True,
                        default='./sizes/chrom_hg19.sizes',
                        help='Please input chromosome sizes file. The resolution is auto-adapted by the chromosome size. The equation we used can be found on the homepage.')
    parser.add_argument("--output",'-o',
                        default='.', 
                        help='Set the output path (default: current work directory).')
    parser.add_argument("--juice",'-j',
                        default='juice/juicer_tools_2.09.00.jar', 
                        help='Set the juicetool.jar path (default:%(default)s). If the format of input hicfile is .hic, juicer_tools is required.')
    parser.add_argument("--deDoc",'-d',
                        default='deDoc/deDoc.jar', 
                        help='Set the deDoc.jar path (default:%(default)s).')
    parser.add_argument("--no-figure",action='store_true',
                        help='Flag of translocation visualization.')
    parser.add_argument("--baseline",type=float,
                        default=0.4,
                        help='Set the translocation pairs range, the scale is [0,1](default:%(default)s). The smaller baseline, the fewer pairs out.')
    parser.add_argument("--normalization",
                        default="raw",
                        help='The normalization way of HiC pre-deal. Usually, it is raw or iced. In fact, the parameter is just for the path in scHiC pipeline.')
    parser.add_argument("--top",type=int,
                        default=0,
                        help='Set the translocation pairs range, output the top n pairs boxes.(default:%(default)s). The smaller top, the fewer pairs out.')
    parser.add_argument("--version",'-v',action='version',version='%(prog)s 1.4',
                        help='Print version.')
    args = parser.parse_args()
    return args

if __name__=="__main__":
    prog_args = path_get()
    from HiSTra.run_main import run_main
    run_main(prog_args)

    #### following part is test ####