def bgen_to_zarr(input: PathType, output: Union[(PathType, MutableMapping[(str, bytes)])], region: Optional[Mapping[(Hashable, Any)]]=None, chunk_length: int=10000, chunk_width: int=1000, temp_chunk_length: int=100, compressor: Optional[Any]=zarr.Blosc(cname='zstd', clevel=7, shuffle=2), probability_dtype: Optional[DType]='uint8', max_mem: str='4GB', pack: bool=True, tempdir: Optional[PathType]=None) -> Dataset:
    'Convert a BGEN file to a Zarr on-disk store.\n\n    This function is a convenience for calling :func:`read_bgen` followed by\n    :func:`rechunk_bgen`.\n\n    Parameters\n    ----------\n    input\n        Path to local BGEN dataset.\n    output\n        Zarr store or path to directory in file system.\n    region\n        Indexers on dataset dimensions used to define a subset of data to convert.\n        Must be None or a dict with keys matching dimension names and values\n        equal to integers or slice objects. This is passed directly to `Dataset.isel`\n        so it has the same semantics.\n    chunk_length\n        Length (number of variants) of chunks in which data are stored, by default 10_000.\n    chunk_width\n        Width (number of samples) to use when storing chunks in output, by default 1_000.\n    temp_chunk_length\n        Length of chunks used in raw BGEN read, by default 100. This defines the vertical\n        chunking (i.e. in the variants dimension) used when reading the raw data and because\n        there is no horizontal chunking at this phase (i.e. in the samples dimension), this\n        value should be much smaller than the target `chunk_length`.\n    compressor\n        Zarr compressor, by default Blosc + zstd with compression level 7. No compression\n        is used when set as None.\n    probability_dtype\n        Data type used to encode genotype probabilities, must be either uint8 or uint16.\n        Setting this parameter results in a loss of precision. If None, probabilities\n        will not be altered when stored.\n    max_mem\n        The amount of memory (in bytes) that workers are allowed to use. A string\n        (e.g. 100MB) can also be used.\n    pack\n        Whether or not to optimize variable representations by removing unnecessary\n        dimensions and elements. This includes storing 2 genotypes instead of 3, omitting\n        dosage and collapsing the genotype probability mask to 2 dimensions. All of\n        the above are restored in the resulting Dataset at the expense of extra\n        computations on read.\n    tempdir\n        Temporary directory where intermediate files are stored. The default None means\n        use the system default temporary directory.\n\n    Warnings\n    --------\n    This functional is only applicable to diploid, bi-allelic BGEN datasets.\n\n    Returns\n    -------\n    Dataset\n        The rechunked dataset.\n    '
    ds = read_bgen(input, chunks=(temp_chunk_length, (- 1), (- 1)))
    if (region is not None):
        ds = ds.isel(indexers=region)
    return rechunk_bgen(ds, output, chunk_length=chunk_length, chunk_width=chunk_width, compressor=compressor, probability_dtype=probability_dtype, max_mem=max_mem, pack=pack, tempdir=tempdir)
Convert a BGEN file to a Zarr on-disk store.

This function is a convenience for calling :func:`read_bgen` followed by
:func:`rechunk_bgen`.

Parameters
----------
input
    Path to local BGEN dataset.
output
    Zarr store or path to directory in file system.
region
    Indexers on dataset dimensions used to define a subset of data to convert.
    Must be None or a dict with keys matching dimension names and values
    equal to integers or slice objects. This is passed directly to `Dataset.isel`
    so it has the same semantics.
chunk_length
    Length (number of variants) of chunks in which data are stored, by default 10_000.
chunk_width
    Width (number of samples) to use when storing chunks in output, by default 1_000.
temp_chunk_length
    Length of chunks used in raw BGEN read, by default 100. This defines the vertical
    chunking (i.e. in the variants dimension) used when reading the raw data and because
    there is no horizontal chunking at this phase (i.e. in the samples dimension), this
    value should be much smaller than the target `chunk_length`.
