range_comparison: Intersection, Union and Difference of two data frames of...

Description Usage Arguments Value Examples

View source: R/range_comparison.R

Description

This function takes two data frames of genomic ranges and perform intersection, union or difference between them. Internally, this function uses the GenomicRanges package. The only goal of the function is to allow the user to directly work with data frames as input and output, avoiding the conversion to GRanges objects.

Usage

1
range_comparison(df_a, df_b, operation, info)

Arguments

df_a

A dataframe of a bed file.

df_b

A dataframe of a bed file.

operation

A string. Either "intersection", "union" or "difference". The intersection corresponds to those regions in the first dataframe that overlap at least 1 bp with regions in the second dataframe. Default value: "intersection".

info

A string. Either "on" or "off". The default value is "on" and corresponds to display of information regarding the performed set operation.

Value

A dataframe with the intersection, union or difference between the input data frames df_a and df_b.

Examples

1
2
3
4
5
6
df_1 <- data.frame( chr=rep("chr1",4), start=c(1,16,23,45), end=c(9,18,36,49), name=paste("region_",1:4,sep=""), score=rep(1,4), strand=rep("+",4) )
df_2 <- data.frame( chr=rep("chr1",4), start=c(4,19,28,49), end=c(9,21,39,55), name=paste("region_",1:4,sep=""), score=rep(1,4), strand=rep("+",4) )

range_comparison(df_1, df_2, operation="intersection")
range_comparison(df_1, df_2, operation="union")
range_comparison(df_1, df_2, operation="difference")

antonio-mora/chrombrowseR documentation built on Aug. 20, 2019, 3:21 p.m.