snipar.preprocess module

snipar.preprocess.find_par_gts(pheno_ids, ped, gts_id_dict, imp_fams=None)[source]

Used in get_gts_matrix to find whether individuals have imputed or observed parental genotypes, and to find the indices of the observed/imputed parents in the observed/imputed genotype arrays. ‘par_status’ codes whether an individual has parents that are observed or imputed or neither. ‘gt_indices’ records the relevant index of the parent in the observed/imputed genotype arrays ‘fam_labels’ records the family of the individual based on the pedigree

snipar.preprocess.get_fam_means(ids, ped, gts, gts_ids, remove_proband=True, return_famsizes=False)[source]

Used in get_gts_matrix to find the mean genotype in each sibship (family) for each SNP or for a PGS. The gtarray that is returned is indexed based on the subset of ids provided from sibships of size 2 or greater. If remove_proband=True, then the genotype/PGS of the index individual is removed from the fam_mean given for that individual.

snipar.preprocess.get_indices_given_ped(ped, gts_ids, imp_fams=None, ids=None, sib=False, verbose=False)[source]

Used in get_gts_matrix_given_ped to get the ids of individuals with observed/imputed parental genotypes and, if sib=True, at least one genotyped sibling. It returns those ids along with the indices of the relevant individuals and their first degree relatives in the observed genotypes (observed indices), and the indices of the imputed parental genotypes for those individuals.

snipar.preprocess.make_gts_matrix(gts, par_status, gt_indices, imp_gts=None, parsum=False)[source]

Used in get_gts_matrix to construct the family based genotype matrix given observed/imputed genotypes. ‘gt_indices’ has the indices in the observed/imputed genotype arrays; and par_status codes whether the parents are observed (0) or imputed (1).