pybgen¶
pybgen
is a Python (2 and 3) BGEN file parser and writer (not quite
yet) released under the MIT licence.
For more information on how to use pybgen
, refer to the
API documentation. Below is a snippet describing the most
common usage of the module.
from pybgen import PyBGEN
with PyBGEN("simple/data/example.32bits.bgen") as bgen:
# Iterating over all variants
for info, dosage in bgen:
pass
# Getting the genotypes of as single variant
for info, dosage in bgen.get_variant("RSID_192"):
print(info)
print(dosage)