olRanges.Rd
Function for identifying consensus peak among two peaks sets sharing a minimum relative overlap.
olRanges(query, subject, output = "gr")
Object of class GRanges
, which is a vector of genomic locations and associated annotations.
Object of class GRanges
.
By default "gr"
returns any overlap with OL length information in an object of class GRanges
. Also, can returns an object of class data.frame
with "df"
.
## Sample Data Sets
grq <- GRanges(seqnames = Rle(c("chr1", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)), ranges = IRanges::IRanges(seq(1, 100, by=10), end = seq(30, 120, by=10)), strand = Rle(strand(c("-", "+", "-")), c(1, 7, 2)))
grs <- shift(grq[c(2,5,6)], 5)
## Run olRanges function
olRanges(query=grq, subject=grs, output="df")
#> space Qindex Sindex Qstart Qend Sstart Send OLstart OLend OLlength OLpercQ
#> 1 chr2 2 1 11 40 16 45 16 40 25 83.33333
#> 2 chr2 3 1 21 50 16 45 21 45 25 83.33333
#> 3 chr2 4 1 31 60 16 45 31 45 15 50.00000
#> 4 chr1 5 2 41 70 46 75 46 70 25 83.33333
#> 5 chr1 5 3 41 70 56 85 56 70 15 50.00000
#> 6 chr1 6 2 51 80 46 75 51 75 25 83.33333
#> 7 chr1 6 3 51 80 56 85 56 80 25 83.33333
#> OLpercS OLtype
#> 1 83.33333 oldown
#> 2 83.33333 olup
#> 3 50.00000 olup
#> 4 83.33333 oldown
#> 5 50.00000 oldown
#> 6 83.33333 olup
#> 7 83.33333 oldown
olRanges(query=grq, subject=grs, output="gr")
#> GRanges object with 7 ranges and 13 metadata columns:
#> seqnames ranges strand | space Qindex Sindex Qstart
#> <Rle> <IRanges> <Rle> | <character> <integer> <integer> <integer>
#> [1] chr2 11-40 + | chr2 2 1 11
#> [2] chr2 21-50 + | chr2 3 1 21
#> [3] chr2 31-60 + | chr2 4 1 31
#> [4] chr1 41-70 + | chr1 5 2 41
#> [5] chr1 41-70 + | chr1 5 3 41
#> [6] chr1 51-80 + | chr1 6 2 51
#> [7] chr1 51-80 + | chr1 6 3 51
#> Qend Sstart Send OLstart OLend OLlength OLpercQ
#> <integer> <integer> <integer> <numeric> <numeric> <numeric> <numeric>
#> [1] 40 16 45 16 40 25 83.3333
#> [2] 50 16 45 21 45 25 83.3333
#> [3] 60 16 45 31 45 15 50.0000
#> [4] 70 46 75 46 70 25 83.3333
#> [5] 70 56 85 56 70 15 50.0000
#> [6] 80 46 75 51 75 25 83.3333
#> [7] 80 56 85 56 80 25 83.3333
#> OLpercS OLtype
#> <numeric> <character>
#> [1] 83.3333 oldown
#> [2] 83.3333 olup
#> [3] 50.0000 olup
#> [4] 83.3333 oldown
#> [5] 50.0000 oldown
#> [6] 83.3333 olup
#> [7] 83.3333 oldown
#> -------
#> seqinfo: 3 sequences from an unspecified genome; no seqlengths