Convert GInteractions with bait range and oe ranges to linkSet
Source:R/formatConverter.R
baitGInteractions-GInteractions-GRanges-GRanges-method.Rd
Convert GInteractions with bait range and oe ranges to linkSet
Usage
# S4 method for class 'GInteractions,GRanges,GRanges'
baitGInteractions(x, geneGr, peakGr, geneSymbol = NULL)
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