limix.stats.compute_dosage¶
- limix.stats.compute_dosage(X, alt=None)[source]¶
Compute dosage from allele expectation.
- Parameters
X (array_like) – Allele expectations encoded as a variants-by-samples-by-alleles matrix.
ref (array_like) – Allele reference of each locus. The allele having the minor allele frequency for the provided
X
is used as the reference if None. Defaults toNone
.
- Returns
dosage – Dosage encoded as a variants-by-samples matrix.
- Return type
ndarray
Example
>>> from bgen_reader import read_bgen, allele_expectation, example_files >>> from bgen_reader import compute_dosage >>> >>> with example_files("example.32bits.bgen") as filepath: ... bgen = read_bgen(filepath, verbose=False) ... variant_idx = 2 ... e = allele_expectation(bgen, variant_idx) ... dosage = compute_dosage(e) ... print(dosage[:5]) [0.01550294 0.99383543 1.97933958 0.99560547 1.97879027]