scglue.genomics.window_graph
- scglue.genomics.window_graph(left, right, window_size, left_sorted=False, right_sorted=False, attr_fn=None)[source]
Construct a window graph between two sets of genomic features, where features pairs within a window size are connected.
- Parameters:
left (
typing.Union[scglue.genomics.Bed,str]) – First feature set, either aBedobject or path to a bed fileright (
typing.Union[scglue.genomics.Bed,str]) – Second feature set, either aBedobject or path to a bed filewindow_size (
int) – Window size (in bp)left_sorted (
bool) – Whetherleftis already sortedright_sorted (
bool) – Whetherrightis already sortedattr_fn (
typing.Optional[typing.Callable[[pybedtools.cbedtools.Interval,pybedtools.cbedtools.Interval,float],typing.Mapping[str,typing.Any]]]) –Function to compute edge attributes for connected features, should accept the following three positional arguments:
l: left interval
r: right interval
d: signed distance between the intervals
By default no edge attribute is created.
- Return type:
- Returns:
graph – Window graph