def parent_child_pairs(lineage_string):
    """Turn a ";" separated lineage to a list of tuples for child parent

    Given a lineage string of the form

        'd__XXX;p__XXX;o__XXX;c__XXX;f__XXX;g_XXX;s__XXX'

    prepend 'root' and split it into parent-child pairs

    [
        ('root', 'd__XXX'),
        ('d__XXX', 'p__XXX'),
        ('p__XXX', 'o__XXX'),
        ...
    ]
    """
    with_root = ";".join(["root", lineage_string])
    lineage_list = with_root.split(";")
    pairs = []
    for i in range(0, len(lineage_list) - 1):
        parent, child = lineage_list[i], lineage_list[i + 1]
        pairs.append((parent, child))
    return pairs