sgkit.window_by_genome#

sgkit.window_by_genome(ds, *, merge=True)#

Add a window spanning the whole genome to a dataset.

The window can be used by some downstream functions to calculate whole-genome statistics.

Parameters:
ds Dataset

Genotype call dataset.

merge bool (default: True)

If True (the default), merge the input dataset and the computed output variables into a single dataset, otherwise return only the computed output variables. See Dataset merge behavior for more details.

Return type:

Dataset

Returns:

: A dataset containing the following variables:

Examples

>>> import sgkit as sg
>>> ds = sg.simulate_genotype_call_dataset(n_variant=10, n_sample=2, n_contig=2)
>>> sg.window_by_genome(ds, merge=False)
<xarray.Dataset> Size: 16B
Dimensions:       (windows: 1)
Dimensions without coordinates: windows
Data variables:
    window_start  (windows) int64 8B 0
    window_stop   (windows) int64 8B 10