Beispiel #1
0
def config(context, out, vtype, madeline_path):
    """Create a scout config file."""
    mip_case = context.obj["case"]
    scout_data = mip_case.scout_config(vtype)
    if madeline_path:
        scout_data["madeline"] = os.path.abspath(madeline_path)

    if context.obj["use_family"]:
        # rename samples to use unique sample ids with family id
        new_inds = {}
        for ind_id, ind_data in scout_data["individuals"].items():
            new_indid = "{}-{}".format(mip_case.family_id, ind_id)
            ind_data["name"] = new_indid
            new_inds[new_indid] = ind_data
        scout_data["individuals"] = new_inds

    ini_lines = scout_tools.write_ini(scout_data)
    click.echo("\n".join(ini_lines).decode("utf-8"), file=out)
def test_write_ini():
    data = {'name': 'P.T. Anderson', 'occupation': 'Master'}
    data_str = scout_tools.write_ini(data)
    assert len(data_str) == 2
    assert ConfigObj(data_str) == data