示例#1
0
def do(context, case_path, run_all, step, use_family, force):
    """Perform action on a completed analysis."""
    mip_case = info.analysis(case_path)
    context.obj["case"] = mip_case
    context.obj["use_family"] = use_family

    # check if analysis is complete
    if not force and not mip_case.is_complete:
        logger.warn("analysis not finished")
        context.abort()

    if run_all:
        context.invoke(all_cmd)
    elif step:
        context.invoke(STEPS[step])
示例#2
0
def case(context, case_paths):
    """Monitor the status of an analysis (finished/running)."""
    if len(case_paths) == 0:
        logger.warn('no case paths given')
        context.abort()

    scout_db = scout_tools.ScoutDatabase(context.obj['mongodb'])

    case_infos = (analysis_info(info.analysis(case_path), scout_db)
                  for case_path in case_paths)

    headers = ['Customer', 'Case', 'Samples', 'MIP', 'Date', 'Complete',
               'In Scout', 'Up-to-date', 'Research']
    rows = (serialize_status(case_info) for case_info in case_infos)
    output = tabulate(rows, headers=headers, tablefmt='fancy_grid')
    click.echo(output)
示例#3
0
def traverse(context, step, cust_roots):
    """Upload all cases found by traversing the root directories."""
    if len(cust_roots) == 0:
        cust_roots = expand_paths(*context.obj.get("customer_roots", []))

    for case_path in automate.case_roots(*cust_roots):
        try:
            mip_case = info.analysis(case_path)
            if not mip_case.is_complete:
                logger.debug("skipping non-complete case: %s", case_path)
            elif "Path" not in mip_case._family["VCFFile"]["Clinical"]:
                logger.warn("analysis run in non-standard mode")
            elif step:
                logger.debug("processing %s: %s", case_path, step)
                context.invoke(do, case_path=case_path, step=step)
            else:
                logger.debug("processing case: %s", case_path)
                context.invoke(do, case_path=case_path, run_all=True)
        except Exception as error:
            logger.exception("unexpected error loading: %s", case_path)