Exemple #1
0
def main(opt):
    logging.getLogger().setLevel(logging.DEBUG if opt.v else logging.INFO)

    base_dict = dict(lazy_wl=False,
                     rank_fail=True,
                     use_maxrep=opt.use_maxrep,
                     load_maxrep=opt.load_maxrep,
                     load_cst=opt.load_cst,
                     space_usage=True,
                     time_usage=True,
                     answer=False)
    for i, pref in enumerate(opt.prefixes):
        ispec = MsInput.basedir_form(opt.base_dir, pref)
        command = MsInterface.command_from_dict(
            dict(s_path=ispec.s_path, t_path=ispec.t_path, **base_dict))

        for j in range(opt.repeat):
            with open(opt.output, 'a') as fd:
                res = get_output(command)
                if i + j == 0:
                    fd.write(res[0] + ",label,b_path\n")
                for line in res[1:]:
                    fd.write(
                        line.replace(" ", "") + ("," + opt.label) +
                        ("," + pref) + "\n")
def main(opt):
    logging.getLogger().setLevel(logging.DEBUG if opt.v else logging.INFO)

    base_dict = dict(lazy_wl=opt.lazy_wl,
                     sada=opt.sada,
                     load_cst=opt.load_cst,
                     space_usage=True,
                     time_usage=True,
                     answer=False,
                     runs_progress=opt.runs_progress,
                     ms_progress=opt.ms_progress)
    for i, pref in enumerate(opt.prefixes):
        bpath = os.path.join(opt.base_dir, pref)
        command = MsInterface.command_from_dict(
            dict(s_path=bpath + ".s", t_path=bpath + ".t", **base_dict))

        for j in range(opt.repeat):
            with open(opt.output, 'a') as fd:
                res = get_output(command)
                if i + j == 0:
                    fd.write(res[0] + ",label,b_path\n")
                for line in res[1:]:
                    fd.write(
                        line.replace(" ", "") + ("," + opt.label) +
                        ("," + os.path.basename(bpath)) + "\n")
Exemple #3
0
def fast(opt, ms_input):
    params = dict(lazy_wl=opt.lazy_wl,
                  rank_fail=opt.rank_fail,
                  lca_parents=opt.lca_parents,
                  use_maxrep=opt.use_maxrep,
                  nthreads=opt.nthreads,
                  answer=True,
                  s_path=ms_input.s_path,
                  t_path=ms_input.t_path)
    return MsInterface.command_from_dict(params)
Exemple #4
0
def main(opt):
    logging.getLogger().setLevel(logging.DEBUG if opt.v else logging.INFO)
    if opt.output != '/dev/stdout' and os.path.exists(opt.output):
        LG.error("output file (%s) exsts. Exiting ...", opt.output)
        return 1
    command = MsInterface.command_from_dict(vars(opt))

    pref = os.path.basename(opt.s_path).replace(".s", "")
    header_suff = ",".join(['label', opt.repeat_colname, 'b_path'])
    for j in range(opt.repeat):
        with open(opt.output, 'a') as fd:
            res = get_output(command)
            if j == 0:
                fd.write(res[0] + "," + header_suff + "\n")
            for line in res[1:]:
                fd.write(line.replace(" ", "") +
                         ("," + opt.label) +
                         ("," + str(j + 1)) +
                         ("," + pref) + "\n")
Exemple #5
0
def main(opt):
    logging.getLogger().setLevel(logging.DEBUG if opt.v else logging.INFO)

    base_dict = dict(t_path=opt.t_path,
                     lazy_wl=opt.lazy_wl,
                     sada=False,
                     space_usage=False,
                     time_usage=False,
                     answer=True,
                     load_cst=opt.load_cst,
                     runs_progress=opt.runs_progress,
                     ms_progress=opt.ms_progress)
    base_dir = os.path.dirname(opt.t_path)
    out_paths = []
    for i, s_path in enumerate(
            glob.glob(base_dir + "/" + opt.species + "*.juststring")):
        out_path = "%s__%s" % (opt.t_path.replace(".juststring", ""),
                               os.path.basename(
                                   s_path.replace(".juststring", "")))
        command = MsInterface.ms_command_from_dict(
            dict(s_path=s_path, out_path=out_path, **base_dict))
        print command
Exemple #6
0
            res = get_output(command)
            if j == 0:
                fd.write(res[0] + "," + header_suff + "\n")
            for line in res[1:]:
                fd.write(line.replace(" ", "") +
                         ("," + opt.label) +
                         ("," + str(j + 1)) +
                         ("," + pref) + "\n")


if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser(
            description=__doc__,
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
            epilog="Olgert Denas ([email protected])")

    for k in MsInterface.params:
        args, kwargs = MsInterface.as_argparse_kwds(k)
        arg_parser.add_argument(*args, **kwargs)
    verbose_args(arg_parser)
    arg_parser.add_argument("--repeat", type=int, default=1,
                            help="repeat experiment")
    arg_parser.add_argument("--label", type=str, default='default',
                            help="ad a label column to output")
    arg_parser.add_argument("--repeat_colname", type=str, default='ntrial',
                            help="col label corresponding to the repeat nr.")
    arg_parser.add_argument("--output", type=str, default='/dev/stdout',
                            help="output")

    sys.exit(main(arg_parser.parse_args()))
Exemple #7
0
def main(opt):
    logging.getLogger().setLevel(logging.DEBUG if opt.v else logging.INFO)
    LG.debug("running on S=%s, T=%s", opt.s_path, opt.t_path)
    command = MsInterface.ms_command_from_dict(vars(opt))
    LG.debug("running: " + str(command))
    subprocess.check_call(command, shell=True)