コード例 #1
0
def test_mom_dad_child_sibling_roles(fixture_dirname, ped_file):
    families = FamiliesLoader.load_pedigree_file(fixture_dirname(ped_file))
    family = families.get("f1")
    role_builder = FamilyRoleBuilder(family)
    role_builder.build_roles()
    members = family.full_members

    assert members[0].role == Role.dad
    assert members[1].role == Role.mom
    assert members[2].role == Role.prb
    assert members[3].role == Role.sib
コード例 #2
0
    def _build_families_roles(families, pedigree_format):
        has_unknown_roles = any([
            p.role is None  # or p.role == Role.unknown
            for p in families.persons.values()
        ])

        if has_unknown_roles or pedigree_format.get("ped_no_role"):
            for family in families.values():
                logger.debug(f"building family roles: {family.family_id}")
                role_build = FamilyRoleBuilder(family)
                role_build.build_roles()
            families._ped_df = None
コード例 #3
0
def test_handling_of_family_with_only_prb_role(fixture_dirname):
    ped_file = fixture_dirname("pedigrees/pedigree_prb_only.ped")
    families = FamiliesLoader.load_pedigree_file(ped_file)
    family = families.get("f1")
    role_builder = FamilyRoleBuilder(family)
    role_builder.build_roles()
    members = family.full_members

    assert members[0].role == Role.dad
    assert members[1].role == Role.mom
    assert members[2].role == Role.prb
    assert members[3].role == Role.sib
コード例 #4
0
def test_child_and_spouse(fixture_dirname):
    ped_file = fixture_dirname("pedigrees/pedigree_no_role_D.ped")
    families = FamiliesLoader.load_pedigree_file(ped_file)
    family = families.get("f1")
    role_builder = FamilyRoleBuilder(family)
    role_builder.build_roles()
    members = family.full_members

    assert members[0].role == Role.dad
    assert members[1].role == Role.mom
    assert members[2].role == Role.prb
    assert members[3].role == Role.sib
    assert members[4].role == Role.spouse
    assert members[5].role == Role.child
コード例 #5
0
def test_paternal_and_maternal_grandparents(fixture_dirname):
    ped_file = fixture_dirname("pedigrees/pedigree_no_role_C.ped")
    families = FamiliesLoader.load_pedigree_file(ped_file)
    family = families.get("f1")
    role_builder = FamilyRoleBuilder(family)
    role_builder.build_roles()
    members = family.full_members

    assert members[0].role == Role.maternal_grandfather
    assert members[1].role == Role.maternal_grandmother
    assert members[2].role == Role.paternal_grandfather
    assert members[3].role == Role.paternal_grandmother
    assert members[4].role == Role.dad
    assert members[5].role == Role.mom
    assert members[6].role == Role.prb
    assert members[7].role == Role.sib
コード例 #6
0
def test_stepmom_and_stepdad(fixture_dirname):
    ped_file = fixture_dirname("pedigrees/pedigree_no_role_G.ped")
    families = FamiliesLoader.load_pedigree_file(ped_file)
    family = families.get("f1")
    role_builder = FamilyRoleBuilder(family)
    role_builder.build_roles()
    members = family.full_members

    assert members[0].role == Role.dad
    assert members[1].role == Role.mom

    assert members[2].role == Role.step_dad
    assert members[3].role == Role.step_mom

    assert members[4].role == Role.maternal_half_sibling
    assert members[5].role == Role.paternal_half_sibling
    assert members[6].role == Role.prb
    assert members[7].role == Role.sib
コード例 #7
0
def test_maternal_and_paternal_cousins(fixture_dirname):
    ped_file = fixture_dirname("pedigrees/pedigree_no_role_F.ped")
    families = FamiliesLoader.load_pedigree_file(ped_file)
    family = families.get("f1")
    role_builder = FamilyRoleBuilder(family)
    role_builder.build_roles()
    members = family.full_members

    assert members[0].role == Role.maternal_grandfather
    assert members[1].role == Role.maternal_grandmother
    assert members[2].role == Role.paternal_grandfather
    assert members[3].role == Role.paternal_grandmother
    assert members[4].role == Role.dad
    assert members[5].role == Role.mom
    assert members[6].role == Role.maternal_aunt
    assert members[7].role == Role.unknown
    assert members[8].role == Role.unknown
    assert members[9].role == Role.paternal_uncle
    assert members[10].role == Role.prb
    assert members[11].role == Role.sib
    assert members[12].role == Role.maternal_cousin
    assert members[13].role == Role.paternal_cousin