Skip to contents

Convert GInteractions with bait range and oe ranges to linkSet

Usage

# S4 method for class 'GInteractions,GRanges,GRanges'
baitGInteractions(x, geneGr, peakGr, geneSymbol = NULL)

Arguments

geneGr

A GRanges object representing genes

peakGr

A GRanges object representing peaks

geneSymbol

A character vector with same length as geneGr or column name in mcols(geneGr) for gene symbols

gi

A GInteractions object

Value

A linkSet object

Examples

# Example usage:
library(GenomicRanges)
library(InteractionSet)

# Create example GRanges objects for genes and peaks
geneGr <- GRanges(seqnames = "chr1", ranges = IRanges(start = c(100, 200), end = c(150, 250)), geneSymbol = c("Gene1", "Gene2"))
peakGr <- GRanges(seqnames = "chr1", ranges = IRanges(start = c(300, 400), end = c(350, 450)))

# Create example GInteractions object
gi <- GInteractions(anchor1 = geneGr, anchor2 = peakGr)

# Convert to linkSet
linkSetObj <- baitGInteractions(gi, geneGr, peakGr, geneSymbol = "geneSymbol")

# Print the linkSet object
print(linkSetObj)
#> linkSet object with 2 interactions and 2 metadata columns:
#>              bait     seqnames_oe ranges_oe | anchor1.geneSymbol
#>       <character>           <Rle> <IRanges> |        <character>
#>   [1]       Gene1 ---        chr1   300-350 |              Gene1
#>   [2]       Gene2 ---        chr1   400-450 |              Gene2
#>       mcols(gi)[out$query, ]
#>                  <character>
#>   [1]                  Gene1
#>   [2]                  Gene2
#>   -------
#>   regions: 4 ranges and 0 metadata columns
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths