snipar.pgs module
- snipar.pgs.am_adj_2gen(estimates, estimate_cols, h2f, h2f_se, rk=None, rk_se=None, pg=None, y_std=1, pg_std=1)[source]
Adjust 2-generation model results for assortative mating (assuming equilibrium)
- snipar.pgs.am_adj_2gen_calc(delta, delta_se, ab, ab_se, r_delta_ab, h2f, h2f_se, rk, rk_se, is_beta=False, verbose=True)[source]
- snipar.pgs.compute(pgs, bedfile=None, bgenfile=None, par_gts_f=None, ped=None, sib=False, compute_controls=False, verbose=True, batch_size=None)[source]
Compute a polygenic score (PGS) for the individuals with observed genotypes and observed/imputed parental genotypes.
- Args:
- par_gts_f
str
path to HDF5 file with imputed parental genotypes
- gts_f
str
path to bed file with observed genotypes
- pgs
snipar.pgs
the PGS, defined by the weights for a set of SNPs and the alleles of those SNPs
- sib
bool
Compute the PGS for genotyped individuals with at least one genotyped sibling and observed/imputed parental genotypes. Default False.
- compute_controls
bool
Compute polygenic scores for control families (families with observed parental genotypes set to missing). Default False.
- par_gts_f
- Returns:
- pg
snipar.gtarray
Return the polygenic score as a genotype array with columns: individual’s PGS, mean of their siblings’ PGS, observed/imputed paternal PGS, observed/imputed maternal PGS
- pg
- snipar.pgs.fit_pgs_model(y, pg, ngen, ibdrel_path=None, covariates=None, fit_sib=False, parsum=False, gparsum=False, outprefix=None, sparse_thresh=0.025)[source]
- snipar.pgs.make_and_fit_model(y, pg, pg_cols, ibdrel_path=None, covariates=None, sparse_thresh=0.025)[source]
- class snipar.pgs.pgarray(garray, ids, sid=None, alleles=None, pos=None, chrom=None, map=None, error_probs=None, fams=None, par_status=None, ped=None)[source]
Bases:
gtarray
- class snipar.pgs.pgs(snp_ids, weights, alleles)[source]
Bases:
object
Define a polygenic score based on a set of SNPs with weights and ref/alt allele pairs.
- Args:
- snp_ids
array
[L] vector of SNP ids
- weights
array
[L] vector of weights of equal length to snp_ids
- alleles
array
[L x 2] matrix of ref and alt alleles for the SNPs. L must match size of snp_ids
- snp_ids
- Returns:
pgs :
snipar.pgs
- compute(garray, cols=None)[source]
Compute polygenic score values from a given genotype array. Finds the SNPs in the genotype array that have weights in the pgs and matching alleles, and computes the PGS based on these SNPs and the weights after allele-matching.
- Args:
- garray
sbreg.gtarray
genotype array to compute PGS values for
- cols
numpy:numpy.array
names to give the columns in the output gtarray
- garray
- Returns:
- pg
snipar.gtarray
2d gtarray with PGS values. If a 3d gtarray is input, then each column corresponds to the second dimension on the input gtarray (for example, individual, paternal, maternal PGS). If a 2d gtarray is input, then there will be only one column in the output gtarray. The names given in ‘cols’ are stored in ‘sid’ attribute of the output.
- pg