compressor
    Zarr compressor, by default Blosc + zstd with compression level 7. No compression
    is used when set as None.
probability_dtype
    Data type used to encode genotype probabilities, must be either uint8 or uint16.
    Setting this parameter results in a loss of precision. If None, probabilities
    will not be altered when stored.
max_mem
    The amount of memory (in bytes) that workers are allowed to use. A string
    (e.g. 100MB) can also be used.
pack
    Whether or not to optimize variable representations by removing unnecessary
    dimensions and elements. This includes storing 2 genotypes instead of 3, omitting
    dosage and collapsing the genotype probability mask to 2 dimensions. All of
    the above are restored in the resulting Dataset at the expense of extra
    computations on read.
tempdir
    Temporary directory where intermediate files are stored. The default None means
    use the system default temporary directory.

Warnings
--------
This functional is only applicable to diploid, bi-allelic BGEN datasets.

Returns
-------
Dataset
    The rechunked dataset.
def bgen_to_zarr(input: PathType, output: Union[(PathType, MutableMapping[(str, bytes)])], region: Optional[Mapping[(Hashable, Any)]]=None, chunk_length: int=10000, chunk_width: int=1000, temp_chunk_length: int=100, compressor: Optional[Any]=zarr.Blosc(cname='zstd', clevel=7, shuffle=2), probability_dtype: Optional[DType]='uint8', max_mem: str='4GB', pack: bool=True, tempdir: Optional[PathType]=None) -> Dataset:
    'Convert a BGEN file to a Zarr on-disk store.\n\n    This function is a convenience for calling :func:`read_bgen` followed by\n    :func:`rechunk_bgen`.\n\n    Parameters\n    ----------\n    input\n        Path to local BGEN dataset.\n    output\n        Zarr store or path to directory in file system.\n    region\n        Indexers on dataset dimensions used to define a subset of data to convert.\n        Must be None or a dict with keys matching dimension names and values\n        equal to integers or slice objects. This is passed directly to `Dataset.isel`\n        so it has the same semantics.\n    chunk_length\n        Length (number of variants) of chunks in which data are stored, by default 10_000.\n    chunk_width\n        Width (number of samples) to use when storing chunks in output, by default 1_000.\n    temp_chunk_length\n        Length of chunks used in raw BGEN read, by default 100. This defines the vertical\n        chunking (i.e. in the variants dimension) used when reading the raw data and because\n        there is no horizontal chunking at this phase (i.e. in the samples dimension), this\n        value should be much smaller than the target `chunk_length`.\n    compressor\n        Zarr compressor, by default Blosc + zstd with compression level 7. No compression\n        is used when set as None.\n    probability_dtype\n        Data type used to encode genotype probabilities, must be either uint8 or uint16.\n        Setting this parameter results in a loss of precision. If None, probabilities\n        will not be altered when stored.\n    max_mem\n        The amount of memory (in bytes) that workers are allowed to use. A string\n        (e.g. 100MB) can also be used.\n    pack\n        Whether or not to optimize variable representations by removing unnecessary\n        dimensions and elements. This includes storing 2 genotypes instead of 3, omitting\n        dosage and collapsing the genotype probability mask to 2 dimensions. All of\n        the above are restored in the resulting Dataset at the expense of extra\n        computations on read.\n    tempdir\n        Temporary directory where intermediate files are stored. The default None means\n        use the system default temporary directory.\n\n    Warnings\n    --------\n    This functional is only applicable to diploid, bi-allelic BGEN datasets.\n\n    Returns\n    -------\n    Dataset\n        The rechunked dataset.\n    '
    ds = read_bgen(input, chunks=(temp_chunk_length, (- 1), (- 1)))
    if (region is not None):
        ds = ds.isel(indexers=region)
    return rechunk_bgen(ds, output, chunk_length=chunk_length, chunk_width=chunk_width, compressor=compressor, probability_dtype=probability_dtype, max_mem=max_mem, pack=pack, tempdir=tempdir)