sgkit.window_by_interval#
- sgkit.window_by_interval(ds, *, variant_contig='variant_contig', variant_position='variant_position', interval_contig_name='interval_contig_name', interval_start='interval_start', interval_stop='interval_stop', merge=True)#
Add window information to a dataset, using arbitrary intervals.
Intervals are defined using the variables
interval_contig_name
,interval_start
, andinterval_stop
, where the start and stop range acts like a Python slice, so the start position is inclusive, and the stop position is exclusive.Windows are defined over the
variants
dimension, and are used by some downstream functions to calculate statistics for each window. Windows never span contigs.- Parameters:
- ds
Dataset
Genotype call dataset.
- variant_contig
Hashable
(default:'variant_contig'
) Name of variable containing variant contig indexes. Defined by
sgkit.variables.variant_contig_spec
.- variant_position
Hashable
(default:'variant_position'
) Name of variable containing variant positions. Must be monotonically increasing within a contig. Defined by
sgkit.variables.variant_position_spec
.- interval_contig_name
Hashable
(default:'interval_contig_name'
) Name of variable containing interval contig names. Defined by
sgkit.variables.interval_contig_name_spec
.- interval_start
Hashable
(default:'interval_start'
) Name of variable containing interval start positions. Defined by
sgkit.variables.interval_start_spec
.- interval_stop
Hashable
(default:'interval_stop'
) Name of variable containing interval stop positions. Defined by
sgkit.variables.interval_stop_spec
.- 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.
- ds
- Return type:
- Returns:
: A dataset containing the following variables:
sgkit.variables.window_contig_spec
(windows): The index values of window contigs.sgkit.variables.window_start_spec
(windows): The index values of window start positions.sgkit.variables.window_stop_spec
(windows): The index values of window stop positions.