The output stream to write to
Schema of the input rows
If true, write the header
Number of variants (for the header)
Number of bits used to represent each genotype/haplotype probability value
If ploidy is missing, it is inferred as some value in [1, maxPloidy]
If phasing and ploidy are missing or the inferred ploidy is ambiguous, we assume ploidy is defaultPloidy
If phasing is missing and the inferred phasing is ambiguous, we assume phasing is defaultPhasing
# Bytes | Description
# Bytes | Description
4 | Number of samples ----------------------------------------------------------------------------------------------- 2 | Number of alleles ----------------------------------------------------------------------------------------------- 1 | Minimum ploidy of samples ----------------------------------------------------------------------------------------------- 1 | Maximum ploidy of samples ----------------------------------------------------------------------------------------------- N | The nth byte represents the ploidy and missingness of the nth sample. Ploidy is | encoded in the least significant 6 bits of this value. Missingness is encoded by the | most significant bit (1 if missing). ----------------------------------------------------------------------------------------------- 1 | 1 if phased, 0 if unphased ----------------------------------------------------------------------------------------------- 1 | Number of bits used to store each probability = B ----------------------------------------------------------------------------------------------- X | Probabilities for each possible haplotype (if phased)/genotype (if unphased) -----------------------------------------------------------------------------------------------
A Bgen file consists of a header followed by M variant data blocks.
A Bgen file consists of a header followed by M variant data blocks. Variant data blocks consist of: - Variant identifying data - Genotype data block
# Bytes | Description
# Bytes | Description
4 | Total length of the the rest of the data for this variant = C -------------------------------------------------------------------------------------- 4 | Total length of the probability data after decompression = D -------------------------------------------------------------------------------------- C-4 | Genotype probability data for each of the N samples: decompressed to D bytes --------------------------------------------------------------------------------------
Writes BGEN records.