findAllOverlap: Get a dataframe from all possible pairwise overlaps from a...

Description Usage Arguments Details Value Examples

View source: R/myGRoverlapFunctions.R

Description

Get a dataframe from all possible pairwise overlaps from a GRangesList where multiple overlaps are on the same line when possible. Or a list of dataframes of any combination using any items in the list

Usage

1
2
findAllOverlap(myGRsToOverlap, allMergedCalculated = NULL, verbose = F,
  returnAllMergedCalculated = F)

Arguments

myGRsToOverlap

a GRangesList with items to overlap

allMergedCalculated

a List with previously calculated overlaps. Default is NULL.

verbose

logical Default is F.

returnAllMergedCalculated

logical to decide if only the final dataframe with all the merges are given or if the list with all the overlaps should be returned. Default is F.

Details

This function is really slow because it will make all pair, triple... comparison possible. Because when you merge 3 dataframes with 2 columns with in total 3 column names, you have 3 ways to do the merge: merge 1 with the merge of 2 and 3 or merge 2 with the merge of 1 and 3 or merge 3 with the merge of 1 and 2. The algorithm will do all and report all. This function is recursive.

Value

Either a dataframe with one column per item in the list with colnames identicals to names of the input with the indices of the overlaps Or a list with this this dataframe + all other which have been calculated in the process.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
gr1 <- GenomicRanges::GRanges(seqnames = "chr1",
ranges = IRanges::IRanges(start = c(1, 11, 199),
                         end = c(10, 12, 200)),
score = c(20, 30, 100))
gr2 <- GenomicRanges::GRanges(seqnames = "chr1",
                             ranges = IRanges::IRanges(start = c(5, 101),
                                                       end = c(15, 102)),
                             score = c(1, 2))
gr3 <- GenomicRanges::GRanges(seqnames = "chr1",
                             ranges = IRanges::IRanges(start = c(1, 100),
                                                       end = c(4, 120)),
                             score = c(10, 20))
grL <- list(first = gr1, second = gr2, third = gr3)
findAllOverlap(grL)
findAllOverlap(grL, returnAllMergedCalculated = TRUE)

lldelisle/usefulLDfunctionsGR documentation built on Nov. 25, 2019, 11:24 a.m.