Using a finalized LoopRanges loops object and two sets of elements, determines which pairs of elements from the two sets are found overlapping with each other and a loop anchor.

StackedElements(loop_ranges, element_ranges_x, element_ranges_y,
  range_out_x = FALSE, range_out_y = FALSE, overlap_threshold = 1)

Arguments

loop_ranges

A single LoopRanges object that has been subset to one range through ConsensusLoops().

element_ranges_x

The first element ranges to be considered. If using an 'ElementRanges' class object, subset by using list indexing.

element_ranges_y

The second element ranges to be considered. If using an 'ElementRanges' class object, subset by using list indexing.

range_out_x

A boolean indicating if the output should be a subset element ranges object for element_ranges_x instead of the default dataframe. (default = FALSE)

range_out_y

A boolean indicating if the output should be a subset element ranges object for element_ranges_y instead of the default dataframe. (default = FALSE)

overlap_threshold

Single numerical input for significant base-pair overlap to be considered 'overlapping'. Default is 1 base-pair.

Value

Returns a dataframe indicating stacked elements in the form of their first metadata columns. The element_ranges_x are always under column 1, and element_ranges_y are always under column 2.

Examples

# Load enhancer and promoter elements into an ElementRanges object enhancers <- system.file("extdata/elements", "enhancers.bed", package = "LoopRig", mustWork = TRUE) promoters <- system.file("extdata/elements", "promoters.bed", package = "LoopRig", mustWork = TRUE) element_ranges <- ElementsToRanges(enhancers, promoters, element_names = c("enhancers", "promoters"), custom_cols = 1, custom_mcols = 4) # Load loops into LoopRanges object and determine consensus loops ovary_loops <- system.file("extdata/loops", "ovary_hg19.bedpe", package = "LoopRig", mustWork = TRUE) pancreas_loops <- system.file("extdata/loops", "pancreas_hg19.bedpe", package = "LoopRig", mustWork = TRUE) loops <- LoopsToRanges(ovary_loops, pancreas_loops, custom_cols = 0) consensus_loops <- ConsensusLoops(loops) # Determine pairs of enhancers and promoters stacked on loop anchors StackedElements(consensus_loops, element_ranges[[1]], element_ranges[[2]])
#> Element_1 Element_2 #> 1 E2564 RAPGEF4 #> 2 E5878 TGM2