snipar.pedigree module

class snipar.pedigree.Person(id, fid=None, pid=None, mid=None)[source]

Bases: object

Just a simple data structure representing individuals

Args:
idstr

IID of the individual.

fidstr

FID of the individual.

pidstr

IID of the father of that individual.

midstr

IID of the mother of that individual.

snipar.pedigree.create_pedigree(king_address, agesex_address, same_parents_in_ped=True)[source]

Creates pedigree table from agesex file and kinship file in KING format.

Args:
king_addressstr

Address of a kinship file in KING format. kinship file is a ‘ ‘ seperated csv with columns “FID1”, “ID1”, “FID2”, “ID2, “InfType”. Each row represents a relationship between two individuals. InfType column states the relationship between two individuals. The only relationships that matter for this script are full sibling and parent-offspring which are shown by ‘FS’ and ‘PO’ respectively. This file is used in creating a pedigree file and can be generated using KING. As fids starting with ‘_’ are reserved for control there should be no fids starting with ‘_’.

agesex_addressstr

Address of the agesex file. This is a ” ” seperated CSV with columns “FID”, “IID”, “FATHER_ID”, “MOTHER_ID”, “sex”, “age”. Each row contains the age and sex of one individual. Male and Female sex should be represented with ‘M’ and ‘F’. Age column is used for distinguishing between parent and child in a parent-offspring relationship inferred from the kinship file. ID1 is a parent of ID2 if there is a ‘PO’ relationship between them and ‘ID1’ is at least 12 years older than ID2.

Returns:
pd.DataFrame:

A pedigree table with ‘FID’, ‘IID’, ‘FATHER_ID’, ‘MOTHER_ID’. Each row represents an individual.

snipar.pedigree.find_individuals_with_sibs(ids, ped, gts_ids, return_ids_only=False)[source]

Used in get_gts_matrix and get_fam_means to find the individuals in ids that have genotyped siblings.

snipar.pedigree.get_sibpairs_from_king(kinfile)[source]
snipar.pedigree.get_sibpairs_from_ped(ped)[source]