Exemplo n.º 1
0
def load_cfg_and_run(pth, compare=True, fails=False):

    try:
        # This is a crappy way to do it, but it works
        if "DNA" in pth or "rerun" in pth:
            dt = "DNA"
        else:
            dt = "protein"
        cfg = config.Configuration(dt)
        cfg.load_base_path(pth)
        method = analysis_method.choose_method(cfg.search)
        rpt = reporter.TextReporter(cfg)
        meth = method(cfg, rpt, force_restart=False, threads=-1)
        results = meth.analyse()
        if compare:
            results.compare(cfg)

        # Note -- we only get here if everything completes
        # Failed tests leave shit around!
    finally:
        # If it fails, but we expect it to, then clean up
        if fails:
            cleanup(cfg)
        cfg.reset()

    if not fails: # Might already be done
        cleanup(cfg)
def load_cfg_and_run(name):
    try:
        pth = os.path.join(QUICK_PATH, name)
        cfg = config.Configuration()
        cfg.load_base_path(pth)
        method = analysis_method.choose_method(cfg.search)
        rpt = reporter.TextReporter(cfg)
        meth = method(cfg, rpt, True, False)
        results = meth.analyse()
    finally:
        # Always do this
        shutil.rmtree(cfg.full_output_path)
        cfg.reset()