GroupedGRanges

GroupedGRanges

A GroupedGRanges object is a collection of groups of genomic ranges, inspired by the GRangesList class from the Bioconductor ecosystem. Each group consists of a GRanges object of arbitrary length, which is most often used to represent a multi-exon gene. The GroupedGRanges can be considered a vector of groups, and defines methods for the following generics:

Our implementation re-uses Bioconductor's strategy of storing the groups in a single concatenated GRanges. This improves efficiency for large numbers of small GRanges, especially in placeholder objects where all the GRanges are zero-length.

Constructor

new GroupedGRanges(ranges, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
ranges Array | GRanges

An array of GRanges objects, where each element represents a group of genomic ranges. All objects should have compatible columns in their elementMetadata.

Alternatively, a single GRanges containing a concatenation of ranges from all groups. In this case, rangeLengths must be supplied.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
rangeLengths TypedArray | Array <optional>
<nullable>
null

Length of the ranges within each group. This should be coercible to an Int32Array, contain non-negative values, and have a sum equal to the length of ranges. Only used if ranges is a single GRanges object, where each group's ranges are assumed to form contiguous intervals along ranges.

names Array <optional>
<nullable>
null

Array of strings of length equal to start, containing names for each genomic range. Alternatively null, in which case the ranges are assumed to be unnamed.

elementMetadata DataFrame <optional>
<nullable>
null

A DataFrame with number of rows equal to the length of start, containing arbitrary per-range annotations. Alternatively null, in which case a zero-column DataFrame is automatically constructed.

metadata Object <optional>
{}

Object containing arbitrary metadata as key-value pairs.

Extends

Classes

GroupedGRanges

Methods

(static) empty(numberOfGroupsopt) → {GroupedGRanges}

Source:
Parameters:
Name Type Attributes Default Description
numberOfGroups number <optional>
0

Numbe of empty groups to create.

Returns:

A GroupedGRanges object of length equal to numberOfGroups, where each group is of zero length.

Type
GroupedGRanges

$setElementMetadata(elementMetadatanullable) → {Vector}

Source:
Overrides:
Parameters:
Name Type Attributes Description
elementMetadata DataFrame <nullable>

Arbitrary metadata for each vector element. This should have number of rows equal to the vector length. Alternatively null, in which case all existing per-element metadata is removed.

Returns:

A reference to this Vector object after setting the element metadata to value.

Type
Vector

$setGroup(i, ranges) → {GroupedGRanges}

Source:

See comments for $setGroup.

Parameters:
Name Type Description
i number

Index of the group of interest.

ranges GRanges

Genomic ranges for group i.

Returns:

A reference to this GroupedGRanges object after setting group i.

Type
GroupedGRanges

$setMetadata(value) → {Annotated}

Source:
Overrides:
Parameters:
Name Type Description
value Object

Object containing the metadata.

Returns:

A reference to this Annotated object.

Type
Annotated

$setNames(namesnullable) → {Vector}

Source:
Overrides:
Parameters:
Name Type Attributes Description
names Array <nullable>

Array of strings containing a name for each range. This should have length equal to the number of ranges. Alternatively null, if no names are present.

Returns:

A reference to this Vector object after setting the element metadata to value.

Type
Vector

$setRanges(ranges) → {GroupedGRanges}

Source:
Parameters:
Name Type Description
ranges GRanges

Genomic ranges of length equal to the concatenated set of ranges returned by ranges.

Returns:

A reference to this GroupedGRanges object after modifying the internal ranges.

Type
GroupedGRanges

buildOverlapIndex(optionsopt) → {GroupedGRangesOverlapIndex}

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
restrictToSeqnames Array | Set <optional>
<nullable>
null

Array or Set containing the sequence names to use in the index. If null, all available sequence names are used.

restrictToStrand Array | Set <optional>
<nullable>
null

Array or Set containing the strands to use in the index. If null, all available strands are used.

Returns:

A pre-built index for computing overlaps with other GRanges instances.

Type
GroupedGRangesOverlapIndex

elementMetadata() → {DataFrame}

Source:
Overrides:
Returns:

A DataFrame with one row corresponding to each vector element, containing arbitrary per-element metadata.

Type
DataFrame

group(i, optionsopt) → {GRanges}

Source:
Parameters:
Name Type Attributes Default Description
i number

Index of the group of interest.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
allowView boolean <optional>
false

Whether a view can be created in any internal slicing operations.

Returns:

The genomic ranges for group i.

Type
GRanges

metadata() → {Map}

Source:
Overrides:
Returns:

Map containing arbitrary metadata.

Type
Map

names() → (nullable) {Array}

Source:
Overrides:
Returns:

Array of strings containing the name of each range, or null if no names are available.

Type
Array

numberOfGroups() → {number}

Source:
Returns:

Number of groups in this object.

Type
number

rangeLengths() → {Int32Array}

Source:
Returns:

The length of each group's ranges along the concatenated set of ranges returned by ranges.

Type
Int32Array

ranges() → {GRanges}

Source:
Returns:

The concatenated set of ranges across all groups.

Type
GRanges

rangeStarts() → {Int32Array}

Source:
Returns:

The start indices for each group's ranges along the concatenated set of ranges returned by ranges.

Type
Int32Array

setElementMetadata(elementMetadatanullable, optionsopt) → {Vector}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
elementMetadata DataFrame <nullable>

Arbitrary metadata for each vector element. This should have number of rows equal to the vector length. Alternatively null, in which case all existing per-element metadata is removed.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this Vector instance in place. If false, a new instance is returned.

Returns:

The Vector object after setting the element metadata to value. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
Vector

setGroup(i, ranges, optionsopt) → {GroupedGRanges}

Source:

Multiple consecutive calls to $setGroup are not executed immediately. Rather, the operations are staged and executed in batch once the modified GroupedGRanges is used in other methods. This enables efficient setting of individual groups inside a single concatenated GRanges.

Parameters:
Name Type Attributes Default Description
i number

Index of the group of interest.

ranges GRanges

Genomic ranges for group i.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this GroupedGRanges instance in place. If false, a new instance is returned.

Returns:

The GroupedGRanges object after setting group i. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
GroupedGRanges

setMetadata(value, optionsopt) → {Annotated}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
value Object | Map

Object containing the metadata.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this Annotated instance in place. If false, a new instance is returned.

Returns:

The Annotated object after replacing the metadata. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
Annotated

setNames(namesnullable, optionsopt) → {Vector}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
names Array <nullable>

Array of strings containing a name for each range. This should have length equal to the number of ranges. Alternatively null, if no names are present.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this Vector instance in place. If false, a new instance is returned.

Returns:

The Vector object after setting the names to value. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
Vector

setRanges(ranges, optionsopt) → {GroupedGRanges}

Source:
Parameters:
Name Type Attributes Default Description
ranges GRanges

Genomic ranges of length equal to the concatenated set of ranges returned by ranges.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this GroupedGRanges instance in place. If false, a new instance is returned.

Returns:

The GroupedGRanges object after modifying the internal ranges. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
GroupedGRanges