GRanges

GRanges

A GRanges object is a collection of genomic ranges, inspired by the class of the same name from the Bioconductor ecosystem. Each range consists of a sequence name, a start position on that sequence, and a width. Each range may also be associated with arbitrary range-level metadata in a DataFrame. The GRanges defines methods for the following generics:

Constructor

new GRanges(seqnames, ranges, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
seqnames Array

Array of strings containing the sequence names for each genomic range.

ranges IRanges

Position and width of the range on its specified sequence. This should have the same length as seqnames.

options Object <optional>
{}

Optional parameters.

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

Array containing the strandedness of each genomic range. This should be 0 (any strand), 1 (forward strand) or -1 (reverse strand). If null, this is assumed to be 0 for all genomic 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

GRanges

Methods

(static) empty() → {GRanges}

Source:
Returns:

A zero-length GRanges object.

Type
GRanges

$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

$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) → {GRanges}

Source:
Parameters:
Name Type Description
ranges IRanges

Start positions and widths for each genomic range. This should have length equal to the number of ranges.

Returns:

A reference to this GRanges object after setting the ranges to ranges.

Type
GRanges

$setSeqnames(seqnames) → {GRanges}

Source:
Parameters:
Name Type Description
seqnames Array

Array of strings containing the sequence names for each genomic range.

Returns:

A reference to this GRanges object after setting the sequence names to seqnames.

Type
GRanges

$setStrand(strand) → {GRanges}

Source:
Parameters:
Name Type Description
strand Array | TypedArray

Array of strands for each genomic range. This should have length equal to the number of ranges. Entries may be 0 (any strand), 1 (forward strand) or -1 (reverse strand).

Returns:

A reference to this GRanges object after setting the strands to strand.

Type
GRanges

buildOverlapIndex(optionsopt) → {GRangesOverlapIndex}

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
GRangesOverlapIndex

elementMetadata() → {DataFrame}

Source:
Overrides:
Returns:

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

Type
DataFrame

end() → {Int32Array}

Source:
Returns:

Array of integers containing the end position (specifically, one-past-the-end) for each genomic range.

Type
Int32Array

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

ranges() → {IRanges}

Source:
Returns:

Start positions and widths for all ranges on their specified sequence names.

Type
IRanges

seqnames() → {Array}

Source:
Returns:

Array of strings containing the sequence name for each genomic range.

Type
Array

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

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) → {GRanges}

Source:
Parameters:
Name Type Attributes Default Description
ranges IRanges

Start positions and widths for each genomic range. This should have length equal to the number of ranges.

options Object <optional>
{}

Optional parameters.

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

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

Returns:

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

Type
GRanges

setSeqnames(seqnames, optionsopt) → {GRanges}

Source:
Parameters:
Name Type Attributes Default Description
seqnames Array

Array of strings containing the sequence names for each genomic range.

options Object <optional>
{}

Optional parameters.

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

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

Returns:

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

Type
GRanges

setStrand(strand, optionsopt) → {GRanges}

Source:
Parameters:
Name Type Attributes Default Description
strand Array | TypedArray

Array of strands for each genomic range. This should have length equal to the number of ranges. Entries may be 0 (any strand), 1 (forward strand) or -1 (reverse strand).

options Object <optional>
{}

Optional parameters.

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

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

Returns:

The GRanges object after setting the strands to strand. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
GRanges

start() → {Int32Array}

Source:
Returns:

Array of integers containing the start position for each genomic range.

Type
Int32Array

strand() → {Int8Array}

Source:
Returns:

Array containing the strandedness for each genomic range - 0 (any strand), 1 (forward strand) or -1 (reverse strand).

Type
Int8Array

width() → {Int32Array}

Source:
Returns:

Array of integers containing the width of each genomic range.

Type
Int32Array