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))
[((143, 208), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train and Evaluate Bichrom"""'}), "(description='Train and Evaluate Bichrom')\n", (166, 208), False, 'import argparse\n'), ((937, 960), 'subprocess.call', 'call', (["['mkdir', outdir]"], {}), "(['mkdir', outdir])\n", (941, 960), False, 'from subprocess import call\n'), ((794, 811), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (808, 811), False, 'import yaml\n')]