import argparse
import yaml
from subprocess import call
from train import train_bichrom

if __name__ == '__main__':
    # parsing
    parser = argparse.ArgumentParser(description='Train and Evaluate Bichrom')
    parser.add_argument('-training_schema_yaml', required=True,
                        help='YAML file with paths to train, test and val data')
    parser.add_argument('-len', help='Size of genomic windows',
                        required=True, type=int)
    parser.add_argument('-outdir', required=True, help='Output directory')
    parser.add_argument('-nbins', type=int, required=True, help='Number of bins')
    args = parser.parse_args()

    # load the yaml file with input data paths:
    with open(args.training_schema_yaml, 'r') as f:
        try:
            data_paths = yaml.safe_load(f)
        except yaml.YAMLError as exc:
            print(exc)
    # create the output directory:
    outdir = args.outdir
    call(['mkdir', outdir])

    train_bichrom(data_paths=data_paths, outdir=outdir, seq_len=args.len,
                  bin_size=int(args.len/args.nbins))
[((8, 13, 8, 78), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (), '', False, 'import argparse\n'), ((25, 4, 25, 27), 'subprocess.call', 'call', ({(25, 9, 25, 26): "['mkdir', outdir]"}, {}), "(['mkdir', outdir])", False, 'from subprocess import call\n'), ((20, 25, 20, 42), 'yaml.safe_load', 'yaml.safe_load', ({(20, 40, 20, 41): 'f'}, {}), '(f)', False, 'import yaml\n')]